From 707d42130c0f10dd063c326303944f063a593256 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 27 Mar 2024 13:16:21 -0700 Subject: [PATCH 01/53] Adds SeverIndexInfo --- .../client/RootServerInfo.java | 5 +- .../configurations/ApiConfiguration.java | 59 +++++++++++++++++-- .../paths/foo/get/FooGetServerInfo.java | 5 +- .../PetfindbystatusServerInfo.java | 5 +- .../configurations/ApiConfiguration.hbs | 29 ++++++++- .../java/packagename/servers/ServerInfo.hbs | 5 +- 6 files changed, 86 insertions(+), 22 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java index b94c5bb4b28..b1ae3c42363 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java @@ -15,16 +15,13 @@ public class RootServerInfo implements ServerProvider { final private Servers servers; - final private ServerIndex serverIndex; public RootServerInfo() { this.servers = new Servers(); - this.serverIndex = ServerIndex.SERVER_0; } - public RootServerInfo(Servers servers, ServerIndex serverIndex) { + public RootServerInfo(Servers servers) { this.servers = servers; - this.serverIndex = serverIndex; } public static class Servers { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index 9b64de10f0c..ead24b98a98 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -31,6 +31,7 @@ public class ApiConfiguration { private final ServerInfo serverInfo; + private final ServerIndexInfo serverIndexInfo; private final SecurityInfo securityInfo; private final SecurityIndexInfo securityIndexInfo; private final @Nullable Duration timeout; @@ -38,14 +39,16 @@ public class ApiConfiguration { public ApiConfiguration() { serverInfo = new ServerInfo(); + serverIndexInfo = new ServerIndexInfo(); securityInfo = new SecurityInfo(); securityIndexInfo = new SecurityIndexInfo(); securitySchemeInfo = new HashMap<>(); timeout = null; } - public ApiConfiguration(ServerInfo serverInfo, SecurityIndexInfo securityIndexInfo, List securitySchemes, Duration timeout) { + public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, SecurityIndexInfo securityIndexInfo, List securitySchemes, Duration timeout) { this.serverInfo = serverInfo; + this.serverIndexInfo = serverIndexInfo; this.securityInfo = new SecurityInfo(); this.securityIndexInfo = securityIndexInfo; securitySchemeInfo = new HashMap<>(); @@ -77,14 +80,62 @@ public ServerInfo( } } + public static class ServerIndexInfo { + protected final RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex; + protected final FooGetServerInfo. @Nullable ServerIndex fooGetServerInfoServerIndex; + protected final PetfindbystatusServerInfo. @Nullable ServerIndex petfindbystatusServerInfoServerIndex; + public ServerIndexInfo() {} + + public ServerIndexInfo rootServerInfoServerIndex(RootServerInfo.ServerIndex serverIndex) { + this.rootServerInfoServerIndex = serverIndex; + return this; + } + + public ServerIndexInfo fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex serverIndex) { + this.fooGetServerInfoServerIndex = serverIndex; + return this; + } + + public ServerIndexInfo petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex serverIndex) { + this.petfindbystatusServerInfoServerIndex = serverIndex; + return this; + } + } + public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { - return serverInfo.rootServerInfo.getServer(serverIndex); + var serverProvider = serverInfo.rootServerInfo; + if (serverIndex == null) { + RootServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.rootServerInfoServerIndex; + if (configServerIndex == null) { + throw new UnsetPropertyException("rootServerInfoServerIndex is unset"); + } + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); } + public Server getServer(FooGetServerInfo. @Nullable ServerIndex serverIndex) { - return serverInfo.fooGetServerInfo.getServer(serverIndex); + var serverProvider = serverInfo.fooGetServerInfo; + if (serverIndex == null) { + FooGetServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.fooGetServerInfoServerIndex; + if (configServerIndex == null) { + throw new UnsetPropertyException("fooGetServerInfoServerIndex is unset"); + } + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); } + public Server getServer(PetfindbystatusServerInfo. @Nullable ServerIndex serverIndex) { - return serverInfo.petfindbystatusServerInfo.getServer(serverIndex); + var serverProvider = serverInfo.petfindbystatusServerInfo; + if (serverIndex == null) { + PetfindbystatusServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.petfindbystatusServerInfoServerIndex; + if (configServerIndex == null) { + throw new UnsetPropertyException("petfindbystatusServerInfoServerIndex is unset"); + } + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); } public static class SecurityInfo { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java index 45d598bb653..8432e2512b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java @@ -14,16 +14,13 @@ public class FooGetServerInfo implements ServerProvider { final private Servers servers; - final private ServerIndex serverIndex; public FooGetServerInfo() { this.servers = new Servers(); - this.serverIndex = ServerIndex.SERVER_0; } - public FooGetServerInfo(Servers servers, ServerIndex serverIndex) { + public FooGetServerInfo(Servers servers) { this.servers = servers; - this.serverIndex = serverIndex; } public static class Servers { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java index 6e499330caf..a7a7f6e139d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java @@ -14,16 +14,13 @@ public class PetfindbystatusServerInfo implements ServerProvider { final private Servers servers; - final private ServerIndex serverIndex; public PetfindbystatusServerInfo() { this.servers = new Servers(); - this.serverIndex = ServerIndex.SERVER_0; } - public PetfindbystatusServerInfo(Servers servers, ServerIndex serverIndex) { + public PetfindbystatusServerInfo(Servers servers) { this.servers = servers; - this.serverIndex = serverIndex; } public static class Servers { diff --git a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs index e04da96ade5..2db507e7f58 100644 --- a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs +++ b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs @@ -32,6 +32,7 @@ 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; @@ -43,6 +44,7 @@ public class ApiConfiguration { public ApiConfiguration() { serverInfo = new ServerInfo(); + serverIndexInfo = new ServerIndexInfo(); {{#gt allSecurity.size 0}} securityInfo = new SecurityInfo(); securityIndexInfo = new SecurityIndexInfo(); @@ -53,8 +55,9 @@ public class ApiConfiguration { timeout = null; } - public ApiConfiguration(ServerInfo serverInfo{{#gt allSecurity.size 0}}, SecurityIndexInfo securityIndexInfo{{/gt}}{{#if securitySchemes}}, List securitySchemes{{/if}}, Duration timeout) { + public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo{{#gt allSecurity.size 0}}, SecurityIndexInfo securityIndexInfo{{/gt}}{{#if securitySchemes}}, List securitySchemes{{/if}}, Duration timeout) { this.serverInfo = serverInfo; + this.serverIndexInfo = serverIndexInfo; {{#gt allSecurity.size 0}} this.securityInfo = new SecurityInfo(); this.securityIndexInfo = securityIndexInfo; @@ -90,9 +93,31 @@ public class ApiConfiguration { } } + public static class ServerIndexInfo { {{#each allServers}} + protected final {{jsonPathPiece.pascalCase}}. @Nullable ServerIndex {{jsonPathPiece.camelCase}}ServerIndex; + {{/each}} + public ServerIndexInfo() {} + {{#each allServers}} + + public ServerIndexInfo {{jsonPathPiece.camelCase}}ServerIndex({{jsonPathPiece.pascalCase}}.ServerIndex serverIndex) { + this.{{jsonPathPiece.camelCase}}ServerIndex = serverIndex; + return this; + } + {{/each}} + } + {{#each allServers}} + public Server getServer({{jsonPathPiece.pascalCase}}. @Nullable ServerIndex serverIndex) { - return serverInfo.{{jsonPathPiece.camelCase}}.getServer(serverIndex); + var serverProvider = serverInfo.{{jsonPathPiece.camelCase}}; + if (serverIndex == null) { + {{jsonPathPiece.pascalCase}}. @Nullable ServerIndex configServerIndex = serverIndexInfo.{{jsonPathPiece.camelCase}}ServerIndex; + if (configServerIndex == null) { + throw new UnsetPropertyException("{{jsonPathPiece.camelCase}}ServerIndex is unset"); + } + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); } {{/each}} {{#gt allSecurity.size 0}} diff --git a/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs b/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs index 3f73b7eb5a3..d1ce8e70641 100644 --- a/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs +++ b/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs @@ -19,16 +19,13 @@ import java.util.EnumMap; public class {{servers.jsonPathPiece.pascalCase}} implements ServerProvider<{{servers.jsonPathPiece.pascalCase}}.ServerIndex> { final private Servers servers; - final private ServerIndex serverIndex; public {{servers.jsonPathPiece.pascalCase}}() { this.servers = new Servers(); - this.serverIndex = ServerIndex.SERVER_0; } - public {{servers.jsonPathPiece.pascalCase}}(Servers servers, ServerIndex serverIndex) { + public {{servers.jsonPathPiece.pascalCase}}(Servers servers) { this.servers = servers; - this.serverIndex = serverIndex; } public static class Servers { From 777c5938727cd1893f153e3b6fcb0642c522d6b4 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 27 Mar 2024 17:01:34 -0700 Subject: [PATCH 02/53] Generates separate docs for server variables schema --- .../petstore/java/.openapi-generator/FILES | 8 + .../petstore/java/docs/RootServerInfo.md | 25 + .../docs/paths/foo/get/FooGetServerInfo.md | 24 + .../paths/foo/get/servers/FooGetServer0.md | 14 + .../paths/foo/get/servers/FooGetServer1.md | 16 + .../foo/get/servers/server1/Variables.md | 355 +++++++++++++ .../PetfindbystatusServerInfo.md | 24 + .../servers/PetfindbystatusServer0.md | 14 + .../servers/PetfindbystatusServer1.md | 16 + .../servers/server1/Variables.md | 355 +++++++++++++ .../petstore/java/docs/servers/Server0.md | 491 +----------------- .../petstore/java/docs/servers/Server1.md | 360 +------------ .../java/docs/servers/server0/Variables.md | 486 +++++++++++++++++ .../java/docs/servers/server1/Variables.md | 355 +++++++++++++ .../client/RootServerInfo.java | 82 +-- .../configurations/ApiConfiguration.java | 30 +- .../paths/foo/get/FooGetServerInfo.java | 69 +-- .../PetfindbystatusServerInfo.java | 69 +-- .../client/servers/ServerProvider.java | 4 +- .../DefaultGeneratorRunner.java | 21 +- .../codegen/generators/DefaultGenerator.java | 4 +- .../openapimodels/CodegenServer.java | 11 +- .../configurations/ApiConfiguration.hbs | 10 +- .../java/packagename/servers/ServerDoc.hbs | 8 +- .../java/packagename/servers/ServerInfo.hbs | 69 +-- .../packagename/servers/ServerInfoDoc.hbs | 25 + .../packagename/servers/ServerProvider.hbs | 4 +- 27 files changed, 1845 insertions(+), 1104 deletions(-) create mode 100644 samples/client/petstore/java/docs/paths/foo/get/servers/FooGetServer0.md create mode 100644 samples/client/petstore/java/docs/paths/foo/get/servers/FooGetServer1.md create mode 100644 samples/client/petstore/java/docs/paths/foo/get/servers/server1/Variables.md create mode 100644 samples/client/petstore/java/docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md create mode 100644 samples/client/petstore/java/docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md create mode 100644 samples/client/petstore/java/docs/paths/petfindbystatus/servers/server1/Variables.md create mode 100644 samples/client/petstore/java/docs/servers/server0/Variables.md create mode 100644 samples/client/petstore/java/docs/servers/server1/Variables.md diff --git a/samples/client/petstore/java/.openapi-generator/FILES b/samples/client/petstore/java/.openapi-generator/FILES index aa899ef9fe6..ba6c49d0594 100644 --- a/samples/client/petstore/java/.openapi-generator/FILES +++ b/samples/client/petstore/java/.openapi-generator/FILES @@ -518,6 +518,9 @@ docs/paths/foo/get/FooGetServerInfo.md docs/paths/foo/get/Responses.md docs/paths/foo/get/responses/CodedefaultResponse.md docs/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md +docs/paths/foo/get/servers/FooGetServer0.md +docs/paths/foo/get/servers/FooGetServer1.md +docs/paths/foo/get/servers/server1/Variables.md docs/paths/pet/Post.md docs/paths/pet/Put.md docs/paths/pet/post/PetPostSecurityInfo.md @@ -547,6 +550,9 @@ docs/paths/petfindbystatus/get/responses/Code400Response.md docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md +docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md +docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md +docs/paths/petfindbystatus/servers/server1/Variables.md docs/paths/petfindbytags/Get.md docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md docs/paths/petfindbytags/get/QueryParameters.md @@ -678,6 +684,8 @@ docs/paths/userusername/put/responses/Code404Response.md docs/servers/Server0.md docs/servers/Server1.md docs/servers/Server2.md +docs/servers/server0/Variables.md +docs/servers/server1/Variables.md pom.xml src/main/java/org/openapijsonschematools/client/RootServerInfo.java src/main/java/org/openapijsonschematools/client/apiclient/ApiClient.java diff --git a/samples/client/petstore/java/docs/RootServerInfo.md b/samples/client/petstore/java/docs/RootServerInfo.md index 7923e66cc3f..8df9c7bf6ee 100644 --- a/samples/client/petstore/java/docs/RootServerInfo.md +++ b/samples/client/petstore/java/docs/RootServerInfo.md @@ -4,13 +4,38 @@ RootServerInfo.java public class RootServerInfo A class that provides a server, and any needed server info classes +- a class that is a 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 | | 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()
Creates an instance using default server variable values | +| RootServerInfo1(@Nullable [Server0](servers/Server0.md) server0,@Nullable [Server1](servers/Server1.md) server1,@Nullable [Server2](servers/Server2.md) server2)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [Server0](servers/Server0.md) | server0 | +| [Server1](servers/Server1.md) | server1 | +| [Server2](servers/Server2.md) | server2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + ## ServerIndex enum ServerIndex
diff --git a/samples/client/petstore/java/docs/paths/foo/get/FooGetServerInfo.md b/samples/client/petstore/java/docs/paths/foo/get/FooGetServerInfo.md index 146e93779f6..915469d5030 100644 --- a/samples/client/petstore/java/docs/paths/foo/get/FooGetServerInfo.md +++ b/samples/client/petstore/java/docs/paths/foo/get/FooGetServerInfo.md @@ -4,13 +4,37 @@ FooGetServerInfo.java public class FooGetServerInfo A class that provides a server, and any needed server info classes +- a class that is a ServerProvider - an enum class that stores server index values ## Nested Class Summary | Modifier and Type | Class and Description | | ----------------- | --------------------- | +| static class | [FooGetServerInfo.FooGetServerInfo1](#foogetserverinfo1)
class that stores a server index | | enum | [FooGetServerInfo.ServerIndex](#serverindex)
class that stores a server index | +## FooGetServerInfo1 +implements ServerProvider<[ServerIndex](#serverindex)>
+ +A class that stores servers and allows one to be returned with a ServerIndex instance + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooGetServerInfo1()
Creates an instance using default server variable values | +| FooGetServerInfo1(@Nullable [FooGetServer0](../../../paths/foo/get/servers/FooGetServer0.md) server0,@Nullable [FooGetServer1](../../../paths/foo/get/servers/FooGetServer1.md) server1)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FooGetServer0](../../../paths/foo/get/servers/FooGetServer0.md) | server0 | +| [FooGetServer1](../../../paths/foo/get/servers/FooGetServer1.md) | server1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + ## ServerIndex enum ServerIndex
diff --git a/samples/client/petstore/java/docs/paths/foo/get/servers/FooGetServer0.md b/samples/client/petstore/java/docs/paths/foo/get/servers/FooGetServer0.md new file mode 100644 index 00000000000..31c72b6c42f --- /dev/null +++ b/samples/client/petstore/java/docs/paths/foo/get/servers/FooGetServer0.md @@ -0,0 +1,14 @@ +# Server FooGetServer0 +public class FooGetServer0 + +A class that stores a server url + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooGetServer0()
Creates a server | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | url = "https://path-server-test.petstore.local/v2" | diff --git a/samples/client/petstore/java/docs/paths/foo/get/servers/FooGetServer1.md b/samples/client/petstore/java/docs/paths/foo/get/servers/FooGetServer1.md new file mode 100644 index 00000000000..d44a22da5e5 --- /dev/null +++ b/samples/client/petstore/java/docs/paths/foo/get/servers/FooGetServer1.md @@ -0,0 +1,16 @@ +# Server FooGetServer1 +public class FooGetServer1 + +A class that stores a server url + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooGetServer1()
Creates a server using default values for variables | +| FooGetServer1([Variables.VariablesMap](../../../../paths/foo/get/servers/server1/Variables.md#variablesmap) variables)
Creates a server using input values for variables | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | url = "https://petstore.swagger.io/{version}" | +| [Variables.VariablesMap](../../../../paths/foo/get/servers/server1/Variables.md#variablesmap) | variables | diff --git a/samples/client/petstore/java/docs/paths/foo/get/servers/server1/Variables.md b/samples/client/petstore/java/docs/paths/foo/get/servers/server1/Variables.md new file mode 100644 index 00000000000..8eaa0c30592 --- /dev/null +++ b/samples/client/petstore/java/docs/paths/foo/get/servers/server1/Variables.md @@ -0,0 +1,355 @@ +# Variables +public class Variables
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Variables.Variables1Boxed](#variables1boxed)
sealed interface for validated payloads | +| record | [Variables.Variables1BoxedMap](#variables1boxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.Variables1](#variables1)
schema class | +| static class | [Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | +| static class | [Variables.VariablesMap](#variablesmap)
output class for Map payloads | +| sealed interface | [Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | +| record | [Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | +| static class | [Variables.Version](#version)
schema class | +| enum | [Variables.StringVersionEnums](#stringversionenums)
String enum | +| sealed interface | [Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.AdditionalProperties](#additionalproperties)
schema class | + +## Variables1Boxed +public sealed interface Variables1Boxed
+permits
+[Variables1BoxedMap](#variables1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Variables1BoxedMap +public record Variables1BoxedMap
+implements [Variables1Boxed](#variables1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Variables1BoxedMap([VariablesMap](#variablesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Variables1 +public static class Variables1
+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.paths.foo.get.servers.server1.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// Map validation +Variables.VariablesMap validatedPayload = + Variables.Variables1.validate( + new Variables.VariablesMapBuilder() + .version("v1") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("version", [Version.class](#version)))
)
| +| Set | required = Set.of(
    "version"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | validate([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1BoxedMap](#variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1Boxed](#variables1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## VariablesMap0Builder +public class VariablesMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMap0Builder(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 | + +## VariablesMapBuilder +public class VariablesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap0Builder](#variablesmap0builder) | version(String value) | +| [VariablesMap0Builder](#variablesmap0builder) | version([StringVersionEnums](#stringversionenums) value) | + +## VariablesMap +public static class VariablesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [VariablesMap](#variablesmap) | of([Map](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| String | version()
must be one of ["v1", "v2"] if omitted the server will use the default value of v1 | + +## VersionBoxed +public sealed interface VersionBoxed
+permits
+[VersionBoxedString](#versionboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## VersionBoxedString +public record VersionBoxedString
+implements [VersionBoxed](#versionboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VersionBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Version +public static class Version
+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.paths.foo.get.servers.server1.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// String validation +String validatedPayload = Variables.Version.validate( + "v1", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "v1",
    "v2"
)
| +| @Nullable Object | defaultValue = "v1" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringVersionEnums](#stringversionenums) arg, SchemaConfiguration configuration) | +| [VersionBoxedString](#versionboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [VersionBoxed](#versionboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringVersionEnums +public enum StringVersionEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| V1 | value = "v1" | +| V2 | value = "v2" | + +## AdditionalPropertiesBoxed +public 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 +public record AdditionalPropertiesBoxedVoid
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Void data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Void | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedBoolean +public record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedNumber +public record AdditionalPropertiesBoxedNumber
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedString +public record AdditionalPropertiesBoxedString
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedList +public record AdditionalPropertiesBoxedList
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedMap +public record AdditionalPropertiesBoxedMap
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties +public static class AdditionalProperties
+extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md b/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md index 8eaa744bf52..65da91a672e 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md @@ -4,13 +4,37 @@ PetfindbystatusServerInfo.java public class PetfindbystatusServerInfo A class that provides a server, and any needed server info classes +- a class that is a ServerProvider - an enum class that stores server index values ## Nested Class Summary | Modifier and Type | Class and Description | | ----------------- | --------------------- | +| static class | [PetfindbystatusServerInfo.PetfindbystatusServerInfo1](#petfindbystatusserverinfo1)
class that stores a server index | | enum | [PetfindbystatusServerInfo.ServerIndex](#serverindex)
class that stores a server index | +## PetfindbystatusServerInfo1 +implements ServerProvider<[ServerIndex](#serverindex)>
+ +A class that stores servers and allows one to be returned with a ServerIndex instance + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusServerInfo1()
Creates an instance using default server variable values | +| PetfindbystatusServerInfo1(@Nullable [PetfindbystatusServer0](../../paths/petfindbystatus/servers/PetfindbystatusServer0.md) server0,@Nullable [PetfindbystatusServer1](../../paths/petfindbystatus/servers/PetfindbystatusServer1.md) server1)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetfindbystatusServer0](../../paths/petfindbystatus/servers/PetfindbystatusServer0.md) | server0 | +| [PetfindbystatusServer1](../../paths/petfindbystatus/servers/PetfindbystatusServer1.md) | server1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + ## ServerIndex enum ServerIndex
diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md b/samples/client/petstore/java/docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md new file mode 100644 index 00000000000..475550269b3 --- /dev/null +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md @@ -0,0 +1,14 @@ +# Server PetfindbystatusServer0 +public class PetfindbystatusServer0 + +A class that stores a server url + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusServer0()
Creates a server | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | url = "https://path-server-test.petstore.local/v2" | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md b/samples/client/petstore/java/docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md new file mode 100644 index 00000000000..1417178681c --- /dev/null +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md @@ -0,0 +1,16 @@ +# Server PetfindbystatusServer1 +public class PetfindbystatusServer1 + +A class that stores a server url + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusServer1()
Creates a server using default values for variables | +| PetfindbystatusServer1([Variables.VariablesMap](../../../paths/petfindbystatus/servers/server1/Variables.md#variablesmap) variables)
Creates a server using input values for variables | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | url = "https://petstore.swagger.io/{version}" | +| [Variables.VariablesMap](../../../paths/petfindbystatus/servers/server1/Variables.md#variablesmap) | variables | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/servers/server1/Variables.md b/samples/client/petstore/java/docs/paths/petfindbystatus/servers/server1/Variables.md new file mode 100644 index 00000000000..46cdc192bca --- /dev/null +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/servers/server1/Variables.md @@ -0,0 +1,355 @@ +# Variables +public class Variables
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Variables.Variables1Boxed](#variables1boxed)
sealed interface for validated payloads | +| record | [Variables.Variables1BoxedMap](#variables1boxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.Variables1](#variables1)
schema class | +| static class | [Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | +| static class | [Variables.VariablesMap](#variablesmap)
output class for Map payloads | +| sealed interface | [Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | +| record | [Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | +| static class | [Variables.Version](#version)
schema class | +| enum | [Variables.StringVersionEnums](#stringversionenums)
String enum | +| sealed interface | [Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.AdditionalProperties](#additionalproperties)
schema class | + +## Variables1Boxed +public sealed interface Variables1Boxed
+permits
+[Variables1BoxedMap](#variables1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Variables1BoxedMap +public record Variables1BoxedMap
+implements [Variables1Boxed](#variables1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Variables1BoxedMap([VariablesMap](#variablesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Variables1 +public static class Variables1
+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.paths.petfindbystatus.servers.server1.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// Map validation +Variables.VariablesMap validatedPayload = + Variables.Variables1.validate( + new Variables.VariablesMapBuilder() + .version("v1") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("version", [Version.class](#version)))
)
| +| Set | required = Set.of(
    "version"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | validate([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1BoxedMap](#variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1Boxed](#variables1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## VariablesMap0Builder +public class VariablesMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMap0Builder(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 | + +## VariablesMapBuilder +public class VariablesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap0Builder](#variablesmap0builder) | version(String value) | +| [VariablesMap0Builder](#variablesmap0builder) | version([StringVersionEnums](#stringversionenums) value) | + +## VariablesMap +public static class VariablesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [VariablesMap](#variablesmap) | of([Map](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| String | version()
must be one of ["v1", "v2"] if omitted the server will use the default value of v1 | + +## VersionBoxed +public sealed interface VersionBoxed
+permits
+[VersionBoxedString](#versionboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## VersionBoxedString +public record VersionBoxedString
+implements [VersionBoxed](#versionboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VersionBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Version +public static class Version
+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.paths.petfindbystatus.servers.server1.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// String validation +String validatedPayload = Variables.Version.validate( + "v1", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "v1",
    "v2"
)
| +| @Nullable Object | defaultValue = "v1" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringVersionEnums](#stringversionenums) arg, SchemaConfiguration configuration) | +| [VersionBoxedString](#versionboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [VersionBoxed](#versionboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringVersionEnums +public enum StringVersionEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| V1 | value = "v1" | +| V2 | value = "v2" | + +## AdditionalPropertiesBoxed +public 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 +public record AdditionalPropertiesBoxedVoid
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Void data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Void | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedBoolean +public record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedNumber +public record AdditionalPropertiesBoxedNumber
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedString +public record AdditionalPropertiesBoxedString
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedList +public record AdditionalPropertiesBoxedList
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedMap +public record AdditionalPropertiesBoxedMap
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties +public static class AdditionalProperties
+extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/java/docs/servers/Server0.md b/samples/client/petstore/java/docs/servers/Server0.md index 4612ee1d333..199ec6ccd47 100644 --- a/samples/client/petstore/java/docs/servers/Server0.md +++ b/samples/client/petstore/java/docs/servers/Server0.md @@ -11,499 +11,12 @@ petstore server | Constructor and Description | | --------------------------- | | Server0()
Creates a server using default values for variables | -| Server0([Variables.VariablesMap](#variablesmap) variables)
Creates a server using input values for variables | +| Server0([Variables.VariablesMap](../servers/server0/Variables.md#variablesmap) variables)
Creates a server using input values for variables | ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | | String | url = "http://{server}.swagger.io:{port}/v2" | -| [Variables.VariablesMap](#variablesmap) | variables | - -## Variables -public class Variables
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads -- enum classes - -### Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Variables.Variables1Boxed](#variables1boxed)
sealed interface for validated payloads | -| record | [Variables.Variables1BoxedMap](#variables1boxedmap)
boxed class to store validated Map payloads | -| static class | [Variables.Variables1](#variables1)
schema class | -| static class | [Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | -| static class | [Variables.VariablesMap](#variablesmap)
output class for Map payloads | -| sealed interface | [Variables.PortBoxed](#portboxed)
sealed interface for validated payloads | -| record | [Variables.PortBoxedString](#portboxedstring)
boxed class to store validated String payloads | -| static class | [Variables.Port](#port)
schema class | -| enum | [Variables.StringPortEnums](#stringportenums)
String enum | -| sealed interface | [Variables.ServerBoxed](#serverboxed)
sealed interface for validated payloads | -| record | [Variables.ServerBoxedString](#serverboxedstring)
boxed class to store validated String payloads | -| static class | [Variables.Server](#server)
schema class | -| enum | [Variables.StringServerEnums](#stringserverenums)
String enum | -| sealed interface | [Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [Variables.AdditionalProperties](#additionalproperties)
schema class | - -### Variables1Boxed -public sealed interface Variables1Boxed
-permits
-[Variables1BoxedMap](#variables1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -### Variables1BoxedMap -public record Variables1BoxedMap
-implements [Variables1Boxed](#variables1boxed) - -record that stores validated Map payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Variables1BoxedMap([VariablesMap](#variablesmap) data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap](#variablesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### Variables1 -public static class Variables1
-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.servers.server0.Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); - -// Map validation -Variables.VariablesMap validatedPayload = - Variables.Variables1.validate( - new Variables.VariablesMapBuilder() - .port("80") - - .server("petstore") - - .build(), - configuration -); -``` - -#### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("server", [Server.class](#server))),
    new PropertyEntry("port", [Port.class](#port)))
)
| -| Set | required = Set.of(
    "port",
    "server"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap](#variablesmap) | validate([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [Variables1BoxedMap](#variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [Variables1Boxed](#variables1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -### VariablesMap00Builder -public class VariablesMap00Builder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMap00Builder(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 | - -### VariablesMap01Builder -public class VariablesMap01Builder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap00Builder](#variablesmap00builder) | server(String value) | -| [VariablesMap00Builder](#variablesmap00builder) | server([StringServerEnums](#stringserverenums) value) | - -### VariablesMap10Builder -public class VariablesMap10Builder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap00Builder](#variablesmap00builder) | port(String value) | -| [VariablesMap00Builder](#variablesmap00builder) | port([StringPortEnums](#stringportenums) value) | - -### VariablesMapBuilder -public class VariablesMapBuilder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMapBuilder()
Creates a builder that contains an empty map | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap01Builder](#variablesmap01builder) | port(String value) | -| [VariablesMap01Builder](#variablesmap01builder) | port([StringPortEnums](#stringportenums) value) | -| [VariablesMap10Builder](#variablesmap10builder) | server(String value) | -| [VariablesMap10Builder](#variablesmap10builder) | server([StringServerEnums](#stringserverenums) value) | - -### VariablesMap -public static class VariablesMap
-extends FrozenMap - -A class to store validated Map payloads - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [VariablesMap](#variablesmap) | of([Map](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| String | port()
must be one of ["80", "8080"] if omitted the server will use the default value of 80 | -| String | server()
must be one of ["petstore", "qa-petstore", "dev-petstore"] if omitted the server will use the default value of petstore | - -### PortBoxed -public sealed interface PortBoxed
-permits
-[PortBoxedString](#portboxedstring) - -sealed interface that stores validated payloads using boxed classes - -### PortBoxedString -public record PortBoxedString
-implements [PortBoxed](#portboxed) - -record that stores validated String payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PortBoxedString(String data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### Port -public static class Port
-extends JsonSchema - -A schema class that validates payloads - -### Description -the port - -#### 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.servers.server0.Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); - -// String validation -String validatedPayload = Variables.Port.validate( - "80", - configuration -); -``` - -#### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "80",
    "8080"
)
| -| @Nullable Object | defaultValue = "80" | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringPortEnums](#stringportenums) arg, SchemaConfiguration configuration) | -| [PortBoxedString](#portboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [PortBoxed](#portboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -### StringPortEnums -public enum StringPortEnums
-extends `Enum` - -A class that stores String enum values - -#### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_80 | value = "80" | -| POSITIVE_8080 | value = "8080" | - -### ServerBoxed -public sealed interface ServerBoxed
-permits
-[ServerBoxedString](#serverboxedstring) - -sealed interface that stores validated payloads using boxed classes - -### ServerBoxedString -public record ServerBoxedString
-implements [ServerBoxed](#serverboxed) - -record that stores validated String payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ServerBoxedString(String data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### Server -public static class Server
-extends JsonSchema - -A schema class that validates payloads - -### Description -server host prefix - -#### 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.servers.server0.Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); - -// String validation -String validatedPayload = Variables.Server.validate( - "petstore", - configuration -); -``` - -#### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "petstore",
    "qa-petstore",
    "dev-petstore"
)
| -| @Nullable Object | defaultValue = "petstore" | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringServerEnums](#stringserverenums) arg, SchemaConfiguration configuration) | -| [ServerBoxedString](#serverboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ServerBoxed](#serverboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -### StringServerEnums -public enum StringServerEnums
-extends `Enum` - -A class that stores String enum values - -#### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| PETSTORE | value = "petstore" | -| QA_HYPHEN_MINUS_PETSTORE | value = "qa-petstore" | -| DEV_HYPHEN_MINUS_PETSTORE | value = "dev-petstore" | - -### AdditionalPropertiesBoxed -public 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 -public record AdditionalPropertiesBoxedVoid
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated null payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedVoid(Void data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Void | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedBoolean -public record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedNumber -public record AdditionalPropertiesBoxedNumber
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedString -public record AdditionalPropertiesBoxedString
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedList -public record AdditionalPropertiesBoxedList
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated List payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenList<@Nullable Object> | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedMap -public record AdditionalPropertiesBoxedMap
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated Map payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap<@Nullable Object> | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalProperties -public static class AdditionalProperties
-extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | +| [Variables.VariablesMap](../servers/server0/Variables.md#variablesmap) | variables | [[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/java/docs/servers/Server1.md b/samples/client/petstore/java/docs/servers/Server1.md index 9fb232ff697..8c170c320c6 100644 --- a/samples/client/petstore/java/docs/servers/Server1.md +++ b/samples/client/petstore/java/docs/servers/Server1.md @@ -11,368 +11,12 @@ The local server | Constructor and Description | | --------------------------- | | Server1()
Creates a server using default values for variables | -| Server1([Variables.VariablesMap](#variablesmap) variables)
Creates a server using input values for variables | +| Server1([Variables.VariablesMap](../servers/server1/Variables.md#variablesmap) variables)
Creates a server using input values for variables | ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | | String | url = "https://localhost:8080/{version}" | -| [Variables.VariablesMap](#variablesmap) | variables | - -## Variables -public class Variables
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads -- enum classes - -### Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Variables.Variables1Boxed](#variables1boxed)
sealed interface for validated payloads | -| record | [Variables.Variables1BoxedMap](#variables1boxedmap)
boxed class to store validated Map payloads | -| static class | [Variables.Variables1](#variables1)
schema class | -| static class | [Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | -| static class | [Variables.VariablesMap](#variablesmap)
output class for Map payloads | -| sealed interface | [Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | -| record | [Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | -| static class | [Variables.Version](#version)
schema class | -| enum | [Variables.StringVersionEnums](#stringversionenums)
String enum | -| sealed interface | [Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [Variables.AdditionalProperties](#additionalproperties)
schema class | - -### Variables1Boxed -public sealed interface Variables1Boxed
-permits
-[Variables1BoxedMap](#variables1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -### Variables1BoxedMap -public record Variables1BoxedMap
-implements [Variables1Boxed](#variables1boxed) - -record that stores validated Map payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Variables1BoxedMap([VariablesMap](#variablesmap) data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap](#variablesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### Variables1 -public static class Variables1
-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.servers.server1.Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); - -// Map validation -Variables.VariablesMap validatedPayload = - Variables.Variables1.validate( - new Variables.VariablesMapBuilder() - .version("v1") - - .build(), - configuration -); -``` - -#### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("version", [Version.class](#version)))
)
| -| Set | required = Set.of(
    "version"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap](#variablesmap) | validate([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [Variables1BoxedMap](#variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [Variables1Boxed](#variables1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -### VariablesMap0Builder -public class VariablesMap0Builder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMap0Builder(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 | - -### VariablesMapBuilder -public class VariablesMapBuilder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMapBuilder()
Creates a builder that contains an empty map | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap0Builder](#variablesmap0builder) | version(String value) | -| [VariablesMap0Builder](#variablesmap0builder) | version([StringVersionEnums](#stringversionenums) value) | - -### VariablesMap -public static class VariablesMap
-extends FrozenMap - -A class to store validated Map payloads - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [VariablesMap](#variablesmap) | of([Map](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| String | version()
must be one of ["v1", "v2"] if omitted the server will use the default value of v2 | - -### VersionBoxed -public sealed interface VersionBoxed
-permits
-[VersionBoxedString](#versionboxedstring) - -sealed interface that stores validated payloads using boxed classes - -### VersionBoxedString -public record VersionBoxedString
-implements [VersionBoxed](#versionboxed) - -record that stores validated String payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VersionBoxedString(String data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### Version -public static class Version
-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.servers.server1.Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); - -// String validation -String validatedPayload = Variables.Version.validate( - "v1", - configuration -); -``` - -#### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "v1",
    "v2"
)
| -| @Nullable Object | defaultValue = "v2" | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringVersionEnums](#stringversionenums) arg, SchemaConfiguration configuration) | -| [VersionBoxedString](#versionboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [VersionBoxed](#versionboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -### StringVersionEnums -public enum StringVersionEnums
-extends `Enum` - -A class that stores String enum values - -#### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| V1 | value = "v1" | -| V2 | value = "v2" | - -### AdditionalPropertiesBoxed -public 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 -public record AdditionalPropertiesBoxedVoid
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated null payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedVoid(Void data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Void | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedBoolean -public record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedNumber -public record AdditionalPropertiesBoxedNumber
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedString -public record AdditionalPropertiesBoxedString
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedList -public record AdditionalPropertiesBoxedList
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated List payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenList<@Nullable Object> | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedMap -public record AdditionalPropertiesBoxedMap
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated Map payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap<@Nullable Object> | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalProperties -public static class AdditionalProperties
-extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | +| [Variables.VariablesMap](../servers/server1/Variables.md#variablesmap) | variables | [[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/java/docs/servers/server0/Variables.md b/samples/client/petstore/java/docs/servers/server0/Variables.md new file mode 100644 index 00000000000..421da38ed92 --- /dev/null +++ b/samples/client/petstore/java/docs/servers/server0/Variables.md @@ -0,0 +1,486 @@ +# Variables +public class Variables
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Variables.Variables1Boxed](#variables1boxed)
sealed interface for validated payloads | +| record | [Variables.Variables1BoxedMap](#variables1boxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.Variables1](#variables1)
schema class | +| static class | [Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | +| static class | [Variables.VariablesMap](#variablesmap)
output class for Map payloads | +| sealed interface | [Variables.PortBoxed](#portboxed)
sealed interface for validated payloads | +| record | [Variables.PortBoxedString](#portboxedstring)
boxed class to store validated String payloads | +| static class | [Variables.Port](#port)
schema class | +| enum | [Variables.StringPortEnums](#stringportenums)
String enum | +| sealed interface | [Variables.ServerBoxed](#serverboxed)
sealed interface for validated payloads | +| record | [Variables.ServerBoxedString](#serverboxedstring)
boxed class to store validated String payloads | +| static class | [Variables.Server](#server)
schema class | +| enum | [Variables.StringServerEnums](#stringserverenums)
String enum | +| sealed interface | [Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.AdditionalProperties](#additionalproperties)
schema class | + +## Variables1Boxed +public sealed interface Variables1Boxed
+permits
+[Variables1BoxedMap](#variables1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Variables1BoxedMap +public record Variables1BoxedMap
+implements [Variables1Boxed](#variables1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Variables1BoxedMap([VariablesMap](#variablesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Variables1 +public static class Variables1
+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.servers.server0.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// Map validation +Variables.VariablesMap validatedPayload = + Variables.Variables1.validate( + new Variables.VariablesMapBuilder() + .port("80") + + .server("petstore") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("server", [Server.class](#server))),
    new PropertyEntry("port", [Port.class](#port)))
)
| +| Set | required = Set.of(
    "port",
    "server"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | validate([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1BoxedMap](#variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1Boxed](#variables1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## VariablesMap00Builder +public class VariablesMap00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMap00Builder(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 | + +## VariablesMap01Builder +public class VariablesMap01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap00Builder](#variablesmap00builder) | server(String value) | +| [VariablesMap00Builder](#variablesmap00builder) | server([StringServerEnums](#stringserverenums) value) | + +## VariablesMap10Builder +public class VariablesMap10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap00Builder](#variablesmap00builder) | port(String value) | +| [VariablesMap00Builder](#variablesmap00builder) | port([StringPortEnums](#stringportenums) value) | + +## VariablesMapBuilder +public class VariablesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap01Builder](#variablesmap01builder) | port(String value) | +| [VariablesMap01Builder](#variablesmap01builder) | port([StringPortEnums](#stringportenums) value) | +| [VariablesMap10Builder](#variablesmap10builder) | server(String value) | +| [VariablesMap10Builder](#variablesmap10builder) | server([StringServerEnums](#stringserverenums) value) | + +## VariablesMap +public static class VariablesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [VariablesMap](#variablesmap) | of([Map](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| String | port()
must be one of ["80", "8080"] if omitted the server will use the default value of 80 | +| String | server()
must be one of ["petstore", "qa-petstore", "dev-petstore"] if omitted the server will use the default value of petstore | + +## PortBoxed +public sealed interface PortBoxed
+permits
+[PortBoxedString](#portboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PortBoxedString +public record PortBoxedString
+implements [PortBoxed](#portboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PortBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Port +public static class Port
+extends JsonSchema + +A schema class that validates payloads + +## Description +the port + +### 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.servers.server0.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// String validation +String validatedPayload = Variables.Port.validate( + "80", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "80",
    "8080"
)
| +| @Nullable Object | defaultValue = "80" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringPortEnums](#stringportenums) arg, SchemaConfiguration configuration) | +| [PortBoxedString](#portboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [PortBoxed](#portboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringPortEnums +public enum StringPortEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_80 | value = "80" | +| POSITIVE_8080 | value = "8080" | + +## ServerBoxed +public sealed interface ServerBoxed
+permits
+[ServerBoxedString](#serverboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## ServerBoxedString +public record ServerBoxedString
+implements [ServerBoxed](#serverboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ServerBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Server +public static class Server
+extends JsonSchema + +A schema class that validates payloads + +## Description +server host prefix + +### 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.servers.server0.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// String validation +String validatedPayload = Variables.Server.validate( + "petstore", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "petstore",
    "qa-petstore",
    "dev-petstore"
)
| +| @Nullable Object | defaultValue = "petstore" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringServerEnums](#stringserverenums) arg, SchemaConfiguration configuration) | +| [ServerBoxedString](#serverboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ServerBoxed](#serverboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringServerEnums +public enum StringServerEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| PETSTORE | value = "petstore" | +| QA_HYPHEN_MINUS_PETSTORE | value = "qa-petstore" | +| DEV_HYPHEN_MINUS_PETSTORE | value = "dev-petstore" | + +## AdditionalPropertiesBoxed +public 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 +public record AdditionalPropertiesBoxedVoid
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Void data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Void | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedBoolean +public record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedNumber +public record AdditionalPropertiesBoxedNumber
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedString +public record AdditionalPropertiesBoxedString
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedList +public record AdditionalPropertiesBoxedList
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedMap +public record AdditionalPropertiesBoxedMap
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties +public static class AdditionalProperties
+extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/java/docs/servers/server1/Variables.md b/samples/client/petstore/java/docs/servers/server1/Variables.md new file mode 100644 index 00000000000..c87595a4706 --- /dev/null +++ b/samples/client/petstore/java/docs/servers/server1/Variables.md @@ -0,0 +1,355 @@ +# Variables +public class Variables
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Variables.Variables1Boxed](#variables1boxed)
sealed interface for validated payloads | +| record | [Variables.Variables1BoxedMap](#variables1boxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.Variables1](#variables1)
schema class | +| static class | [Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | +| static class | [Variables.VariablesMap](#variablesmap)
output class for Map payloads | +| sealed interface | [Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | +| record | [Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | +| static class | [Variables.Version](#version)
schema class | +| enum | [Variables.StringVersionEnums](#stringversionenums)
String enum | +| sealed interface | [Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.AdditionalProperties](#additionalproperties)
schema class | + +## Variables1Boxed +public sealed interface Variables1Boxed
+permits
+[Variables1BoxedMap](#variables1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Variables1BoxedMap +public record Variables1BoxedMap
+implements [Variables1Boxed](#variables1boxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Variables1BoxedMap([VariablesMap](#variablesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Variables1 +public static class Variables1
+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.servers.server1.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// Map validation +Variables.VariablesMap validatedPayload = + Variables.Variables1.validate( + new Variables.VariablesMapBuilder() + .version("v1") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("version", [Version.class](#version)))
)
| +| Set | required = Set.of(
    "version"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | validate([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1BoxedMap](#variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1Boxed](#variables1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## VariablesMap0Builder +public class VariablesMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMap0Builder(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 | + +## VariablesMapBuilder +public class VariablesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap0Builder](#variablesmap0builder) | version(String value) | +| [VariablesMap0Builder](#variablesmap0builder) | version([StringVersionEnums](#stringversionenums) value) | + +## VariablesMap +public static class VariablesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [VariablesMap](#variablesmap) | of([Map](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| String | version()
must be one of ["v1", "v2"] if omitted the server will use the default value of v2 | + +## VersionBoxed +public sealed interface VersionBoxed
+permits
+[VersionBoxedString](#versionboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## VersionBoxedString +public record VersionBoxedString
+implements [VersionBoxed](#versionboxed) + +record that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VersionBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## Version +public static class Version
+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.servers.server1.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// String validation +String validatedPayload = Variables.Version.validate( + "v1", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "v1",
    "v2"
)
| +| @Nullable Object | defaultValue = "v2" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringVersionEnums](#stringversionenums) arg, SchemaConfiguration configuration) | +| [VersionBoxedString](#versionboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [VersionBoxed](#versionboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +## StringVersionEnums +public enum StringVersionEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| V1 | value = "v1" | +| V2 | value = "v2" | + +## AdditionalPropertiesBoxed +public 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 +public record AdditionalPropertiesBoxedVoid
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Void data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Void | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedBoolean +public record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedNumber +public record AdditionalPropertiesBoxedNumber
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedString +public record AdditionalPropertiesBoxedString
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedList +public record AdditionalPropertiesBoxedList
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalPropertiesBoxedMap +public record AdditionalPropertiesBoxedMap
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +## AdditionalProperties +public static class AdditionalProperties
+extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java index b1ae3c42363..ab9a655db87 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java @@ -8,72 +8,39 @@ import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.AbstractMap; -import java.util.Map; import java.util.Objects; -import java.util.EnumMap; -public class RootServerInfo implements ServerProvider { - final private Servers servers; +public class RootServerInfo { + public static class RootServerInfo1 implements ServerProvider { + public final Server0 server0; + public final Server1 server1; + public final Server2 server2; - public RootServerInfo() { - this.servers = new Servers(); - } - - public RootServerInfo(Servers servers) { - this.servers = servers; - } - - public static class Servers { - private final EnumMap servers; - - public Servers() { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - new Server0() - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - new Server1() - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_2, - new Server2() - ) - ) - ); + public RootServerInfo1() { + server0 = new Server0(); + server1 = new Server1(); + server2 = new Server2(); } - public Servers( + public RootServerInfo1( @Nullable Server0 server0, @Nullable Server1 server1, @Nullable Server2 server2 ) { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - Objects.requireNonNullElseGet(server0, Server0::new) - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - Objects.requireNonNullElseGet(server1, Server1::new) - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_2, - Objects.requireNonNullElseGet(server2, Server2::new) - ) - ) - ); + this.server0 = Objects.requireNonNullElseGet(server0, Server0::new); + this.server1 = Objects.requireNonNullElseGet(server1, Server1::new); + this.server2 = Objects.requireNonNullElseGet(server2, Server2::new); } - public Server get(ServerIndex serverIndex) { - if (servers.containsKey(serverIndex)) { - return get(serverIndex); + public Server getServer(ServerIndex serverIndex) { + switch (serverIndex) { + case SERVER_0: + return server0; + case SERVER_1: + return server1; + default: + return server2; } - throw new UnsetPropertyException(serverIndex+" is unset"); } } @@ -82,11 +49,4 @@ public enum ServerIndex { SERVER_1, SERVER_2 } - - public Server getServer(@Nullable ServerIndex serverIndex) { - if (serverIndex == null) { - return servers.get(this.serverIndex); - } - return servers.get(serverIndex); - } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index ead24b98a98..ad1531813dc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -59,31 +59,31 @@ public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, } public static class ServerInfo { - protected final RootServerInfo rootServerInfo; - protected final FooGetServerInfo fooGetServerInfo; - protected final PetfindbystatusServerInfo petfindbystatusServerInfo; + protected final RootServerInfo.RootServerInfo1 rootServerInfo; + protected final FooGetServerInfo.FooGetServerInfo1 fooGetServerInfo; + protected final PetfindbystatusServerInfo.PetfindbystatusServerInfo1 petfindbystatusServerInfo; public ServerInfo() { - rootServerInfo = new RootServerInfo(); - fooGetServerInfo = new FooGetServerInfo(); - petfindbystatusServerInfo = new PetfindbystatusServerInfo(); + rootServerInfo = new RootServerInfo.RootServerInfo1(); + fooGetServerInfo = new FooGetServerInfo.FooGetServerInfo1(); + petfindbystatusServerInfo = new PetfindbystatusServerInfo.PetfindbystatusServerInfo1(); } public ServerInfo( - @Nullable RootServerInfo rootServerInfo, - @Nullable FooGetServerInfo fooGetServerInfo, - @Nullable PetfindbystatusServerInfo petfindbystatusServerInfo + RootServerInfo. @Nullable RootServerInfo1 rootServerInfo, + FooGetServerInfo. @Nullable FooGetServerInfo1 fooGetServerInfo, + PetfindbystatusServerInfo. @Nullable PetfindbystatusServerInfo1 petfindbystatusServerInfo ) { - this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo::new); - this.fooGetServerInfo = Objects.requireNonNullElseGet(fooGetServerInfo, FooGetServerInfo::new); - this.petfindbystatusServerInfo = Objects.requireNonNullElseGet(petfindbystatusServerInfo, PetfindbystatusServerInfo::new); + this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo.RootServerInfo1::new); + this.fooGetServerInfo = Objects.requireNonNullElseGet(fooGetServerInfo, FooGetServerInfo.FooGetServerInfo1::new); + this.petfindbystatusServerInfo = Objects.requireNonNullElseGet(petfindbystatusServerInfo, PetfindbystatusServerInfo.PetfindbystatusServerInfo1::new); } } public static class ServerIndexInfo { - protected final RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex; - protected final FooGetServerInfo. @Nullable ServerIndex fooGetServerInfoServerIndex; - protected final PetfindbystatusServerInfo. @Nullable ServerIndex petfindbystatusServerInfoServerIndex; + protected RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex; + protected FooGetServerInfo. @Nullable ServerIndex fooGetServerInfoServerIndex; + protected PetfindbystatusServerInfo. @Nullable ServerIndex petfindbystatusServerInfoServerIndex; public ServerIndexInfo() {} public ServerIndexInfo rootServerInfoServerIndex(RootServerInfo.ServerIndex serverIndex) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java index 8432e2512b4..62815538418 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java @@ -7,63 +7,33 @@ import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.AbstractMap; -import java.util.Map; import java.util.Objects; -import java.util.EnumMap; -public class FooGetServerInfo implements ServerProvider { - final private Servers servers; +public class FooGetServerInfo { + public static class FooGetServerInfo1 implements ServerProvider { + public final FooGetServer0 server0; + public final FooGetServer1 server1; - public FooGetServerInfo() { - this.servers = new Servers(); - } - - public FooGetServerInfo(Servers servers) { - this.servers = servers; - } - - public static class Servers { - private final EnumMap servers; - - public Servers() { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - new FooGetServer0() - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - new FooGetServer1() - ) - ) - ); + public FooGetServerInfo1() { + server0 = new FooGetServer0(); + server1 = new FooGetServer1(); } - public Servers( + public FooGetServerInfo1( @Nullable FooGetServer0 server0, @Nullable FooGetServer1 server1 ) { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - Objects.requireNonNullElseGet(server0, FooGetServer0::new) - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - Objects.requireNonNullElseGet(server1, FooGetServer1::new) - ) - ) - ); + this.server0 = Objects.requireNonNullElseGet(server0, FooGetServer0::new); + this.server1 = Objects.requireNonNullElseGet(server1, FooGetServer1::new); } - public Server get(ServerIndex serverIndex) { - if (servers.containsKey(serverIndex)) { - return get(serverIndex); + public Server getServer(ServerIndex serverIndex) { + switch (serverIndex) { + case SERVER_0: + return server0; + default: + return server1; } - throw new UnsetPropertyException(serverIndex+" is unset"); } } @@ -71,11 +41,4 @@ public enum ServerIndex { SERVER_0, SERVER_1 } - - public Server getServer(@Nullable ServerIndex serverIndex) { - if (serverIndex == null) { - return servers.get(this.serverIndex); - } - return servers.get(serverIndex); - } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java index a7a7f6e139d..e9fd4b2525d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java @@ -7,63 +7,33 @@ import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.AbstractMap; -import java.util.Map; import java.util.Objects; -import java.util.EnumMap; -public class PetfindbystatusServerInfo implements ServerProvider { - final private Servers servers; +public class PetfindbystatusServerInfo { + public static class PetfindbystatusServerInfo1 implements ServerProvider { + public final PetfindbystatusServer0 server0; + public final PetfindbystatusServer1 server1; - public PetfindbystatusServerInfo() { - this.servers = new Servers(); - } - - public PetfindbystatusServerInfo(Servers servers) { - this.servers = servers; - } - - public static class Servers { - private final EnumMap servers; - - public Servers() { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - new PetfindbystatusServer0() - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - new PetfindbystatusServer1() - ) - ) - ); + public PetfindbystatusServerInfo1() { + server0 = new PetfindbystatusServer0(); + server1 = new PetfindbystatusServer1(); } - public Servers( + public PetfindbystatusServerInfo1( @Nullable PetfindbystatusServer0 server0, @Nullable PetfindbystatusServer1 server1 ) { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - Objects.requireNonNullElseGet(server0, PetfindbystatusServer0::new) - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - Objects.requireNonNullElseGet(server1, PetfindbystatusServer1::new) - ) - ) - ); + this.server0 = Objects.requireNonNullElseGet(server0, PetfindbystatusServer0::new); + this.server1 = Objects.requireNonNullElseGet(server1, PetfindbystatusServer1::new); } - public Server get(ServerIndex serverIndex) { - if (servers.containsKey(serverIndex)) { - return get(serverIndex); + public Server getServer(ServerIndex serverIndex) { + switch (serverIndex) { + case SERVER_0: + return server0; + default: + return server1; } - throw new UnsetPropertyException(serverIndex+" is unset"); } } @@ -71,11 +41,4 @@ public enum ServerIndex { SERVER_0, SERVER_1 } - - public Server getServer(@Nullable ServerIndex serverIndex) { - if (serverIndex == null) { - return servers.get(this.serverIndex); - } - return servers.get(serverIndex); - } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java index 8c93a971aae..f736485870c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java @@ -1,8 +1,6 @@ package org.openapijsonschematools.client.servers; -import org.checkerframework.checker.nullness.qual.Nullable; - public interface ServerProvider { - Server getServer(@Nullable T serverIndex); + Server getServer(T serverIndex); } diff --git a/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java b/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java index bb87f3e1704..78a2bb2c398 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java +++ b/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java @@ -427,7 +427,7 @@ private void generatePathItem(List files, CodegenKey pathKey, CodegenPathI generateXs(files, jsonPath, CodegenConstants.JSON_PATH_LOCATION_TYPE.PATH, CodegenConstants.APIS, pathTemplateInfo, true); if (pathItem.servers != null) { - generateServers(files, pathItem.servers, jsonPath + "/servers"); + generateServers(files, pathItem.servers, jsonPath + "/servers", "../../"); } if (pathItem.parameters != null) { @@ -509,7 +509,7 @@ private void generatePathItem(List files, CodegenKey pathKey, CodegenPathI } if (operation.servers != null) { - generateServers(files, operation.servers, operationJsonPath + "/servers"); + generateServers(files, operation.servers, operationJsonPath + "/servers", "../../../"); } // paths.some_path.post.parameters.parameter_0.py @@ -1422,15 +1422,16 @@ Map buildSupportFileBundle( return bundle; } - private void generateServers(List files, CodegenList servers, String jsonPath) { + private void generateServers(List files, CodegenList servers, String jsonPath, String docRoot) { if (servers == null && servers.isEmpty()) { return; } Map serversTemplateData = new HashMap<>(); serversTemplateData.put("packageName", generator.packageName()); serversTemplateData.put("servers", servers); - serversTemplateData.put("headerSize", "#"); generateXs(files, jsonPath, CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVERS, CodegenConstants.SERVERS, serversTemplateData, true); + serversTemplateData.put("headerSize", "#"); + serversTemplateData.put("docRoot", docRoot); generateXDocs(files, jsonPath, CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVERS, CodegenConstants.SERVERS, serversTemplateData, true); int i = 0; @@ -1444,14 +1445,14 @@ private void generateServers(List files, CodegenList server if (generator.generateSeparateServerSchemas() && server.variables != null) { String variablesJsonPath = serverJsonPath + "/variables"; generateSchema(files, server.variables, variablesJsonPath); + generateSchemaDocumentation(files, server.variables, variablesJsonPath, docRoot + "../../", true); } // doc generation - if (server.rootServer) { - templateData.put("headerSize", "#"); - templateData.put("identifierPieces", Collections.unmodifiableList(new ArrayList<>())); - generateXDocs(files, serverJsonPath, CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVER, CodegenConstants.SERVERS, templateData, true); - } + templateData.put("headerSize", "#"); + templateData.put("identifierPieces", Collections.unmodifiableList(new ArrayList<>())); + templateData.put("docRoot", docRoot + "../"); + generateXDocs(files, serverJsonPath, CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVER, CodegenConstants.SERVERS, templateData, true); i++; } } @@ -1569,7 +1570,7 @@ public List generate() { // paths TreeMap paths = generator.fromPaths(openAPI.getPaths(), servers, security); generatePaths(files, paths, servers, security); - generateServers(files, servers, serversJsonPath); + generateServers(files, servers, serversJsonPath, ""); // apis generateApis(files, paths); diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java index 97cda0f9896..839df655b73 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java @@ -5246,13 +5246,15 @@ public CodegenList fromServers(List servers, String jsonP CodegenKey jsonPathPiece = getKey(String.valueOf(i), "servers", serverJsonPath); CodegenText description = getCodegenText(server.getDescription()); String subpackage = getSubpackage(serverJsonPath); + String pathFromDocRoot = getPathFromDocRoot(serverJsonPath); CodegenServer cs = new CodegenServer( removeTrailingSlash(server.getUrl()), // because trailing slash has no impact on server and path needs slash as first char description, fromServerVariables(server.getVariables(), serverJsonPath + "/variables"), jsonPathPiece, rootServer, - subpackage + subpackage, + pathFromDocRoot ); codegenServers.add(cs); } diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenServer.java b/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenServer.java index aeed2b45a99..4677a40363d 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenServer.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenServer.java @@ -2,7 +2,7 @@ import java.util.Objects; -public class CodegenServer { +public class CodegenServer implements PathFromDocRootProvider { public final String url; public final String defaultUrl; public final CodegenText description; @@ -10,8 +10,9 @@ public class CodegenServer { public final CodegenKey jsonPathPiece; public final boolean rootServer; public final String subpackage; // needed to define java package + public final String pathFromDocRoot; - public CodegenServer(String url, CodegenText description, CodegenSchema variables, CodegenKey jsonPathPiece, boolean rootServer, String subpackage) { + public CodegenServer(String url, CodegenText description, CodegenSchema variables, CodegenKey jsonPathPiece, boolean rootServer, String subpackage, String pathFromDocRoot) { this.url = url; this.description = description; this.variables = variables; @@ -27,6 +28,7 @@ public CodegenServer(String url, CodegenText description, CodegenSchema variable this.defaultUrl = defaultUrl; } this.subpackage = subpackage; + this.pathFromDocRoot = pathFromDocRoot; } @Override @@ -60,4 +62,9 @@ public String toString() { sb.append('}'); return sb.toString(); } + + @Override + public String pathFromDocRoot() { + return pathFromDocRoot; + } } diff --git a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs index 2db507e7f58..0a6248001f6 100644 --- a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs +++ b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs @@ -73,29 +73,29 @@ public class ApiConfiguration { public static class ServerInfo { {{#each allServers}} - protected final {{jsonPathPiece.pascalCase}} {{jsonPathPiece.camelCase}}; + protected final {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}; {{/each}} public ServerInfo() { {{#each allServers}} - {{jsonPathPiece.camelCase}} = new {{jsonPathPiece.pascalCase}}(); + {{jsonPathPiece.camelCase}} = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1(); {{/each}} } public ServerInfo( {{#each allServers}} - @Nullable {{jsonPathPiece.pascalCase}} {{jsonPathPiece.camelCase}}{{#unless @last}},{{/unless}} + {{jsonPathPiece.pascalCase}}. @Nullable {{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}{{#unless @last}},{{/unless}} {{/each}} ) { {{#each allServers}} - this.{{jsonPathPiece.camelCase}} = Objects.requireNonNullElseGet({{jsonPathPiece.camelCase}}, {{jsonPathPiece.pascalCase}}::new); + this.{{jsonPathPiece.camelCase}} = Objects.requireNonNullElseGet({{jsonPathPiece.camelCase}}, {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1::new); {{/each}} } } public static class ServerIndexInfo { {{#each allServers}} - protected final {{jsonPathPiece.pascalCase}}. @Nullable ServerIndex {{jsonPathPiece.camelCase}}ServerIndex; + protected {{jsonPathPiece.pascalCase}}. @Nullable ServerIndex {{jsonPathPiece.camelCase}}ServerIndex; {{/each}} public ServerIndexInfo() {} {{#each allServers}} diff --git a/src/main/resources/java/src/main/java/packagename/servers/ServerDoc.hbs b/src/main/resources/java/src/main/java/packagename/servers/ServerDoc.hbs index 17ade947f49..93d07d61293 100644 --- a/src/main/resources/java/src/main/java/packagename/servers/ServerDoc.hbs +++ b/src/main/resources/java/src/main/java/packagename/servers/ServerDoc.hbs @@ -27,7 +27,7 @@ A class that stores a server url | --------------------------- | | {{jsonPathPiece.pascalCase}}()
Creates a server{{#if variables}} using default values for variables{{/if}} | {{#if variables}} -| {{jsonPathPiece.pascalCase}}({{#with variables}}[{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}](#{{mapOutputJsonPathPiece.kebabCase}}) variables{{/with}})
Creates a server using input values for 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 @@ -35,12 +35,8 @@ A class that stores a server url | ----------------- | --------------------- | | String | url = "{{{url}}}" | {{#with variables}} -| [{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}](#{{mapOutputJsonPathPiece.kebabCase}}) | variables | +| [{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}) | variables | {{/with}} - {{#with variables}} - -{{> src/main/java/packagename/components/schemas/Schema_doc schema=this headerSize=(join headerSize "#" "") }} - {{/with}} {{/if}} {{#if rootServer}} diff --git a/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs b/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs index d1ce8e70641..90857b05cc5 100644 --- a/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs +++ b/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs @@ -12,60 +12,46 @@ import {{{packageName}}}.servers.Server; import {{{packageName}}}.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.AbstractMap; -import java.util.Map; import java.util.Objects; -import java.util.EnumMap; -public class {{servers.jsonPathPiece.pascalCase}} implements ServerProvider<{{servers.jsonPathPiece.pascalCase}}.ServerIndex> { - final private Servers servers; - - public {{servers.jsonPathPiece.pascalCase}}() { - this.servers = new Servers(); - } - - public {{servers.jsonPathPiece.pascalCase}}(Servers servers) { - this.servers = servers; - } - - public static class Servers { - private final EnumMap servers; +public class {{servers.jsonPathPiece.pascalCase}} { + public static class {{servers.jsonPathPiece.pascalCase}}1 implements ServerProvider { + {{#each servers}} + public final {{jsonPathPiece.pascalCase}} server{{@index}}; + {{/each}} - public Servers() { - servers = new EnumMap<>( - Map.ofEntries( + public {{servers.jsonPathPiece.pascalCase}}1() { {{#each servers}} - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_{{@index}}, - new {{jsonPathPiece.pascalCase}}() - ){{#unless @last}},{{/unless}} + server{{@index}} = new {{jsonPathPiece.pascalCase}}(); {{/each}} - ) - ); } - public Servers( + public {{servers.jsonPathPiece.pascalCase}}1( {{#each servers}} @Nullable {{jsonPathPiece.pascalCase}} server{{@index}}{{#unless @last}},{{/unless}} {{/each}} ) { - servers = new EnumMap<>( - Map.ofEntries( {{#each servers}} - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_{{@index}}, - Objects.requireNonNullElseGet(server{{@index}}, {{jsonPathPiece.pascalCase}}::new) - ){{#unless @last}},{{/unless}} + this.server{{@index}} = Objects.requireNonNullElseGet(server{{@index}}, {{jsonPathPiece.pascalCase}}::new); {{/each}} - ) - ); } - public Server get(ServerIndex serverIndex) { - if (servers.containsKey(serverIndex)) { - return get(serverIndex); + public Server getServer(ServerIndex serverIndex) { + {{#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}} } - throw new UnsetPropertyException(serverIndex+" is unset"); + {{/eq}} } } @@ -74,11 +60,4 @@ public class {{servers.jsonPathPiece.pascalCase}} implements ServerProvider<{{se SERVER_{{@index}}{{#unless @last}},{{/unless}} {{/each}} } - - public Server getServer(@Nullable ServerIndex serverIndex) { - if (serverIndex == null) { - return servers.get(this.serverIndex); - } - return servers.get(serverIndex); - } } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/servers/ServerInfoDoc.hbs b/src/main/resources/java/src/main/java/packagename/servers/ServerInfoDoc.hbs index 2b852859280..0a978304385 100644 --- a/src/main/resources/java/src/main/java/packagename/servers/ServerInfoDoc.hbs +++ b/src/main/resources/java/src/main/java/packagename/servers/ServerInfoDoc.hbs @@ -4,13 +4,38 @@ public class {{servers.jsonPathPiece.pascalCase}} A class that provides a server, and any needed server info classes +- a class that is a 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 | | 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()
Creates an instance using default server variable values | +| {{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}}# ServerIndex enum ServerIndex
diff --git a/src/main/resources/java/src/main/java/packagename/servers/ServerProvider.hbs b/src/main/resources/java/src/main/java/packagename/servers/ServerProvider.hbs index 7ae5f250dda..68a0a9c4af5 100644 --- a/src/main/resources/java/src/main/java/packagename/servers/ServerProvider.hbs +++ b/src/main/resources/java/src/main/java/packagename/servers/ServerProvider.hbs @@ -1,8 +1,6 @@ package {{{packageName}}}.servers; -import org.checkerframework.checker.nullness.qual.Nullable; - public interface ServerProvider { - Server getServer(@Nullable T serverIndex); + Server getServer(T serverIndex); } From d2b1e0bc0dd638115fa24877653101207db2befa Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 27 Mar 2024 17:07:35 -0700 Subject: [PATCH 03/53] Removes unused import --- .../java/org/openapijsonschematools/client/RootServerInfo.java | 1 - .../java/src/main/java/packagename/servers/ServerInfo.hbs | 1 - 2 files changed, 2 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java index ab9a655db87..7225f2a49b5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java @@ -1,6 +1,5 @@ package org.openapijsonschematools.client; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; diff --git a/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs b/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs index 90857b05cc5..c0725f07315 100644 --- a/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs +++ b/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs @@ -4,7 +4,6 @@ package {{{packageName}}}.{{servers.subpackage}}; package {{{packageName}}}; {{/if}} -import {{{packageName}}}.exceptions.UnsetPropertyException; {{#each servers}} import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; {{/each}} From edc76ad5b985be6e8cb789e39c835cfb7c1c91cc Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 28 Mar 2024 11:32:32 -0700 Subject: [PATCH 04/53] Adds missing docs newlines, removes EnumMap from security info --- .../fake/delete/FakeDeleteSecurityInfo.md | 4 +-- .../FakeDeleteSecurityRequirementObject0.md | 2 +- .../paths/fake/post/FakePostSecurityInfo.md | 4 +-- .../FakePostSecurityRequirementObject0.md | 2 +- .../FakeclassnametestPatchSecurityInfo.md | 4 +-- ...nametestPatchSecurityRequirementObject0.md | 2 +- .../FakemultiplesecuritiesGetSecurityInfo.md | 6 ++-- ...securitiesGetSecurityRequirementObject1.md | 2 +- ...securitiesGetSecurityRequirementObject2.md | 2 +- ...adimagewithrequiredfilePostSecurityInfo.md | 4 +-- ...uiredfilePostSecurityRequirementObject0.md | 2 +- .../paths/pet/post/PetPostSecurityInfo.md | 6 ++-- .../PetPostSecurityRequirementObject0.md | 2 +- .../PetPostSecurityRequirementObject1.md | 2 +- .../PetPostSecurityRequirementObject2.md | 2 +- .../docs/paths/pet/put/PetPutSecurityInfo.md | 5 ++-- .../PetPutSecurityRequirementObject0.md | 2 +- .../PetPutSecurityRequirementObject1.md | 2 +- .../get/PetfindbystatusGetSecurityInfo.md | 6 ++-- ...ndbystatusGetSecurityRequirementObject0.md | 2 +- ...ndbystatusGetSecurityRequirementObject1.md | 2 +- ...ndbystatusGetSecurityRequirementObject2.md | 2 +- .../get/PetfindbytagsGetSecurityInfo.md | 5 ++-- ...findbytagsGetSecurityRequirementObject0.md | 2 +- ...findbytagsGetSecurityRequirementObject1.md | 2 +- .../delete/PetpetidDeleteSecurityInfo.md | 5 ++-- ...etpetidDeleteSecurityRequirementObject0.md | 2 +- ...etpetidDeleteSecurityRequirementObject1.md | 2 +- .../petpetid/get/PetpetidGetSecurityInfo.md | 4 +-- .../PetpetidGetSecurityRequirementObject0.md | 2 +- .../petpetid/post/PetpetidPostSecurityInfo.md | 5 ++-- .../PetpetidPostSecurityRequirementObject0.md | 2 +- .../PetpetidPostSecurityRequirementObject1.md | 2 +- .../PetpetiduploadimagePostSecurityInfo.md | 4 +-- ...loadimagePostSecurityRequirementObject0.md | 2 +- .../get/StoreinventoryGetSecurityInfo.md | 4 +-- ...einventoryGetSecurityRequirementObject0.md | 2 +- .../configurations/ApiConfiguration.java | 28 +++++++++---------- .../fake/delete/FakeDeleteSecurityInfo.java | 12 ++------ .../paths/fake/post/FakePostSecurityInfo.java | 12 ++------ .../FakeclassnametestPatchSecurityInfo.java | 12 ++------ ...FakemultiplesecuritiesGetSecurityInfo.java | 25 +++++++++-------- ...imagewithrequiredfilePostSecurityInfo.java | 12 ++------ .../paths/foo/get/FooGetServerInfo.java | 1 - .../paths/pet/post/PetPostSecurityInfo.java | 25 +++++++++-------- .../paths/pet/put/PetPutSecurityInfo.java | 20 ++++++------- .../PetfindbystatusServerInfo.java | 1 - .../get/PetfindbystatusGetSecurityInfo.java | 25 +++++++++-------- .../get/PetfindbytagsGetSecurityInfo.java | 20 ++++++------- .../delete/PetpetidDeleteSecurityInfo.java | 20 ++++++------- .../petpetid/get/PetpetidGetSecurityInfo.java | 12 ++------ .../post/PetpetidPostSecurityInfo.java | 20 ++++++------- .../PetpetiduploadimagePostSecurityInfo.java | 12 ++------ .../get/StoreinventoryGetSecurityInfo.java | 12 ++------ .../configurations/ApiConfiguration.hbs | 2 +- .../SecurityInfo.hbs | 28 +++++++++++++------ .../SecurityInfoDoc.hbs | 6 ++-- .../SecurityRequirementObjectNDoc.hbs | 2 +- 58 files changed, 203 insertions(+), 216 deletions(-) diff --git a/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md b/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md index 6480bf870bd..7c008b766c7 100644 --- a/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md @@ -4,7 +4,7 @@ FakeDeleteSecurityInfo.java public class FakeDeleteSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakeDeleteSecurityRequirementObject0()](../../../paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md)
)); | +| [FakeDeleteSecurityRequirementObject0](../../../paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md index af486306c7b..ce14db9f6b9 100644 --- a/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [BearerTest.class](../../../../components/securityschemes/BearerTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [BearerTest.class](../../../../components/securityschemes/BearerTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md b/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md index 95b409d5023..0166862a304 100644 --- a/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md @@ -4,7 +4,7 @@ FakePostSecurityInfo.java public class FakePostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakePostSecurityRequirementObject0()](../../../paths/fake/post/security/FakePostSecurityRequirementObject0.md)
)); | +| [FakePostSecurityRequirementObject0](../../../paths/fake/post/security/FakePostSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md index ffe185f4a8a..db0df44256c 100644 --- a/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md index 2137564e12f..3e252e7cdd7 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md @@ -4,7 +4,7 @@ FakeclassnametestPatchSecurityInfo.java public class FakeclassnametestPatchSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakeclassnametestPatchSecurityRequirementObject0()](../../../paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md)
)); | +| [FakeclassnametestPatchSecurityRequirementObject0](../../../paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md index 74c9bd15fba..0651521d4b3 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKeyQuery.class](../../../../components/securityschemes/ApiKeyQuery.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKeyQuery.class](../../../../components/securityschemes/ApiKeyQuery.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md index 202b98244be..dfdd24f765d 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md @@ -4,7 +4,7 @@ FakemultiplesecuritiesGetSecurityInfo.java public class FakemultiplesecuritiesGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,9 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakemultiplesecuritiesGetSecurityRequirementObject0()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [FakemultiplesecuritiesGetSecurityRequirementObject1()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new [FakemultiplesecuritiesGetSecurityRequirementObject2()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md)
)); | +| [FakemultiplesecuritiesGetSecurityRequirementObject0](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md) | security0 | +| [FakemultiplesecuritiesGetSecurityRequirementObject1](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md) | security1 | +| [FakemultiplesecuritiesGetSecurityRequirementObject2](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md) | security2 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md index b642d36e8d5..2fc62ae0497 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),        List.of()    ),    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),
        List.of()
    ),
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md index a59e0627a45..b073e315c8b 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md index 47cbe85d783..7d31590a6a5 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md @@ -4,7 +4,7 @@ FakepetiduploadimagewithrequiredfilePostSecurityInfo.java public class FakepetiduploadimagewithrequiredfilePostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0()](../../../paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md)
)); | +| [FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0](../../../paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md index e2e1adb6ae8..3e58c101d48 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md b/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md index bfcbdaed682..233fdd10e78 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md @@ -4,7 +4,7 @@ PetPostSecurityInfo.java public class PetPostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,9 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetPostSecurityRequirementObject0()](../../../paths/pet/post/security/PetPostSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetPostSecurityRequirementObject1()](../../../paths/pet/post/security/PetPostSecurityRequirementObject1.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new [PetPostSecurityRequirementObject2()](../../../paths/pet/post/security/PetPostSecurityRequirementObject2.md)
)); | +| [PetPostSecurityRequirementObject0](../../../paths/pet/post/security/PetPostSecurityRequirementObject0.md) | security0 | +| [PetPostSecurityRequirementObject1](../../../paths/pet/post/security/PetPostSecurityRequirementObject1.md) | security1 | +| [PetPostSecurityRequirementObject2](../../../paths/pet/post/security/PetPostSecurityRequirementObject2.md) | security2 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md index 34870b66eb6..dc904ae9529 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md index 1cb682b7915..4ffc2e46b31 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md index ccb5edf9c7a..88db581a2d6 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md +++ b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md b/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md index 1f13f8174c2..1136055dad2 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md @@ -4,7 +4,7 @@ PetPutSecurityInfo.java public class PetPutSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,8 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetPutSecurityRequirementObject0()](../../../paths/pet/put/security/PetPutSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetPutSecurityRequirementObject1()](../../../paths/pet/put/security/PetPutSecurityRequirementObject1.md)
)); | +| [PetPutSecurityRequirementObject0](../../../paths/pet/put/security/PetPutSecurityRequirementObject0.md) | security0 | +| [PetPutSecurityRequirementObject1](../../../paths/pet/put/security/PetPutSecurityRequirementObject1.md) | security1 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md index 23269a709b1..a0bb52235ba 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md index d57a44d83e2..9dd305982f5 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md index c3cc586c35b..a0bc58eb967 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md @@ -4,7 +4,7 @@ PetfindbystatusGetSecurityInfo.java public class PetfindbystatusGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,9 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetfindbystatusGetSecurityRequirementObject0()](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetfindbystatusGetSecurityRequirementObject1()](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new [PetfindbystatusGetSecurityRequirementObject2()](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md)
)); | +| [PetfindbystatusGetSecurityRequirementObject0](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md) | security0 | +| [PetfindbystatusGetSecurityRequirementObject1](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md) | security1 | +| [PetfindbystatusGetSecurityRequirementObject2](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md) | security2 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md index a656f810b95..608eb248028 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md index d505ac57b5b..6749160f760 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md index 38f9d7030cc..7f0527ce9f7 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md index 9d0ab412696..ea6339e8f26 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md @@ -4,7 +4,7 @@ PetfindbytagsGetSecurityInfo.java public class PetfindbytagsGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,8 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetfindbytagsGetSecurityRequirementObject0()](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetfindbytagsGetSecurityRequirementObject1()](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md)
)); | +| [PetfindbytagsGetSecurityRequirementObject0](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md) | security0 | +| [PetfindbytagsGetSecurityRequirementObject1](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md) | security1 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md index 8cec8cbafe3..256a672a40f 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md index 003dc335aa8..39a130b834f 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md index 78dca588af1..0a71b0d01f1 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md @@ -4,7 +4,7 @@ PetpetidDeleteSecurityInfo.java public class PetpetidDeleteSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,8 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetidDeleteSecurityRequirementObject0()](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetpetidDeleteSecurityRequirementObject1()](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md)
)); | +| [PetpetidDeleteSecurityRequirementObject0](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md) | security0 | +| [PetpetidDeleteSecurityRequirementObject1](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md) | security1 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md index 1bfbaa536d1..f80b6f15b40 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md index 70dcf48c967..8877bdea9a3 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md index f6403d11468..c6615ea3fa9 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md @@ -4,7 +4,7 @@ PetpetidGetSecurityInfo.java public class PetpetidGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetidGetSecurityRequirementObject0()](../../../paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md)
)); | +| [PetpetidGetSecurityRequirementObject0](../../../paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md index 6a56d6d61e7..77bfdbe2448 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md index 18f25e685bf..915b9ce6f7c 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md @@ -4,7 +4,7 @@ PetpetidPostSecurityInfo.java public class PetpetidPostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,8 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetidPostSecurityRequirementObject0()](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetpetidPostSecurityRequirementObject1()](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md)
)); | +| [PetpetidPostSecurityRequirementObject0](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md) | security0 | +| [PetpetidPostSecurityRequirementObject1](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md) | security1 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md index cd3e742dcd2..0e8d3540345 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md index ad6ba36e84e..fb9621d4c1e 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md index 5c45e3b65b1..a6c84397204 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md @@ -4,7 +4,7 @@ PetpetiduploadimagePostSecurityInfo.java public class PetpetiduploadimagePostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetiduploadimagePostSecurityRequirementObject0()](../../../paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md)
)); | +| [PetpetiduploadimagePostSecurityRequirementObject0](../../../paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md index e31f5956998..adb3502a449 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md index eca03625ce0..2f5f07f0f26 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md @@ -4,7 +4,7 @@ StoreinventoryGetSecurityInfo.java public class StoreinventoryGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [StoreinventoryGetSecurityRequirementObject0()](../../../paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md)
)); | +| [StoreinventoryGetSecurityRequirementObject0](../../../paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md index ae36a11c931..d979d8cb08c 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index ad1531813dc..bbaa2bf3288 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -173,20 +173,20 @@ public SecurityInfo() { } public static class SecurityIndexInfo { - protected FakeDeleteSecurityInfo. @Nullable SecurityIndex fakeDeleteSecurityInfoSecurityIndex; - protected FakePostSecurityInfo. @Nullable SecurityIndex fakePostSecurityInfoSecurityIndex; - protected FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex; - protected FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; - protected FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex; - protected PetPostSecurityInfo. @Nullable SecurityIndex petPostSecurityInfoSecurityIndex; - protected PetPutSecurityInfo. @Nullable SecurityIndex petPutSecurityInfoSecurityIndex; - protected PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex; - protected PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex; - protected PetpetidDeleteSecurityInfo. @Nullable SecurityIndex petpetidDeleteSecurityInfoSecurityIndex; - protected PetpetidGetSecurityInfo. @Nullable SecurityIndex petpetidGetSecurityInfoSecurityIndex; - protected PetpetidPostSecurityInfo. @Nullable SecurityIndex petpetidPostSecurityInfoSecurityIndex; - protected PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex; - protected StoreinventoryGetSecurityInfo. @Nullable SecurityIndex storeinventoryGetSecurityInfoSecurityIndex; + public FakeDeleteSecurityInfo. @Nullable SecurityIndex fakeDeleteSecurityInfoSecurityIndex; + public FakePostSecurityInfo. @Nullable SecurityIndex fakePostSecurityInfoSecurityIndex; + public FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex; + public FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; + public FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex; + public PetPostSecurityInfo. @Nullable SecurityIndex petPostSecurityInfoSecurityIndex; + public PetPutSecurityInfo. @Nullable SecurityIndex petPutSecurityInfoSecurityIndex; + public PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex; + public PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex; + public PetpetidDeleteSecurityInfo. @Nullable SecurityIndex petpetidDeleteSecurityInfoSecurityIndex; + public PetpetidGetSecurityInfo. @Nullable SecurityIndex petpetidGetSecurityInfoSecurityIndex; + public PetpetidPostSecurityInfo. @Nullable SecurityIndex petpetidPostSecurityInfoSecurityIndex; + public PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex; + public StoreinventoryGetSecurityInfo. @Nullable SecurityIndex storeinventoryGetSecurityInfoSecurityIndex; public SecurityIndexInfo() {} diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java index 143eff49895..fac721814e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java @@ -4,22 +4,16 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class FakeDeleteSecurityInfo { public static class FakeDeleteSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final FakeDeleteSecurityRequirementObject0 security0; public FakeDeleteSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakeDeleteSecurityRequirementObject0()) - )); + security0 = new FakeDeleteSecurityRequirementObject0(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java index feaf2d3706d..133430b981f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java @@ -4,22 +4,16 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class FakePostSecurityInfo { public static class FakePostSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final FakePostSecurityRequirementObject0 security0; public FakePostSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakePostSecurityRequirementObject0()) - )); + security0 = new FakePostSecurityRequirementObject0(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java index 3d2274ab9ac..6a1b77725cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java @@ -4,22 +4,16 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class FakeclassnametestPatchSecurityInfo { public static class FakeclassnametestPatchSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final FakeclassnametestPatchSecurityRequirementObject0 security0; public FakeclassnametestPatchSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakeclassnametestPatchSecurityRequirementObject0()) - )); + security0 = new FakeclassnametestPatchSecurityRequirementObject0(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java index 0a641952eca..b65cac7277f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java @@ -6,24 +6,27 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class FakemultiplesecuritiesGetSecurityInfo { public static class FakemultiplesecuritiesGetSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final FakemultiplesecuritiesGetSecurityRequirementObject0 security0; + public final FakemultiplesecuritiesGetSecurityRequirementObject1 security1; + public final FakemultiplesecuritiesGetSecurityRequirementObject2 security2; public FakemultiplesecuritiesGetSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakemultiplesecuritiesGetSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new FakemultiplesecuritiesGetSecurityRequirementObject1()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new FakemultiplesecuritiesGetSecurityRequirementObject2()) - )); + security0 = new FakemultiplesecuritiesGetSecurityRequirementObject0(); + security1 = new FakemultiplesecuritiesGetSecurityRequirementObject1(); + security2 = new FakemultiplesecuritiesGetSecurityRequirementObject2(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + case SECURITY_1: + return security1; + default: + return security2; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java index c06bb045cf8..faff5fb5c49 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java @@ -4,22 +4,16 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class FakepetiduploadimagewithrequiredfilePostSecurityInfo { public static class FakepetiduploadimagewithrequiredfilePostSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0 security0; public FakepetiduploadimagewithrequiredfilePostSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0()) - )); + security0 = new FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java index 62815538418..2e8508f4e73 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java @@ -1,6 +1,5 @@ package org.openapijsonschematools.client.paths.foo.get; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer0; import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer1; import org.openapijsonschematools.client.servers.Server; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java index 33c0fb012db..7ed60a79050 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java @@ -6,24 +6,27 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetPostSecurityInfo { public static class PetPostSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetPostSecurityRequirementObject0 security0; + public final PetPostSecurityRequirementObject1 security1; + public final PetPostSecurityRequirementObject2 security2; public PetPostSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetPostSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetPostSecurityRequirementObject1()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new PetPostSecurityRequirementObject2()) - )); + security0 = new PetPostSecurityRequirementObject0(); + security1 = new PetPostSecurityRequirementObject1(); + security2 = new PetPostSecurityRequirementObject2(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + case SECURITY_1: + return security1; + default: + return security2; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java index a8276f457ba..887b6d00430 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java @@ -5,23 +5,23 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetPutSecurityInfo { public static class PetPutSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetPutSecurityRequirementObject0 security0; + public final PetPutSecurityRequirementObject1 security1; public PetPutSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetPutSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetPutSecurityRequirementObject1()) - )); + security0 = new PetPutSecurityRequirementObject0(); + security1 = new PetPutSecurityRequirementObject1(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java index e9fd4b2525d..aa7a8ed4131 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java @@ -1,6 +1,5 @@ package org.openapijsonschematools.client.paths.petfindbystatus; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer0; import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer1; import org.openapijsonschematools.client.servers.Server; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java index feb7a695ede..57c15676e7c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java @@ -6,24 +6,27 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetfindbystatusGetSecurityInfo { public static class PetfindbystatusGetSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetfindbystatusGetSecurityRequirementObject0 security0; + public final PetfindbystatusGetSecurityRequirementObject1 security1; + public final PetfindbystatusGetSecurityRequirementObject2 security2; public PetfindbystatusGetSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetfindbystatusGetSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetfindbystatusGetSecurityRequirementObject1()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new PetfindbystatusGetSecurityRequirementObject2()) - )); + security0 = new PetfindbystatusGetSecurityRequirementObject0(); + security1 = new PetfindbystatusGetSecurityRequirementObject1(); + security2 = new PetfindbystatusGetSecurityRequirementObject2(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + case SECURITY_1: + return security1; + default: + return security2; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java index 7005499fb3e..dd970477835 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java @@ -5,23 +5,23 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetfindbytagsGetSecurityInfo { public static class PetfindbytagsGetSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetfindbytagsGetSecurityRequirementObject0 security0; + public final PetfindbytagsGetSecurityRequirementObject1 security1; public PetfindbytagsGetSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetfindbytagsGetSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetfindbytagsGetSecurityRequirementObject1()) - )); + security0 = new PetfindbytagsGetSecurityRequirementObject0(); + security1 = new PetfindbytagsGetSecurityRequirementObject1(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java index c71ee0107bc..f9e76a86ccf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java @@ -5,23 +5,23 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetpetidDeleteSecurityInfo { public static class PetpetidDeleteSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetpetidDeleteSecurityRequirementObject0 security0; + public final PetpetidDeleteSecurityRequirementObject1 security1; public PetpetidDeleteSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetidDeleteSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetpetidDeleteSecurityRequirementObject1()) - )); + security0 = new PetpetidDeleteSecurityRequirementObject0(); + security1 = new PetpetidDeleteSecurityRequirementObject1(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java index ea5c2dfa9c2..e9aca76897b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java @@ -4,22 +4,16 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetpetidGetSecurityInfo { public static class PetpetidGetSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetpetidGetSecurityRequirementObject0 security0; public PetpetidGetSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetidGetSecurityRequirementObject0()) - )); + security0 = new PetpetidGetSecurityRequirementObject0(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java index 192ccc51c6c..190c7470b0c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java @@ -5,23 +5,23 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetpetidPostSecurityInfo { public static class PetpetidPostSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetpetidPostSecurityRequirementObject0 security0; + public final PetpetidPostSecurityRequirementObject1 security1; public PetpetidPostSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetidPostSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetpetidPostSecurityRequirementObject1()) - )); + security0 = new PetpetidPostSecurityRequirementObject0(); + security1 = new PetpetidPostSecurityRequirementObject1(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java index 1ec53a24fb0..36f09e479dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java @@ -4,22 +4,16 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetpetiduploadimagePostSecurityInfo { public static class PetpetiduploadimagePostSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetpetiduploadimagePostSecurityRequirementObject0 security0; public PetpetiduploadimagePostSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetiduploadimagePostSecurityRequirementObject0()) - )); + security0 = new PetpetiduploadimagePostSecurityRequirementObject0(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java index c263a4e51f8..b79d86a485e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java @@ -4,22 +4,16 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class StoreinventoryGetSecurityInfo { public static class StoreinventoryGetSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final StoreinventoryGetSecurityRequirementObject0 security0; public StoreinventoryGetSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new StoreinventoryGetSecurityRequirementObject0()) - )); + security0 = new StoreinventoryGetSecurityRequirementObject0(); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs index 0a6248001f6..c9526e4611e 100644 --- a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs +++ b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs @@ -136,7 +136,7 @@ public class ApiConfiguration { public static class SecurityIndexInfo { {{#each allSecurity}} - protected {{jsonPathPiece.pascalCase}}. @Nullable SecurityIndex {{jsonPathPiece.camelCase}}SecurityIndex; + public {{jsonPathPiece.pascalCase}}. @Nullable SecurityIndex {{jsonPathPiece.camelCase}}SecurityIndex; {{/each}} public SecurityIndexInfo() {} diff --git a/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfo.hbs b/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfo.hbs index f1c02226030..1b4ed1eb333 100644 --- a/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfo.hbs +++ b/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfo.hbs @@ -10,24 +10,34 @@ import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; import {{{packageName}}}.securityrequirementobjects.SecurityRequirementObject; import {{{packageName}}}.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class {{security.jsonPathPiece.pascalCase}} { public static class {{security.jsonPathPiece.pascalCase}}1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; +{{#each security}} + public final {{jsonPathPiece.pascalCase}} security{{@index}}; +{{/each}} public {{security.jsonPathPiece.pascalCase}}1() { - this.securities = new EnumMap<>(Map.ofEntries( {{#each security}} - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_{{@index}}, new {{jsonPathPiece.pascalCase}}()){{#unless @last}},{{/unless}} + security{{@index}} = new {{jsonPathPiece.pascalCase}}(); {{/each}} - )); } public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(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}} } } diff --git a/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfoDoc.hbs b/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfoDoc.hbs index e00203f3313..550d8f53493 100644 --- a/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfoDoc.hbs +++ b/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfoDoc.hbs @@ -4,7 +4,7 @@ public class {{security.jsonPathPiece.pascalCase}} A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values {{headerSize}}# Nested Class Summary @@ -24,7 +24,9 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> {{headerSize}}## Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
{{#each security}}    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_{{@index}}, new [{{jsonPathPiece.pascalCase}}()]({{docRoot}}{{pathFromDocRoot}}.md){{#unless @last}},{{/unless}}
{{/each}})); | +{{#each security}} +| [{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md) | security{{@index}} | +{{/each}} {{headerSize}}## Method Summary | Modifier and Type | Method and Description | diff --git a/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs b/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs index d708426f605..d87ec25d5dd 100644 --- a/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs +++ b/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs @@ -16,4 +16,4 @@ extends SecurityRequirementObject {{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}}) | +| 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}}) | From 5877bdf0df3e57047db4e204d4d8361f00dca4c1 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 28 Mar 2024 11:59:00 -0700 Subject: [PATCH 05/53] Adds Override annotations, removes nullability from enum input for security fetching --- .../org/openapijsonschematools/client/RootServerInfo.java | 1 + .../client/paths/fake/delete/FakeDeleteSecurityInfo.java | 1 + .../client/paths/fake/post/FakePostSecurityInfo.java | 1 + .../patch/FakeclassnametestPatchSecurityInfo.java | 1 + .../get/FakemultiplesecuritiesGetSecurityInfo.java | 1 + ...FakepetiduploadimagewithrequiredfilePostSecurityInfo.java | 1 + .../client/paths/foo/get/FooGetServerInfo.java | 1 + .../client/paths/pet/post/PetPostSecurityInfo.java | 1 + .../client/paths/pet/put/PetPutSecurityInfo.java | 1 + .../paths/petfindbystatus/PetfindbystatusServerInfo.java | 1 + .../petfindbystatus/get/PetfindbystatusGetSecurityInfo.java | 1 + .../petfindbytags/get/PetfindbytagsGetSecurityInfo.java | 1 + .../paths/petpetid/delete/PetpetidDeleteSecurityInfo.java | 1 + .../client/paths/petpetid/get/PetpetidGetSecurityInfo.java | 1 + .../client/paths/petpetid/post/PetpetidPostSecurityInfo.java | 1 + .../post/PetpetiduploadimagePostSecurityInfo.java | 1 + .../storeinventory/get/StoreinventoryGetSecurityInfo.java | 1 + .../SecurityRequirementObjectProvider.java | 5 +---- .../packagename/securityrequirementobjects/SecurityInfo.hbs | 1 + .../SecurityRequirementObjectProvider.hbs | 5 +---- .../java/src/main/java/packagename/servers/ServerInfo.hbs | 1 + 21 files changed, 21 insertions(+), 8 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java index 7225f2a49b5..b9ad3b615a8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java @@ -31,6 +31,7 @@ public RootServerInfo1( this.server2 = Objects.requireNonNullElseGet(server2, Server2::new); } + @Override public Server getServer(ServerIndex serverIndex) { switch (serverIndex) { case SERVER_0: diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java index fac721814e5..1d8502b4091 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java @@ -12,6 +12,7 @@ public FakeDeleteSecurityInfo1() { security0 = new FakeDeleteSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { return security0; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java index 133430b981f..013b581a6d4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java @@ -12,6 +12,7 @@ public FakePostSecurityInfo1() { security0 = new FakePostSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { return security0; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java index 6a1b77725cf..a4a739aad43 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java @@ -12,6 +12,7 @@ public FakeclassnametestPatchSecurityInfo1() { security0 = new FakeclassnametestPatchSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { return security0; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java index b65cac7277f..ed1fd5216aa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java @@ -18,6 +18,7 @@ public FakemultiplesecuritiesGetSecurityInfo1() { security2 = new FakemultiplesecuritiesGetSecurityRequirementObject2(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { switch (securityIndex) { case SECURITY_0: diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java index faff5fb5c49..8dab76a488c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java @@ -12,6 +12,7 @@ public FakepetiduploadimagewithrequiredfilePostSecurityInfo1() { security0 = new FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { return security0; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java index 2e8508f4e73..2a4ba33c38a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java @@ -26,6 +26,7 @@ public FooGetServerInfo1( this.server1 = Objects.requireNonNullElseGet(server1, FooGetServer1::new); } + @Override public Server getServer(ServerIndex serverIndex) { switch (serverIndex) { case SERVER_0: diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java index 7ed60a79050..91df6b3f3e8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java @@ -18,6 +18,7 @@ public PetPostSecurityInfo1() { security2 = new PetPostSecurityRequirementObject2(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { switch (securityIndex) { case SECURITY_0: diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java index 887b6d00430..35d27e66846 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java @@ -15,6 +15,7 @@ public PetPutSecurityInfo1() { security1 = new PetPutSecurityRequirementObject1(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { switch (securityIndex) { case SECURITY_0: diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java index aa7a8ed4131..03839fc4b75 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java @@ -26,6 +26,7 @@ public PetfindbystatusServerInfo1( this.server1 = Objects.requireNonNullElseGet(server1, PetfindbystatusServer1::new); } + @Override public Server getServer(ServerIndex serverIndex) { switch (serverIndex) { case SERVER_0: diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java index 57c15676e7c..7e2dd18d844 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java @@ -18,6 +18,7 @@ public PetfindbystatusGetSecurityInfo1() { security2 = new PetfindbystatusGetSecurityRequirementObject2(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { switch (securityIndex) { case SECURITY_0: diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java index dd970477835..4c4856f98eb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java @@ -15,6 +15,7 @@ public PetfindbytagsGetSecurityInfo1() { security1 = new PetfindbytagsGetSecurityRequirementObject1(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { switch (securityIndex) { case SECURITY_0: diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java index f9e76a86ccf..941f3f23abf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java @@ -15,6 +15,7 @@ public PetpetidDeleteSecurityInfo1() { security1 = new PetpetidDeleteSecurityRequirementObject1(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { switch (securityIndex) { case SECURITY_0: diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java index e9aca76897b..4d21d88f82e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java @@ -12,6 +12,7 @@ public PetpetidGetSecurityInfo1() { security0 = new PetpetidGetSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { return security0; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java index 190c7470b0c..3763c38088a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java @@ -15,6 +15,7 @@ public PetpetidPostSecurityInfo1() { security1 = new PetpetidPostSecurityRequirementObject1(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { switch (securityIndex) { case SECURITY_0: diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java index 36f09e479dd..0418c7b90c0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java @@ -12,6 +12,7 @@ public PetpetiduploadimagePostSecurityInfo1() { security0 = new PetpetiduploadimagePostSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { return security0; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java index b79d86a485e..5c661cfd67c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java @@ -12,6 +12,7 @@ public StoreinventoryGetSecurityInfo1() { security0 = new StoreinventoryGetSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { return security0; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java index 6b0db70c264..9cf6147b8f1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java @@ -1,9 +1,6 @@ package org.openapijsonschematools.client.securityrequirementobjects; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.checkerframework.checker.nullness.qual.Nullable; - public interface SecurityRequirementObjectProvider { - SecurityRequirementObject getSecurityRequirementObject(@Nullable T securityIndex) throws UnsetPropertyException; + SecurityRequirementObject getSecurityRequirementObject(T securityIndex); } diff --git a/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfo.hbs b/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfo.hbs index 1b4ed1eb333..899e05dee32 100644 --- a/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfo.hbs +++ b/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityInfo.hbs @@ -22,6 +22,7 @@ public class {{security.jsonPathPiece.pascalCase}} { {{/each}} } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { {{#eq security.size 1}} return security0; diff --git a/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs b/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs index b5d13c1018d..57c32dfbf6a 100644 --- a/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs +++ b/src/main/resources/java/src/main/java/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs @@ -1,9 +1,6 @@ package {{{packageName}}}.securityrequirementobjects; -import {{{packageName}}}.exceptions.UnsetPropertyException; -import org.checkerframework.checker.nullness.qual.Nullable; - public interface SecurityRequirementObjectProvider { - SecurityRequirementObject getSecurityRequirementObject(@Nullable T securityIndex) throws UnsetPropertyException; + SecurityRequirementObject getSecurityRequirementObject(T securityIndex); } diff --git a/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs b/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs index c0725f07315..9da445d272d 100644 --- a/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs +++ b/src/main/resources/java/src/main/java/packagename/servers/ServerInfo.hbs @@ -35,6 +35,7 @@ public class {{servers.jsonPathPiece.pascalCase}} { {{/each}} } + @Override public Server getServer(ServerIndex serverIndex) { {{#eq servers.size 1}} return server0; From 3cd545a24151a37c300e96aca8b1946f0d8d360e Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 31 Mar 2024 11:43:03 -0700 Subject: [PATCH 06/53] Adds operation code sample imports --- .../java/docs/paths/anotherfakedummy/Patch.md | 18 +++++- .../docs/paths/commonparamsubdir/Delete.md | 19 ++++++- .../java/docs/paths/commonparamsubdir/Get.md | 19 ++++++- .../java/docs/paths/commonparamsubdir/Post.md | 19 ++++++- .../petstore/java/docs/paths/fake/Delete.md | 22 ++++++- .../petstore/java/docs/paths/fake/Get.md | 20 ++++++- .../petstore/java/docs/paths/fake/Patch.md | 18 +++++- .../petstore/java/docs/paths/fake/Post.md | 21 ++++++- .../Get.md | 18 +++++- .../docs/paths/fakebodywithfileschema/Put.md | 18 +++++- .../docs/paths/fakebodywithqueryparams/Put.md | 19 ++++++- .../docs/paths/fakecasesensitiveparams/Put.md | 18 +++++- .../docs/paths/fakeclassnametest/Patch.md | 21 ++++++- .../docs/paths/fakedeletecoffeeid/Delete.md | 18 +++++- .../java/docs/paths/fakehealth/Get.md | 17 +++++- .../fakeinlineadditionalproperties/Post.md | 18 +++++- .../docs/paths/fakeinlinecomposition/Post.md | 19 ++++++- .../java/docs/paths/fakejsonformdata/Get.md | 18 +++++- .../java/docs/paths/fakejsonpatch/Patch.md | 18 +++++- .../docs/paths/fakejsonwithcharset/Post.md | 18 +++++- .../Post.md | 18 +++++- .../paths/fakemultipleresponsebodies/Get.md | 17 +++++- .../docs/paths/fakemultiplesecurities/Get.md | 24 +++++++- .../java/docs/paths/fakeobjinquery/Get.md | 18 +++++- .../Post.md | 22 ++++++- .../java/docs/paths/fakepemcontenttype/Get.md | 18 +++++- .../Post.md | 22 ++++++- .../fakequeryparamwithjsoncontenttype/Get.md | 18 +++++- .../java/docs/paths/fakeredirection/Get.md | 17 +++++- .../java/docs/paths/fakerefobjinquery/Get.md | 18 +++++- .../docs/paths/fakerefsarraymodel/Post.md | 18 +++++- .../docs/paths/fakerefsarrayofenums/Post.md | 18 +++++- .../java/docs/paths/fakerefsboolean/Post.md | 18 +++++- .../Post.md | 18 +++++- .../java/docs/paths/fakerefsenum/Post.md | 18 +++++- .../java/docs/paths/fakerefsmammal/Post.md | 18 +++++- .../java/docs/paths/fakerefsnumber/Post.md | 18 +++++- .../fakerefsobjectmodelwithrefprops/Post.md | 18 +++++- .../java/docs/paths/fakerefsstring/Post.md | 18 +++++- .../paths/fakeresponsewithoutschema/Get.md | 17 +++++- .../docs/paths/faketestqueryparamters/Put.md | 18 +++++- .../docs/paths/fakeuploaddownloadfile/Post.md | 18 +++++- .../java/docs/paths/fakeuploadfile/Post.md | 18 +++++- .../java/docs/paths/fakeuploadfiles/Post.md | 18 +++++- .../docs/paths/fakewildcardresponses/Get.md | 17 +++++- .../petstore/java/docs/paths/foo/Get.md | 15 ++++- .../petstore/java/docs/paths/pet/Post.md | 25 +++++++- .../petstore/java/docs/paths/pet/Put.md | 23 +++++++- .../java/docs/paths/petfindbystatus/Get.md | 23 +++++++- .../java/docs/paths/petfindbytags/Get.md | 23 +++++++- .../java/docs/paths/petpetid/Delete.md | 24 +++++++- .../petstore/java/docs/paths/petpetid/Get.md | 21 ++++++- .../petstore/java/docs/paths/petpetid/Post.md | 24 +++++++- .../docs/paths/petpetiduploadimage/Post.md | 22 ++++++- .../petstore/java/docs/paths/solidus/Get.md | 17 +++++- .../java/docs/paths/storeinventory/Get.md | 20 ++++++- .../java/docs/paths/storeorder/Post.md | 18 +++++- .../docs/paths/storeorderorderid/Delete.md | 18 +++++- .../java/docs/paths/storeorderorderid/Get.md | 18 +++++- .../petstore/java/docs/paths/user/Post.md | 18 +++++- .../docs/paths/usercreatewitharray/Post.md | 18 +++++- .../docs/paths/usercreatewithlist/Post.md | 18 +++++- .../petstore/java/docs/paths/userlogin/Get.md | 18 +++++- .../java/docs/paths/userlogout/Get.md | 17 +++++- .../java/docs/paths/userusername/Delete.md | 18 +++++- .../java/docs/paths/userusername/Get.md | 18 +++++- .../java/docs/paths/userusername/Put.md | 19 ++++++- .../paths/path/verb/OperationDoc.hbs | 3 +- .../path/verb/_OperationDocCodeSample.hbs | 57 +++++++++++++++++++ 69 files changed, 1196 insertions(+), 135 deletions(-) create mode 100644 src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 56c5752c199..2603e80f865 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -22,8 +22,22 @@ public static class Patch1 extends ApiClient.ApiClient1 implements PatchOperatio a class that allows one to call the endpoint using a method named patch -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.RequestBody; +// ServerIndex.SERVER_0 Server +import org.openapijsonschematools.client.servers.Server0; +// ServerIndex.SERVER_1 Server +import org.openapijsonschematools.client.servers.Server1; +// ServerIndex.SERVER_2 Server +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.anotherfakedummy.Patch; + + +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index 17d65515caa..6630860cc1e 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -22,8 +22,23 @@ public static class Delete1 extends ApiClient.ApiClient1 implements DeleteOperat a class that allows one to call the endpoint using a method named delete -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.HeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.PathParameters; +// ServerIndex.SERVER_0 Server +import org.openapijsonschematools.client.servers.Server0; +// ServerIndex.SERVER_1 Server +import org.openapijsonschematools.client.servers.Server1; +// ServerIndex.SERVER_2 Server +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.paths.commonparamsubdir.Delete; + + +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index abbfc1713cc..936cc43ff84 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -22,8 +22,23 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
src/main/java/packagename/paths/path/verb/_OperationDocCodeSample }} {{headerSize}}## Constructor Summary | Constructor and Description | diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs new file mode 100644 index 00000000000..9359bbca27c --- /dev/null +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -0,0 +1,57 @@ +``` +{{#with operation}} + {{#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}} + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "serverIndex"}} + {{#with property}} + {{! CodegenList of CodegenServer }} + {{#each this}} +// ServerIndex.SERVER_{{@index}} Server +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/each}} + {{/with}} + {{/eq}} + {{#eq @key.camelCase "securityIndex"}} + {{#with property}} + {{! CodegenList of SecurityRequirementObject }} + {{#each this}} +// SecurityIndex.SECURITY_INDEX_{{@index}} SecurityScheme + {{#each map}} + {{#with refInfo.ref}} + {{! SecurityScheme }} +import {{packageName}}.components.securityschemes.{{jsonPathPiece.pascalCase}}; + {{/with}} + {{/each}} + {{/each}} + {{/with}} + {{/eq}} + {{/each}} + {{/if}} + {{/each}} +import {{packageName}}.configurations.ApiConfiguration; +import {{packageName}}.configurations.SchemaConfiguration; +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + + +{{/with}} +``` \ No newline at end of file From 94c493876ae55c932e9f7231c0dea038c44b5030 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 31 Mar 2024 12:43:50 -0700 Subject: [PATCH 07/53] Improves operation code sample, adds initial empty security info --- .../java/docs/paths/anotherfakedummy/Patch.md | 22 ++++-- .../docs/paths/commonparamsubdir/Delete.md | 22 ++++-- .../java/docs/paths/commonparamsubdir/Get.md | 22 ++++-- .../java/docs/paths/commonparamsubdir/Post.md | 22 ++++-- .../petstore/java/docs/paths/fake/Delete.md | 29 +++++-- .../petstore/java/docs/paths/fake/Get.md | 22 ++++-- .../petstore/java/docs/paths/fake/Patch.md | 22 ++++-- .../petstore/java/docs/paths/fake/Post.md | 29 +++++-- .../Get.md | 22 ++++-- .../docs/paths/fakebodywithfileschema/Put.md | 22 ++++-- .../docs/paths/fakebodywithqueryparams/Put.md | 22 ++++-- .../docs/paths/fakecasesensitiveparams/Put.md | 22 ++++-- .../docs/paths/fakeclassnametest/Patch.md | 29 +++++-- .../docs/paths/fakedeletecoffeeid/Delete.md | 22 ++++-- .../java/docs/paths/fakehealth/Get.md | 22 ++++-- .../fakeinlineadditionalproperties/Post.md | 22 ++++-- .../docs/paths/fakeinlinecomposition/Post.md | 22 ++++-- .../java/docs/paths/fakejsonformdata/Get.md | 22 ++++-- .../java/docs/paths/fakejsonpatch/Patch.md | 22 ++++-- .../docs/paths/fakejsonwithcharset/Post.md | 22 ++++-- .../Post.md | 22 ++++-- .../paths/fakemultipleresponsebodies/Get.md | 22 ++++-- .../docs/paths/fakemultiplesecurities/Get.md | 31 +++++--- .../java/docs/paths/fakeobjinquery/Get.md | 22 ++++-- .../Post.md | 22 ++++-- .../java/docs/paths/fakepemcontenttype/Get.md | 22 ++++-- .../Post.md | 29 +++++-- .../fakequeryparamwithjsoncontenttype/Get.md | 22 ++++-- .../java/docs/paths/fakeredirection/Get.md | 22 ++++-- .../java/docs/paths/fakerefobjinquery/Get.md | 22 ++++-- .../docs/paths/fakerefsarraymodel/Post.md | 22 ++++-- .../docs/paths/fakerefsarrayofenums/Post.md | 22 ++++-- .../java/docs/paths/fakerefsboolean/Post.md | 22 ++++-- .../Post.md | 22 ++++-- .../java/docs/paths/fakerefsenum/Post.md | 22 ++++-- .../java/docs/paths/fakerefsmammal/Post.md | 22 ++++-- .../java/docs/paths/fakerefsnumber/Post.md | 22 ++++-- .../fakerefsobjectmodelwithrefprops/Post.md | 22 ++++-- .../java/docs/paths/fakerefsstring/Post.md | 22 ++++-- .../paths/fakeresponsewithoutschema/Get.md | 22 ++++-- .../docs/paths/faketestqueryparamters/Put.md | 22 ++++-- .../docs/paths/fakeuploaddownloadfile/Post.md | 22 ++++-- .../java/docs/paths/fakeuploadfile/Post.md | 22 ++++-- .../java/docs/paths/fakeuploadfiles/Post.md | 22 ++++-- .../docs/paths/fakewildcardresponses/Get.md | 22 ++++-- .../petstore/java/docs/paths/foo/Get.md | 20 +++-- .../petstore/java/docs/paths/pet/Post.md | 31 +++++--- .../petstore/java/docs/paths/pet/Put.md | 30 ++++++-- .../java/docs/paths/petfindbystatus/Get.md | 29 +++++-- .../java/docs/paths/petfindbytags/Get.md | 30 ++++++-- .../java/docs/paths/petpetid/Delete.md | 30 ++++++-- .../petstore/java/docs/paths/petpetid/Get.md | 29 +++++-- .../petstore/java/docs/paths/petpetid/Post.md | 30 ++++++-- .../docs/paths/petpetiduploadimage/Post.md | 29 +++++-- .../petstore/java/docs/paths/solidus/Get.md | 22 ++++-- .../java/docs/paths/storeinventory/Get.md | 29 +++++-- .../java/docs/paths/storeorder/Post.md | 22 ++++-- .../docs/paths/storeorderorderid/Delete.md | 22 ++++-- .../java/docs/paths/storeorderorderid/Get.md | 22 ++++-- .../petstore/java/docs/paths/user/Post.md | 22 ++++-- .../docs/paths/usercreatewitharray/Post.md | 22 ++++-- .../docs/paths/usercreatewithlist/Post.md | 22 ++++-- .../petstore/java/docs/paths/userlogin/Get.md | 22 ++++-- .../java/docs/paths/userlogout/Get.md | 22 ++++-- .../java/docs/paths/userusername/Delete.md | 22 ++++-- .../java/docs/paths/userusername/Get.md | 22 ++++-- .../java/docs/paths/userusername/Put.md | 22 ++++-- .../configurations/ApiConfiguration.java | 2 +- .../configurations/ApiConfiguration.hbs | 2 +- .../path/verb/_OperationDocCodeSample.hbs | 77 ++++++++++++++++++- 70 files changed, 1229 insertions(+), 430 deletions(-) diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 2603e80f865..4ddf1eee27f 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named patch ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.anotherfakedummy.Patch; - - +import org.openapijsonschematools.client.paths.anotherfakedummy.Patch + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index 6630860cc1e..f8dcb56a7d2 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -27,17 +27,27 @@ a class that allows one to call the endpoint using a method named delete import org.openapijsonschematools.client.paths.commonparamsubdir.delete.HeaderParameters; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.commonparamsubdir.Delete; - - +import org.openapijsonschematools.client.paths.commonparamsubdir.Delete + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index 936cc43ff84..d4ccb9ecd59 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -27,17 +27,27 @@ a class that allows one to call the endpoint using a method named get import org.openapijsonschematools.client.paths.commonparamsubdir.get.QueryParameters; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.commonparamsubdir.get.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.commonparamsubdir.Get; - - +import org.openapijsonschematools.client.paths.commonparamsubdir.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index 6b65eff0da2..151ae0fa004 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -27,17 +27,27 @@ a class that allows one to call the endpoint using a method named post import org.openapijsonschematools.client.paths.commonparamsubdir.post.HeaderParameters; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.commonparamsubdir.post.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.commonparamsubdir.Post; - - +import org.openapijsonschematools.client.paths.commonparamsubdir.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index a46f80ca5bb..dcf4607d3e4 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -30,19 +30,34 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteSecurityInfo; import org.openapijsonschematools.client.paths.fake.delete.HeaderParameters; import org.openapijsonschematools.client.paths.fake.delete.QueryParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.BearerTest; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fake.Delete; - - +import org.openapijsonschematools.client.paths.fake.Delete + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .fakeDeleteSecurityInfoSecurityIndex(FakeDeleteSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index 74a97cc584e..bc76a238703 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -26,17 +26,27 @@ import org.openapijsonschematools.client.paths.fake.get.RequestBody; import org.openapijsonschematools.client.paths.fake.get.HeaderParameters; import org.openapijsonschematools.client.paths.fake.get.QueryParameters; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fake.Get; - - +import org.openapijsonschematools.client.paths.fake.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index 4357fad877e..d721182e329 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named patch ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.patch.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fake.Patch; - - +import org.openapijsonschematools.client.paths.fake.Patch + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index cac4dcdef05..6e6a864b132 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -25,19 +25,34 @@ a class that allows one to call the endpoint using a method named post import org.openapijsonschematools.client.paths.fake.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fake.Post; - - +import org.openapijsonschematools.client.paths.fake.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .fakePostSecurityInfoSecurityIndex(FakePostSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index 831a0c99269..033f6204822 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named get ``` import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.Get; - - +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index d2b3ce4e6e4..2439bcaf625 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named put ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.Put; - - +import org.openapijsonschematools.client.paths.fakebodywithfileschema.Put + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index d9f125c19fb..8d498a59ac3 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -29,17 +29,27 @@ a class that allows one to call the endpoint using a method named put import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.RequestBody; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.QueryParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.Put; - - +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.Put + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index fff6157ec03..859d9456879 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named put ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.QueryParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.Put; - - +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.Put + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index 527686bf83f..cef33125344 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -27,19 +27,34 @@ a class that allows one to call the endpoint using a method named patch import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeclassnametest.Patch; - - +import org.openapijsonschematools.client.paths.fakeclassnametest.Patch + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .fakeclassnametestPatchSecurityInfoSecurityIndex(FakeclassnametestPatchSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index 132f19f1719..bbc831e4436 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named delete ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.Delete; - - +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.Delete + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index 02d9f7a430b..6e106f26701 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -23,17 +23,27 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakehealth.Get; - - +import org.openapijsonschematools.client.paths.fakehealth.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index 44f1a553030..285a2a195bd 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.Post; - - +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index e618ce87616..e7aed1757b0 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -25,17 +25,27 @@ a class that allows one to call the endpoint using a method named post import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.RequestBody; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.QueryParameters; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.Post; - - +import org.openapijsonschematools.client.paths.fakeinlinecomposition.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index 0a3f5a69864..72ab9cc2adb 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named get ``` import org.openapijsonschematools.client.paths.fakejsonformdata.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakejsonformdata.Get; - - +import org.openapijsonschematools.client.paths.fakejsonformdata.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index 0d6af950aec..71f64360d7c 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named patch ``` import org.openapijsonschematools.client.paths.fakejsonpatch.patch.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakejsonpatch.Patch; - - +import org.openapijsonschematools.client.paths.fakejsonpatch.Patch + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index 5fcddecf5ca..adadf1725c4 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.Post; - - +import org.openapijsonschematools.client.paths.fakejsonwithcharset.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 421c1478eec..4031d357df5 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.Post; - - +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index 0449ba23689..6e4b0a7638c 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -23,17 +23,27 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.Get; - - +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index 9cd9afcd5da..98fec97e9e4 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -24,23 +24,36 @@ a class that allows one to call the endpoint using a method named get ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme -// SecurityIndex.SECURITY_INDEX_1 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; import org.openapijsonschematools.client.components.securityschemes.ApiKey; -// SecurityIndex.SECURITY_INDEX_2 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.Get; - - +import org.openapijsonschematools.client.paths.fakemultiplesecurities.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .fakemultiplesecuritiesGetSecurityInfoSecurityIndex(FakemultiplesecuritiesGetSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index faf62daf1cd..f6378d39f68 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named get ``` import org.openapijsonschematools.client.paths.fakeobjinquery.get.QueryParameters; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeobjinquery.Get; - - +import org.openapijsonschematools.client.paths.fakeobjinquery.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index 51df3cdf638..abf10e40488 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -30,17 +30,27 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfa import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.CookieParameters; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.Post; - - +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index 51eb4ca15b7..0f687f1c150 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named get ``` import org.openapijsonschematools.client.paths.fakepemcontenttype.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakepemcontenttype.Get; - - +import org.openapijsonschematools.client.paths.fakepemcontenttype.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index 6caaa4492c5..5242da51aeb 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -28,19 +28,34 @@ import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredf import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.Post; - - +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index ac939fe00bb..52fc30bc8bb 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named get ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.QueryParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.Get; - - +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index 3f1afc38937..544ee04d93a 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -23,17 +23,27 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeredirection.Get; - - +import org.openapijsonschematools.client.paths.fakeredirection.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index 3b0e4e2d614..405247867e9 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named get ``` import org.openapijsonschematools.client.paths.fakerefobjinquery.get.QueryParameters; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefobjinquery.Get; - - +import org.openapijsonschematools.client.paths.fakerefobjinquery.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index 46265fd2da1..899387a5137 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.Post; - - +import org.openapijsonschematools.client.paths.fakerefsarraymodel.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index 57136861384..de96a22401a 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.Post; - - +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index e54334be327..157ad613f7e 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakerefsboolean.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsboolean.Post; - - +import org.openapijsonschematools.client.paths.fakerefsboolean.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index 098c0fe672d..ffba4f1a597 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.Post; - - +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index f7dfb758d30..cb59108a252 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakerefsenum.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsenum.Post; - - +import org.openapijsonschematools.client.paths.fakerefsenum.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index d334f4f9b29..3259c6d52f7 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsmammal.post.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsmammal.Post; - - +import org.openapijsonschematools.client.paths.fakerefsmammal.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index f6758d99c17..ba14c5d9328 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakerefsnumber.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsnumber.Post; - - +import org.openapijsonschematools.client.paths.fakerefsnumber.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 7c465d75eee..c1e640d78bc 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.Post; - - +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 73bc9709eb0..89bc1cddb56 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakerefsstring.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakerefsstring.Post; - - +import org.openapijsonschematools.client.paths.fakerefsstring.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index b8d78f3d1f2..450b76b6399 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -23,17 +23,27 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.Get; - - +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index c09b60ea7c5..2db44709e4b 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named put ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.faketestqueryparamters.put.QueryParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.faketestqueryparamters.Put; - - +import org.openapijsonschematools.client.paths.faketestqueryparamters.Put + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index 97f813f0628..e8cb8c993f6 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.Post; - - +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index bb652d68903..3bef5cef470 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakeuploadfile.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeuploadfile.Post; - - +import org.openapijsonschematools.client.paths.fakeuploadfile.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index 50a92c52ff1..30c13be3ad3 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -24,17 +24,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.paths.fakeuploadfiles.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakeuploadfiles.Post; - - +import org.openapijsonschematools.client.paths.fakeuploadfiles.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index 895e2e01ef4..efb4d01f537 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -23,17 +23,27 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.fakewildcardresponses.Get; - - +import org.openapijsonschematools.client.paths.fakewildcardresponses.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index e30fa63c672..c0c4b1257df 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -23,15 +23,25 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer1; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.foo.Get; - - +import org.openapijsonschematools.client.paths.foo.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new FooGetServer0(), + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index bc8d5cee191..89de529eabd 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -27,23 +27,36 @@ a class that allows one to call the endpoint using a method named post import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; import org.openapijsonschematools.client.paths.pet.post.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.ApiKey; -// SecurityIndex.SECURITY_INDEX_1 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; -// SecurityIndex.SECURITY_INDEX_2 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.pet.Post; - - +import org.openapijsonschematools.client.paths.pet.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petPostSecurityInfoSecurityIndex(PetPostSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index 781be5daec0..60032c4c6b8 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -27,21 +27,35 @@ a class that allows one to call the endpoint using a method named put import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.pet.put.PetPutSecurityInfo; import org.openapijsonschematools.client.paths.pet.put.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; -// SecurityIndex.SECURITY_INDEX_1 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.pet.Put; - - +import org.openapijsonschematools.client.paths.pet.Put + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petPutSecurityInfoSecurityIndex(PetPutSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 0c33facf8fa..ec1393e97d1 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -27,21 +27,34 @@ a class that allows one to call the endpoint using a method named get import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; import org.openapijsonschematools.client.paths.petfindbystatus.get.QueryParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer1; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.ApiKey; -// SecurityIndex.SECURITY_INDEX_1 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; -// SecurityIndex.SECURITY_INDEX_2 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.petfindbystatus.Get; - - +import org.openapijsonschematools.client.paths.petfindbystatus.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new PetfindbystatusServer0(), + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petfindbystatusGetSecurityInfoSecurityIndex(PetfindbystatusGetSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index 37ea8c05949..d3edb93baa4 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -27,21 +27,35 @@ a class that allows one to call the endpoint using a method named get import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetSecurityInfo; import org.openapijsonschematools.client.paths.petfindbytags.get.QueryParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; -// SecurityIndex.SECURITY_INDEX_1 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.petfindbytags.Get; - - +import org.openapijsonschematools.client.paths.petfindbytags.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petfindbytagsGetSecurityInfoSecurityIndex(PetfindbytagsGetSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index 2e0942466d1..8cc187d76e0 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -28,21 +28,35 @@ import org.openapijsonschematools.client.paths.petpetid.delete.HeaderParameters; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; import org.openapijsonschematools.client.paths.petpetid.delete.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.ApiKey; -// SecurityIndex.SECURITY_INDEX_1 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.petpetid.Delete; - - +import org.openapijsonschematools.client.paths.petpetid.Delete + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petpetidDeleteSecurityInfoSecurityIndex(PetpetidDeleteSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index aef529b9600..fbe525d268a 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -27,19 +27,34 @@ a class that allows one to call the endpoint using a method named get import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetSecurityInfo; import org.openapijsonschematools.client.paths.petpetid.get.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.petpetid.Get; - - +import org.openapijsonschematools.client.paths.petpetid.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petpetidGetSecurityInfoSecurityIndex(PetpetidGetSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index 4c49be5f73c..8f7c7b1e817 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -28,21 +28,35 @@ import org.openapijsonschematools.client.paths.petpetid.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; import org.openapijsonschematools.client.paths.petpetid.post.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.ApiKey; -// SecurityIndex.SECURITY_INDEX_1 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.petpetid.Post; - - +import org.openapijsonschematools.client.paths.petpetid.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petpetidPostSecurityInfoSecurityIndex(PetpetidPostSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index d97b662f853..db8c0bed3b8 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -28,19 +28,34 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.RequestB import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.petpetiduploadimage.Post; - - +import org.openapijsonschematools.client.paths.petpetiduploadimage.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petpetiduploadimagePostSecurityInfoSecurityIndex(PetpetiduploadimagePostSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index de5d75cbfe5..5cecaa138a3 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -23,17 +23,27 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.solidus.Get; - - +import org.openapijsonschematools.client.paths.solidus.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index 47dde8924d1..4ccd40b4dc1 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -24,19 +24,34 @@ a class that allows one to call the endpoint using a method named get ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; -// SecurityIndex.SECURITY_INDEX_0 SecurityScheme import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.storeinventory.Get; - - +import org.openapijsonschematools.client.paths.storeinventory.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .storeinventoryGetSecurityInfoSecurityIndex(StoreinventoryGetSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index e37184b865e..b5e997deee9 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.storeorder.post.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.storeorder.Post; - - +import org.openapijsonschematools.client.paths.storeorder.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index d0e77bd09fd..f6c5e3ae286 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named delete ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.storeorderorderid.delete.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.storeorderorderid.Delete; - - +import org.openapijsonschematools.client.paths.storeorderorderid.Delete + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index 2ead86c8666..ac01be2af0c 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named get ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.storeorderorderid.get.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.storeorderorderid.Get; - - +import org.openapijsonschematools.client.paths.storeorderorderid.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index f574daff7df..5a20fb58e49 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.user.post.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.user.Post; - - +import org.openapijsonschematools.client.paths.user.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index 222f06e0206..316deb8327c 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.usercreatewitharray.post.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.usercreatewitharray.Post; - - +import org.openapijsonschematools.client.paths.usercreatewitharray.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index b1cedd3bb70..0ab17f3411b 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.usercreatewithlist.post.RequestBody; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.usercreatewithlist.Post; - - +import org.openapijsonschematools.client.paths.usercreatewithlist.Post + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index 91069cc6fd4..714fbe8e068 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named get ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.userlogin.get.QueryParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.userlogin.Get; - - +import org.openapijsonschematools.client.paths.userlogin.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index 63b252dd612..3c6cdda30ce 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -23,17 +23,27 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.RootServerInfo; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.userlogout.Get; - - +import org.openapijsonschematools.client.paths.userlogout.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index 7ed5b882d61..7d656469adf 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named delete ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.userusername.delete.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.userusername.Delete; - - +import org.openapijsonschematools.client.paths.userusername.Delete + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index b7d6bd07bf8..4a31704367e 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -26,17 +26,27 @@ a class that allows one to call the endpoint using a method named get ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.userusername.get.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.userusername.Get; - - +import org.openapijsonschematools.client.paths.userusername.Get + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index c66e8fd4540..47c8aa95ef3 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -29,17 +29,27 @@ a class that allows one to call the endpoint using a method named put import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.userusername.put.RequestBody; import org.openapijsonschematools.client.paths.userusername.put.PathParameters; -// ServerIndex.SERVER_0 Server import org.openapijsonschematools.client.servers.Server0; -// ServerIndex.SERVER_1 Server import org.openapijsonschematools.client.servers.Server1; -// ServerIndex.SERVER_2 Server import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.paths.userusername.Put; - - +import org.openapijsonschematools.client.paths.userusername.Put + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index bbaa2bf3288..2e74282e7bb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -46,7 +46,7 @@ public ApiConfiguration() { timeout = null; } - public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, SecurityIndexInfo securityIndexInfo, List securitySchemes, Duration timeout) { + public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, List securitySchemes, SecurityIndexInfo securityIndexInfo, Duration timeout) { this.serverInfo = serverInfo; this.serverIndexInfo = serverIndexInfo; this.securityInfo = new SecurityInfo(); diff --git a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs index c9526e4611e..86916d47b17 100644 --- a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs +++ b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs @@ -55,7 +55,7 @@ public class ApiConfiguration { timeout = null; } - public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo{{#gt allSecurity.size 0}}, SecurityIndexInfo securityIndexInfo{{/gt}}{{#if securitySchemes}}, List securitySchemes{{/if}}, Duration timeout) { + public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo{{#if securitySchemes}}, List securitySchemes{{/if}}{{#gt allSecurity.size 0}}, SecurityIndexInfo securityIndexInfo{{/gt}}, Duration timeout) { this.serverInfo = serverInfo; this.serverIndexInfo = serverIndexInfo; {{#gt allSecurity.size 0}} diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index 9359bbca27c..20bb72b1c8b 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -26,7 +26,6 @@ import {{packageName}}.{{jsonPathPiece.pascalCase}}; {{#with property}} {{! CodegenList of CodegenServer }} {{#each this}} -// ServerIndex.SERVER_{{@index}} Server import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; {{/each}} {{/with}} @@ -35,7 +34,6 @@ import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; {{#with property}} {{! CodegenList of SecurityRequirementObject }} {{#each this}} -// SecurityIndex.SECURITY_INDEX_{{@index}} SecurityScheme {{#each map}} {{#with refInfo.ref}} {{! SecurityScheme }} @@ -50,8 +48,79 @@ import {{packageName}}.components.securityschemes.{{jsonPathPiece.pascalCase}}; {{/each}} import {{packageName}}.configurations.ApiConfiguration; import {{packageName}}.configurations.SchemaConfiguration; -import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; - +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}} +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "serverIndex"}} + {{#with property}} + {{! CodegenList of CodegenServer }} + {{#each this}} + {{#if @first}} + new {{jsonPathPiece.pascalCase}}(){{#unless @last}},{{/unless}} + {{else}} + null{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} + {{/with}} + {{/eq}} + {{/each}} + {{/if}} + {{/each}} +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + {{#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}} + {{/if}} + {{/each}} + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "securityIndex"}} + {{#with property}} +// todo define all securities that are possible and pass them in +List securitySchemes = new ArrayList(); + {{! CodegenList of SecurityRequirementObject }} + {{#each this}} + {{#each map}} + {{#with refInfo.ref}} + {{! SecurityScheme }} + {{/with}} + {{/each}} + {{/each}} +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .{{jsonPathPiece.camelCase}}SecurityIndex({{jsonPathPiece.pascalCase}}.SecurityIndex.SECURITY_0); + {{/with}} + {{/eq}} + {{/each}} + {{/if}} + {{/each}} +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "securityIndex"}} + securitySchemes, + securityIndexInfo, + {{/eq}} + {{/each}} + {{/if}} + {{/each}} + timeout +); {{/with}} ``` \ No newline at end of file From b28193ed5ca8eb1f17fa5853f006d1e6d0ac84d1 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 31 Mar 2024 13:04:09 -0700 Subject: [PATCH 08/53] Adds securitySchemes to operation code sample --- .../petstore/java/docs/paths/fake/Delete.md | 5 ++++- .../petstore/java/docs/paths/fake/Post.md | 5 ++++- .../docs/paths/fakeclassnametest/Patch.md | 5 ++++- .../docs/paths/fakemultiplesecurities/Get.md | 8 +++++++- .../Post.md | 2 +- .../petstore/java/docs/paths/pet/Post.md | 5 ++++- .../petstore/java/docs/paths/pet/Put.md | 2 +- .../java/docs/paths/petfindbystatus/Get.md | 5 ++++- .../java/docs/paths/petfindbytags/Get.md | 2 +- .../java/docs/paths/petpetid/Delete.md | 5 ++++- .../petstore/java/docs/paths/petpetid/Get.md | 5 ++++- .../petstore/java/docs/paths/petpetid/Post.md | 5 ++++- .../docs/paths/petpetiduploadimage/Post.md | 2 +- .../java/docs/paths/storeinventory/Get.md | 5 ++++- .../path/verb/_OperationDocCodeSample.hbs | 4 ++-- .../path/verb/_OperationDocSSCodeSample.hbs | 20 +++++++++++++++++++ 16 files changed, 69 insertions(+), 16 deletions(-) create mode 100644 src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocSSCodeSample.hbs diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index dcf4607d3e4..5e98c14bcc6 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -33,6 +33,7 @@ import org.openapijsonschematools.client.paths.fake.delete.QueryParameters; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.BearerTest; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -46,8 +47,10 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); +securitySchemes.add( + new BearerTest("someAccessToken"); +); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .fakeDeleteSecurityInfoSecurityIndex(FakeDeleteSecurityInfo.SecurityIndex.SECURITY_0); Duration timeout = Duration.ofSeconds(1L); diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index 6e6a864b132..b3d6e88495f 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -28,6 +28,7 @@ import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -41,8 +42,10 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); +securitySchemes.add( + new HttpBasicTest("someUserId", "somePassword"); +); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .fakePostSecurityInfoSecurityIndex(FakePostSecurityInfo.SecurityIndex.SECURITY_0); Duration timeout = Duration.ofSeconds(1L); diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index cef33125344..116c9f64935 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -30,6 +30,7 @@ import org.openapijsonschematools.client.paths.fakeclassnametest.patch.RequestBo import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -43,8 +44,10 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKeyQuery("someApiKey"); +); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .fakeclassnametestPatchSecurityInfoSecurityIndex(FakeclassnametestPatchSecurityInfo.SecurityIndex.SECURITY_0); Duration timeout = Duration.ofSeconds(1L); diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index 98fec97e9e4..cc3a36b5888 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -27,6 +27,7 @@ import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.Fakemu import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; @@ -42,8 +43,13 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); +securitySchemes.add( + new HttpBasicTest("someUserId", "somePassword"); +); +securitySchemes.add( + new ApiKey("someApiKey"); +); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .fakemultiplesecuritiesGetSecurityInfoSecurityIndex(FakemultiplesecuritiesGetSecurityInfo.SecurityIndex.SECURITY_0); Duration timeout = Duration.ofSeconds(1L); diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index 5242da51aeb..ed37840280b 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredf import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -44,7 +45,6 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex.SECURITY_0); diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index 89de529eabd..35a461b6703 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -30,6 +30,7 @@ import org.openapijsonschematools.client.paths.pet.post.RequestBody; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; @@ -45,8 +46,10 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .petPostSecurityInfoSecurityIndex(PetPostSecurityInfo.SecurityIndex.SECURITY_0); Duration timeout = Duration.ofSeconds(1L); diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index 60032c4c6b8..5c039ce10b9 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -30,6 +30,7 @@ import org.openapijsonschematools.client.paths.pet.put.RequestBody; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; @@ -44,7 +45,6 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .petPutSecurityInfoSecurityIndex(PetPutSecurityInfo.SecurityIndex.SECURITY_0); diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index ec1393e97d1..754136cf513 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.paths.petfindbystatus.get.Petfindbystat import org.openapijsonschematools.client.paths.petfindbystatus.get.QueryParameters; import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer0; import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer1; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; @@ -43,8 +44,10 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .petfindbystatusGetSecurityInfoSecurityIndex(PetfindbystatusGetSecurityInfo.SecurityIndex.SECURITY_0); Duration timeout = Duration.ofSeconds(1L); diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index d3edb93baa4..9c921a6972a 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -30,6 +30,7 @@ import org.openapijsonschematools.client.paths.petfindbytags.get.QueryParameters import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; @@ -44,7 +45,6 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .petfindbytagsGetSecurityInfoSecurityIndex(PetfindbytagsGetSecurityInfo.SecurityIndex.SECURITY_0); diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index 8cc187d76e0..1565b84ff8f 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.paths.petpetid.delete.PathParameters; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; @@ -45,8 +46,10 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .petpetidDeleteSecurityInfoSecurityIndex(PetpetidDeleteSecurityInfo.SecurityIndex.SECURITY_0); Duration timeout = Duration.ofSeconds(1L); diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index fbe525d268a..8f5d4455515 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -30,6 +30,7 @@ import org.openapijsonschematools.client.paths.petpetid.get.PathParameters; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -43,8 +44,10 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .petpetidGetSecurityInfoSecurityIndex(PetpetidGetSecurityInfo.SecurityIndex.SECURITY_0); Duration timeout = Duration.ofSeconds(1L); diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index 8f7c7b1e817..271531bf7e0 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.paths.petpetid.post.PathParameters; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; @@ -45,8 +46,10 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .petpetidPostSecurityInfoSecurityIndex(PetpetidPostSecurityInfo.SecurityIndex.SECURITY_0); Duration timeout = Duration.ofSeconds(1L); diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index db8c0bed3b8..d4c267105d6 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PathPara import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -44,7 +45,6 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .petpetiduploadimagePostSecurityInfoSecurityIndex(PetpetiduploadimagePostSecurityInfo.SecurityIndex.SECURITY_0); diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index 4ccd40b4dc1..d530affba74 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -27,6 +27,7 @@ import org.openapijsonschematools.client.paths.storeinventory.get.Storeinventory import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -40,8 +41,10 @@ ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( ); ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); .storeinventoryGetSecurityInfoSecurityIndex(StoreinventoryGetSecurityInfo.SecurityIndex.SECURITY_0); Duration timeout = Duration.ofSeconds(1L); diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index 20bb72b1c8b..59c0c185ff7 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -31,6 +31,7 @@ import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; {{/with}} {{/eq}} {{#eq @key.camelCase "securityIndex"}} +import {{packageName}}.securityschemes.SecurityScheme; {{#with property}} {{! CodegenList of SecurityRequirementObject }} {{#each this}} @@ -89,13 +90,12 @@ ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIn {{#each keyToBuilder}} {{#eq @key.camelCase "securityIndex"}} {{#with property}} -// todo define all securities that are possible and pass them in List securitySchemes = new ArrayList(); {{! CodegenList of SecurityRequirementObject }} {{#each this}} {{#each map}} {{#with refInfo.ref}} - {{! SecurityScheme }} +{{> src/main/java/packagename/paths/path/verb/_OperationDocSSCodeSample }} {{/with}} {{/each}} {{/each}} diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocSSCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocSSCodeSample.hbs new file mode 100644 index 00000000000..6bcbc6b1994 --- /dev/null +++ b/src/main/resources/java/src/main/java/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}} From b9050a709b692857076ca3b7918806e2c3c4c125 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 31 Mar 2024 13:20:03 -0700 Subject: [PATCH 09/53] Adds apiClient to operation code sample --- .../client/petstore/java/docs/paths/anotherfakedummy/Patch.md | 3 +++ .../petstore/java/docs/paths/commonparamsubdir/Delete.md | 3 +++ .../client/petstore/java/docs/paths/commonparamsubdir/Get.md | 3 +++ .../client/petstore/java/docs/paths/commonparamsubdir/Post.md | 3 +++ samples/client/petstore/java/docs/paths/fake/Delete.md | 3 +++ samples/client/petstore/java/docs/paths/fake/Get.md | 3 +++ samples/client/petstore/java/docs/paths/fake/Patch.md | 3 +++ samples/client/petstore/java/docs/paths/fake/Post.md | 3 +++ .../docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md | 3 +++ .../petstore/java/docs/paths/fakebodywithfileschema/Put.md | 3 +++ .../petstore/java/docs/paths/fakebodywithqueryparams/Put.md | 3 +++ .../petstore/java/docs/paths/fakecasesensitiveparams/Put.md | 3 +++ .../client/petstore/java/docs/paths/fakeclassnametest/Patch.md | 3 +++ .../petstore/java/docs/paths/fakedeletecoffeeid/Delete.md | 3 +++ samples/client/petstore/java/docs/paths/fakehealth/Get.md | 3 +++ .../java/docs/paths/fakeinlineadditionalproperties/Post.md | 3 +++ .../petstore/java/docs/paths/fakeinlinecomposition/Post.md | 3 +++ .../client/petstore/java/docs/paths/fakejsonformdata/Get.md | 3 +++ samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md | 3 +++ .../petstore/java/docs/paths/fakejsonwithcharset/Post.md | 3 +++ .../docs/paths/fakemultiplerequestbodycontenttypes/Post.md | 3 +++ .../petstore/java/docs/paths/fakemultipleresponsebodies/Get.md | 3 +++ .../petstore/java/docs/paths/fakemultiplesecurities/Get.md | 3 +++ samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md | 3 +++ .../java/docs/paths/fakeparametercollisions1ababselfab/Post.md | 3 +++ .../client/petstore/java/docs/paths/fakepemcontenttype/Get.md | 3 +++ .../docs/paths/fakepetiduploadimagewithrequiredfile/Post.md | 3 +++ .../java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md | 3 +++ samples/client/petstore/java/docs/paths/fakeredirection/Get.md | 3 +++ .../client/petstore/java/docs/paths/fakerefobjinquery/Get.md | 3 +++ .../client/petstore/java/docs/paths/fakerefsarraymodel/Post.md | 3 +++ .../petstore/java/docs/paths/fakerefsarrayofenums/Post.md | 3 +++ .../client/petstore/java/docs/paths/fakerefsboolean/Post.md | 3 +++ .../paths/fakerefscomposedoneofnumberwithvalidations/Post.md | 3 +++ samples/client/petstore/java/docs/paths/fakerefsenum/Post.md | 3 +++ samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md | 3 +++ samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md | 3 +++ .../java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md | 3 +++ samples/client/petstore/java/docs/paths/fakerefsstring/Post.md | 3 +++ .../petstore/java/docs/paths/fakeresponsewithoutschema/Get.md | 3 +++ .../petstore/java/docs/paths/faketestqueryparamters/Put.md | 3 +++ .../petstore/java/docs/paths/fakeuploaddownloadfile/Post.md | 3 +++ samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md | 3 +++ .../client/petstore/java/docs/paths/fakeuploadfiles/Post.md | 3 +++ .../petstore/java/docs/paths/fakewildcardresponses/Get.md | 3 +++ samples/client/petstore/java/docs/paths/foo/Get.md | 3 +++ samples/client/petstore/java/docs/paths/pet/Post.md | 3 +++ samples/client/petstore/java/docs/paths/pet/Put.md | 3 +++ samples/client/petstore/java/docs/paths/petfindbystatus/Get.md | 3 +++ samples/client/petstore/java/docs/paths/petfindbytags/Get.md | 3 +++ samples/client/petstore/java/docs/paths/petpetid/Delete.md | 3 +++ samples/client/petstore/java/docs/paths/petpetid/Get.md | 3 +++ samples/client/petstore/java/docs/paths/petpetid/Post.md | 3 +++ .../petstore/java/docs/paths/petpetiduploadimage/Post.md | 3 +++ samples/client/petstore/java/docs/paths/solidus/Get.md | 3 +++ samples/client/petstore/java/docs/paths/storeinventory/Get.md | 3 +++ samples/client/petstore/java/docs/paths/storeorder/Post.md | 3 +++ .../petstore/java/docs/paths/storeorderorderid/Delete.md | 3 +++ .../client/petstore/java/docs/paths/storeorderorderid/Get.md | 3 +++ samples/client/petstore/java/docs/paths/user/Post.md | 3 +++ .../petstore/java/docs/paths/usercreatewitharray/Post.md | 3 +++ .../client/petstore/java/docs/paths/usercreatewithlist/Post.md | 3 +++ samples/client/petstore/java/docs/paths/userlogin/Get.md | 3 +++ samples/client/petstore/java/docs/paths/userlogout/Get.md | 3 +++ samples/client/petstore/java/docs/paths/userusername/Delete.md | 3 +++ samples/client/petstore/java/docs/paths/userusername/Get.md | 3 +++ samples/client/petstore/java/docs/paths/userusername/Put.md | 3 +++ .../packagename/paths/path/verb/_OperationDocCodeSample.hbs | 3 +++ 68 files changed, 204 insertions(+) diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 4ddf1eee27f..df6adba464e 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.anotherfakedummy.Patch // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index f8dcb56a7d2..f13cd304296 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -32,6 +32,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.commonparamsubdir.Delete // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -48,6 +49,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index d4ccb9ecd59..cae0a756590 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -32,6 +32,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.commonparamsubdir.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -48,6 +49,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index 151ae0fa004..3a539f09a15 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -32,6 +32,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.commonparamsubdir.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -48,6 +49,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index 5e98c14bcc6..067ca1a9196 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -37,6 +37,7 @@ import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.BearerTest; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fake.Delete // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -61,6 +62,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index bc76a238703..bb355f69d29 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fake.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index d721182e329..0cfc82b0917 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fake.Patch // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index b3d6e88495f..61afc80788b 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -32,6 +32,7 @@ import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fake.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -56,6 +57,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index 033f6204822..e873b5a04e6 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index 2439bcaf625..890d2a06315 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakebodywithfileschema.Put // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index 8d498a59ac3..d4dfab6ae2a 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -34,6 +34,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.Put // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -50,6 +51,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index 859d9456879..447d6b81b61 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.Put // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index 116c9f64935..42e6d456c9e 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -34,6 +34,7 @@ import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakeclassnametest.Patch // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -58,6 +59,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index bbc831e4436..c48841fec9c 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.Delete // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index 6e106f26701..b483467653e 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -28,6 +28,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakehealth.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -44,6 +45,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index 285a2a195bd..f3691cfe865 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index e7aed1757b0..d0a67a4be10 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -30,6 +30,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakeinlinecomposition.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -46,6 +47,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index 72ab9cc2adb..98cb2bc75dd 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakejsonformdata.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index 71f64360d7c..961b4d61775 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakejsonpatch.Patch // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index adadf1725c4..e3f1cf1bfc1 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakejsonwithcharset.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 4031d357df5..6ef35161b25 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index 6e4b0a7638c..b93be0fe7b4 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -28,6 +28,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -44,6 +45,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index cc3a36b5888..237830caa9f 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -33,6 +33,7 @@ import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakemultiplesecurities.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -60,6 +61,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index f6378d39f68..1b7ffe6383b 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakeobjinquery.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index abf10e40488..1584d44631f 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -35,6 +35,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -51,6 +52,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index 0f687f1c150..cc57b94c0d7 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakepemcontenttype.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index ed37840280b..8555d760492 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -35,6 +35,7 @@ import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -56,6 +57,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index 52fc30bc8bb..d0098e35966 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index 544ee04d93a..8ebe1cdafc2 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -28,6 +28,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakeredirection.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -44,6 +45,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index 405247867e9..2efbe8360c0 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakerefobjinquery.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index 899387a5137..0de4d43da03 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakerefsarraymodel.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index de96a22401a..f2db17d9d13 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakerefsarrayofenums.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index 157ad613f7e..d9fdaeae91b 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakerefsboolean.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index ffba4f1a597..80299f34e14 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index cb59108a252..b62f6033fe8 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakerefsenum.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index 3259c6d52f7..bf1429a897a 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakerefsmammal.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index ba14c5d9328..329e3e83e4d 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakerefsnumber.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index c1e640d78bc..9c371ff4ccf 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 89bc1cddb56..8a01fa6bb93 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakerefsstring.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index 450b76b6399..3cbb67df1ac 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -28,6 +28,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -44,6 +45,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index 2db44709e4b..74924388a01 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.faketestqueryparamters.Put // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index e8cb8c993f6..8e2f2df1a2d 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index 3bef5cef470..c0ed22cb807 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakeuploadfile.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index 30c13be3ad3..584bd6cd9ae 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -29,6 +29,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakeuploadfiles.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -45,6 +46,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index efb4d01f537..30830bf4d34 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -28,6 +28,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.fakewildcardresponses.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -44,6 +45,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index c0c4b1257df..03dbb77d9c9 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -27,6 +27,7 @@ import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer0; import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer1; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.foo.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -42,6 +43,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index 35a461b6703..b959e91b0ca 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -36,6 +36,7 @@ import org.openapijsonschematools.client.components.securityschemes.HttpSignatur import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.pet.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -60,6 +61,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index 5c039ce10b9..efebb731229 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -35,6 +35,7 @@ import org.openapijsonschematools.client.components.securityschemes.HttpSignatur import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.pet.Put // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -56,6 +57,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 754136cf513..ad230859bcf 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -35,6 +35,7 @@ import org.openapijsonschematools.client.components.securityschemes.HttpSignatur import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.petfindbystatus.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -58,6 +59,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index 9c921a6972a..0d99f712f5b 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -35,6 +35,7 @@ import org.openapijsonschematools.client.components.securityschemes.HttpSignatur import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.petfindbytags.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -56,6 +57,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index 1565b84ff8f..27b86ed4dfc 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -36,6 +36,7 @@ import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.petpetid.Delete // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -60,6 +61,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index 8f5d4455515..437e2263d1f 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -34,6 +34,7 @@ import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.petpetid.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -58,6 +59,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index 271531bf7e0..027dedfaebf 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -36,6 +36,7 @@ import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.petpetid.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -60,6 +61,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index d4c267105d6..aaea18e5313 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -35,6 +35,7 @@ import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.petpetiduploadimage.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -56,6 +57,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index 5cecaa138a3..9dd8adc1aa0 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -28,6 +28,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.solidus.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -44,6 +45,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index d530affba74..b6a04b5ff9c 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.storeinventory.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -55,6 +56,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( securityIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index b5e997deee9..e0138af3838 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.storeorder.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index f6c5e3ae286..2414cf01f7a 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.storeorderorderid.Delete // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index ac01be2af0c..d781ef65f4a 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.storeorderorderid.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index 5a20fb58e49..577df3ac3d9 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.user.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index 316deb8327c..a0299e5618e 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.usercreatewitharray.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index 0ab17f3411b..ea14f8338cf 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.usercreatewithlist.Post // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index 714fbe8e068..ba094f4a255 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.userlogin.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index 3c6cdda30ce..1107cc2a84b 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -28,6 +28,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.userlogout.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -44,6 +45,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index 7d656469adf..9cedbca37d0 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.userusername.Delete // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index 4a31704367e..1fa581d30a7 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -31,6 +31,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.userusername.Get // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -47,6 +48,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index 47c8aa95ef3..ce9bed741f4 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -34,6 +34,7 @@ import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.paths.userusername.Put // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -50,6 +51,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( serverIndexInfo, timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); ``` ### Constructor Summary | Constructor and Description | diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index 59c0c185ff7..d62e2fec9ec 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -49,6 +49,7 @@ import {{packageName}}.components.securityschemes.{{jsonPathPiece.pascalCase}}; {{/each}} import {{packageName}}.configurations.ApiConfiguration; import {{packageName}}.configurations.SchemaConfiguration; +import {{packageName}}.configurations.JsonSchemaKeywordFlags; import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}} // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below @@ -122,5 +123,7 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( {{/each}} timeout ); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 apiClient = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1(apiConfiguration, schemaConfiguration); {{/with}} ``` \ No newline at end of file From c3c99eb89fc4ab9e12394e8d619c952e13cccafe Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 31 Mar 2024 13:30:44 -0700 Subject: [PATCH 10/53] Adds todo for operation required inputs --- .../java/docs/paths/anotherfakedummy/Patch.md | 3 +++ .../java/docs/paths/commonparamsubdir/Delete.md | 3 +++ .../java/docs/paths/commonparamsubdir/Get.md | 3 +++ .../java/docs/paths/commonparamsubdir/Post.md | 3 +++ .../petstore/java/docs/paths/fake/Delete.md | 5 +++++ .../client/petstore/java/docs/paths/fake/Get.md | 11 +++++++++++ .../client/petstore/java/docs/paths/fake/Patch.md | 3 +++ .../client/petstore/java/docs/paths/fake/Post.md | 9 +++++++++ .../Get.md | 7 +++++++ .../java/docs/paths/fakebodywithfileschema/Put.md | 3 +++ .../docs/paths/fakebodywithqueryparams/Put.md | 5 +++++ .../docs/paths/fakecasesensitiveparams/Put.md | 3 +++ .../java/docs/paths/fakeclassnametest/Patch.md | 3 +++ .../java/docs/paths/fakedeletecoffeeid/Delete.md | 3 +++ .../petstore/java/docs/paths/fakehealth/Get.md | 5 +++++ .../paths/fakeinlineadditionalproperties/Post.md | 3 +++ .../java/docs/paths/fakeinlinecomposition/Post.md | 9 +++++++++ .../java/docs/paths/fakejsonformdata/Get.md | 7 +++++++ .../java/docs/paths/fakejsonpatch/Patch.md | 7 +++++++ .../java/docs/paths/fakejsonwithcharset/Post.md | 7 +++++++ .../fakemultiplerequestbodycontenttypes/Post.md | 7 +++++++ .../docs/paths/fakemultipleresponsebodies/Get.md | 5 +++++ .../java/docs/paths/fakemultiplesecurities/Get.md | 7 +++++++ .../java/docs/paths/fakeobjinquery/Get.md | 7 +++++++ .../fakeparametercollisions1ababselfab/Post.md | 3 +++ .../java/docs/paths/fakepemcontenttype/Get.md | 7 +++++++ .../fakepetiduploadimagewithrequiredfile/Post.md | 3 +++ .../fakequeryparamwithjsoncontenttype/Get.md | 3 +++ .../java/docs/paths/fakeredirection/Get.md | 5 +++++ .../java/docs/paths/fakerefobjinquery/Get.md | 7 +++++++ .../java/docs/paths/fakerefsarraymodel/Post.md | 7 +++++++ .../java/docs/paths/fakerefsarrayofenums/Post.md | 7 +++++++ .../java/docs/paths/fakerefsboolean/Post.md | 7 +++++++ .../Post.md | 7 +++++++ .../petstore/java/docs/paths/fakerefsenum/Post.md | 7 +++++++ .../java/docs/paths/fakerefsmammal/Post.md | 3 +++ .../java/docs/paths/fakerefsnumber/Post.md | 7 +++++++ .../paths/fakerefsobjectmodelwithrefprops/Post.md | 7 +++++++ .../java/docs/paths/fakerefsstring/Post.md | 7 +++++++ .../docs/paths/fakeresponsewithoutschema/Get.md | 5 +++++ .../java/docs/paths/faketestqueryparamters/Put.md | 3 +++ .../docs/paths/fakeuploaddownloadfile/Post.md | 3 +++ .../java/docs/paths/fakeuploadfile/Post.md | 7 +++++++ .../java/docs/paths/fakeuploadfiles/Post.md | 7 +++++++ .../java/docs/paths/fakewildcardresponses/Get.md | 5 +++++ .../client/petstore/java/docs/paths/foo/Get.md | 5 +++++ .../client/petstore/java/docs/paths/pet/Post.md | 3 +++ .../client/petstore/java/docs/paths/pet/Put.md | 3 +++ .../java/docs/paths/petfindbystatus/Get.md | 3 +++ .../petstore/java/docs/paths/petfindbytags/Get.md | 3 +++ .../petstore/java/docs/paths/petpetid/Delete.md | 3 +++ .../petstore/java/docs/paths/petpetid/Get.md | 3 +++ .../petstore/java/docs/paths/petpetid/Post.md | 3 +++ .../java/docs/paths/petpetiduploadimage/Post.md | 3 +++ .../petstore/java/docs/paths/solidus/Get.md | 5 +++++ .../java/docs/paths/storeinventory/Get.md | 7 +++++++ .../petstore/java/docs/paths/storeorder/Post.md | 3 +++ .../java/docs/paths/storeorderorderid/Delete.md | 3 +++ .../java/docs/paths/storeorderorderid/Get.md | 3 +++ .../client/petstore/java/docs/paths/user/Post.md | 3 +++ .../java/docs/paths/usercreatewitharray/Post.md | 3 +++ .../java/docs/paths/usercreatewithlist/Post.md | 3 +++ .../petstore/java/docs/paths/userlogin/Get.md | 3 +++ .../petstore/java/docs/paths/userlogout/Get.md | 5 +++++ .../java/docs/paths/userusername/Delete.md | 3 +++ .../petstore/java/docs/paths/userusername/Get.md | 3 +++ .../petstore/java/docs/paths/userusername/Put.md | 5 +++++ .../paths/path/verb/_OperationDocCodeSample.hbs | 15 +++++++++++++++ 68 files changed, 338 insertions(+) diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index df6adba464e..6ac181d529f 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index f13cd304296..b8534525d56 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -51,6 +51,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index cae0a756590..eb717f973bd 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -51,6 +51,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index 3a539f09a15..eef9f6ecc3e 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -51,6 +51,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index 067ca1a9196..940be858f89 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -64,6 +64,11 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); + +// todo set sample for headerParameters +// HeaderParameters +// todo set sample for queryParameters +// QueryParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index bb355f69d29..e4885eed008 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -50,6 +50,17 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for headerParameters +// HeaderParameters +// todo set sample for queryParameters +// QueryParameters +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index 0cfc82b0917..5c912df1c94 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index 61afc80788b..8b620477e0f 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -59,6 +59,15 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for securityIndex +// FakePostSecurityInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index e873b5a04e6..9700d54eba9 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index 890d2a06315..fcb3ee26e24 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index d4dfab6ae2a..71f0dd3cd73 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -53,6 +53,11 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for queryParameters +// QueryParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index 447d6b81b61..e796e4a93af 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); + +// todo set sample for queryParameters +// QueryParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index 42e6d456c9e..bf9a9beeb52 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -61,6 +61,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index c48841fec9c..a3cae497c10 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index b483467653e..df41cbf87e0 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -47,6 +47,11 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index f3691cfe865..60cc7c7ff20 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index d0a67a4be10..82b1578dd8c 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -49,6 +49,15 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for queryParameters +// QueryParameters +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index 98cb2bc75dd..980f27db281 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index 961b4d61775..0388d954b5c 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Patch ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index e3f1cf1bfc1..720b8ce3655 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 6ef35161b25..8ce14187193 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index b93be0fe7b4..c9fe7da95b0 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -47,6 +47,11 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index 237830caa9f..9285113fdcd 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -63,6 +63,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for securityIndex +// FakemultiplesecuritiesGetSecurityInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index 1b7ffe6383b..30396fa9c01 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for queryParameters +// QueryParameters +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index 1584d44631f..0684cf3ecf2 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -54,6 +54,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index cc57b94c0d7..bc8954f6397 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index 8555d760492..8997b73c070 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -59,6 +59,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index d0098e35966..f6e6ff907fc 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for queryParameters +// QueryParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index 8ebe1cdafc2..8c2287c0576 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -47,6 +47,11 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index 2efbe8360c0..13f1f40d410 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for queryParameters +// QueryParameters +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index 0de4d43da03..66d0b7bc2f7 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index f2db17d9d13..29e0a82d21e 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index d9fdaeae91b..15f4fb221d7 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index 80299f34e14..e9d48b0d039 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index b62f6033fe8..ea5f9b6a98b 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index bf1429a897a..8a507813c11 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index 329e3e83e4d..846179372d1 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 9c371ff4ccf..2217cdd3114 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 8a01fa6bb93..06396b50203 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index 3cbb67df1ac..0f206a16d40 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -47,6 +47,11 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index 74924388a01..bba64fa6ad0 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); + +// todo set sample for queryParameters +// QueryParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index 8e2f2df1a2d..54802a11480 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index c0ed22cb807..f388a47cb31 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index 584bd6cd9ae..614f5797eff 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -48,6 +48,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index 30830bf4d34..f285d7ddc31 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -47,6 +47,11 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index 03dbb77d9c9..135add5b3e7 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -45,6 +45,11 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for serverIndex +// FooGetServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index b959e91b0ca..5635d8d2000 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -63,6 +63,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index efebb731229..b3850c8efa3 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -59,6 +59,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index ad230859bcf..2e34d66a814 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -61,6 +61,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for queryParameters +// QueryParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index 0d99f712f5b..8ac4affdab4 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -59,6 +59,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for queryParameters +// QueryParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index 27b86ed4dfc..49826b4114a 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -63,6 +63,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index 437e2263d1f..fcc9e6a215f 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -61,6 +61,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index 027dedfaebf..5ddb6d9ac34 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -63,6 +63,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index aaea18e5313..9c4b21bdf23 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -59,6 +59,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index 9dd8adc1aa0..c825e74fcdb 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -47,6 +47,11 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index b6a04b5ff9c..f720d9ad79a 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -58,6 +58,13 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for securityIndex +// StoreinventoryGetSecurityInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index e0138af3838..4ca67c80338 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index 2414cf01f7a..661422ba5aa 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index d781ef65f4a..2fdbd65816c 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index 577df3ac3d9..8b077fd19ba 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index a0299e5618e..6aee879141a 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index ea14f8338cf..1673337c8a9 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index ba094f4a255..3969bd67eca 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for queryParameters +// QueryParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index 1107cc2a84b..d6a5af81285 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -47,6 +47,11 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for serverIndex +// RootServerInfo +// todo set sample for timeout +// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index 9cedbca37d0..bda70f8b6d4 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index 1fa581d30a7..7e084cee6b6 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -50,6 +50,9 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index ce9bed741f4..15044575c36 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -53,6 +53,11 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); + +// todo set sample for requestBody +// RequestBody +// todo set sample for pathParameters +// PathParameters ``` ### Constructor Summary | Constructor and Description | diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index d62e2fec9ec..51e1956c6f7 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -125,5 +125,20 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( ); SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 apiClient = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1(apiConfiguration, schemaConfiguration); + + {{#each builders}} + {{#if @last}} + {{#each keyToBuilder}} +// todo set sample for {{@key.camelCase}} + {{#with property}} + {{#if containerJsonPathPiece}} +// {{containerJsonPathPiece.pascalCase}} + {{else}} +// {{jsonPathPiece.pascalCase}} + {{/if}} + {{/with}} + {{/each}} + {{/if}} + {{/each}} {{/with}} ``` \ No newline at end of file From fbf0e776b90df6569b8662f842732b9d258a4fde Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 31 Mar 2024 13:44:42 -0700 Subject: [PATCH 11/53] Refactors docs schema code sample template --- .../components/schemas/Schema_doc.hbs | 18 +++++++- .../schemas/docschema_codeSample.hbs | 46 ++++++------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/Schema_doc.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/Schema_doc.hbs index 024a6669b58..6c6097ed863 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/Schema_doc.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/Schema_doc.hbs @@ -134,7 +134,23 @@ A schema class that validates payloads {{#if isCustomSchema}} {{#if typeToExample}} -{{> src/main/java/packagename/components/schemas/docschema_codeSample }} +{{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(JsonSchemaKeywordFlags.ofNone()); +{{> src/main/java/packagename/components/schemas/docschema_codeSample payloadVarName="validatedPayload" configVarName="configuration" }} +``` {{/if}} {{headerSize}}## Field Summary diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/docschema_codeSample.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/docschema_codeSample.hbs index cf3c0f65061..55c9cf6500b 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/docschema_codeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/docschema_codeSample.hbs @@ -1,79 +1,64 @@ -{{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(JsonSchemaKeywordFlags.ofNone()); {{#each typeToExample}} {{#eq @key "null"}} // null validation -Void validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +Void {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} {{#eq @key "object"}} {{#if ../mapOutputJsonPathPiece}} // Map validation -{{../../../containerJsonPathPiece.pascalCase}}.{{../mapOutputJsonPathPiece.pascalCase}} validatedPayload = +{{../../../containerJsonPathPiece.pascalCase}}.{{../mapOutputJsonPathPiece.pascalCase}} {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} // Map validation -FrozenMap validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +FrozenMap {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{/if}} {{else}} {{#eq @key "array"}} {{#if ../arrayOutputJsonPathPiece}} // List validation -{{../../../containerJsonPathPiece.pascalCase}}.{{../arrayOutputJsonPathPiece.pascalCase}} validatedPayload = +{{../../../containerJsonPathPiece.pascalCase}}.{{../arrayOutputJsonPathPiece.pascalCase}} {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} // List validation -FrozenList validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +FrozenList {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{/if}} {{else}} {{#eq @key "string" }} // String validation -String validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +String {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} {{#eq @key "integer"}} {{#or (eq ../format null) (eq ../format "int64") }} // long validation -long validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +long {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} // int validation -int validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +int {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{/or}} {{else}} {{#eq @key "number"}} {{#eq ../format "int64"}} // long validation -long validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +long {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} {{#eq ../format "float"}} // float validation -float validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +float {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} {{#eq ../format "double"}} // double validation -double validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +double {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} // int validation -int validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +int {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{/eq}} {{/eq}} {{/eq}} {{else}} {{#eq @key "boolean"}} // boolean validation -boolean validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +boolean {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{/eq}} {{/eq}} {{/eq}} @@ -96,7 +81,6 @@ boolean validatedPayload = {{../../../containerJsonPathPiece.pascalCase}}.{{../j {{/and}} {{/and}} {{/with}} - configuration + {{configVarName}} ); - {{/each}} -``` + {{/each}} \ No newline at end of file From 0e69e1d4a011090247fba0a4bb15984e3277ceca Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 31 Mar 2024 14:01:41 -0700 Subject: [PATCH 12/53] Adds operation input samples for query path header and cookie parameters --- .../java/docs/paths/anotherfakedummy/Patch.md | 9 +++- .../docs/paths/commonparamsubdir/Delete.md | 21 +++++++-- .../java/docs/paths/commonparamsubdir/Get.md | 21 +++++++-- .../java/docs/paths/commonparamsubdir/Post.md | 21 +++++++-- .../petstore/java/docs/paths/fake/Delete.md | 41 ++++++++++++++-- .../petstore/java/docs/paths/fake/Get.md | 47 +++++++++++++++++-- .../petstore/java/docs/paths/fake/Patch.md | 9 +++- .../petstore/java/docs/paths/fake/Post.md | 9 +++- .../Get.md | 9 +++- .../docs/paths/fakebodywithfileschema/Put.md | 9 +++- .../docs/paths/fakebodywithqueryparams/Put.md | 21 +++++++-- .../docs/paths/fakecasesensitiveparams/Put.md | 25 ++++++++-- .../docs/paths/fakeclassnametest/Patch.md | 9 +++- .../docs/paths/fakedeletecoffeeid/Delete.md | 21 +++++++-- .../java/docs/paths/fakehealth/Get.md | 9 +++- .../fakeinlineadditionalproperties/Post.md | 9 +++- .../docs/paths/fakeinlinecomposition/Post.md | 23 +++++++-- .../java/docs/paths/fakejsonformdata/Get.md | 9 +++- .../java/docs/paths/fakejsonpatch/Patch.md | 9 +++- .../docs/paths/fakejsonwithcharset/Post.md | 9 +++- .../Post.md | 9 +++- .../paths/fakemultipleresponsebodies/Get.md | 9 +++- .../docs/paths/fakemultiplesecurities/Get.md | 9 +++- .../java/docs/paths/fakeobjinquery/Get.md | 27 +++++++++-- .../Post.md | 29 ++++++++++-- .../java/docs/paths/fakepemcontenttype/Get.md | 9 +++- .../Post.md | 21 +++++++-- .../fakequeryparamwithjsoncontenttype/Get.md | 19 ++++++-- .../java/docs/paths/fakeredirection/Get.md | 9 +++- .../java/docs/paths/fakerefobjinquery/Get.md | 27 +++++++++-- .../docs/paths/fakerefsarraymodel/Post.md | 9 +++- .../docs/paths/fakerefsarrayofenums/Post.md | 9 +++- .../java/docs/paths/fakerefsboolean/Post.md | 9 +++- .../Post.md | 9 +++- .../java/docs/paths/fakerefsenum/Post.md | 9 +++- .../java/docs/paths/fakerefsmammal/Post.md | 9 +++- .../java/docs/paths/fakerefsnumber/Post.md | 9 +++- .../fakerefsobjectmodelwithrefprops/Post.md | 9 +++- .../java/docs/paths/fakerefsstring/Post.md | 9 +++- .../paths/fakeresponsewithoutschema/Get.md | 9 +++- .../docs/paths/faketestqueryparamters/Put.md | 46 ++++++++++++++++-- .../docs/paths/fakeuploaddownloadfile/Post.md | 9 +++- .../java/docs/paths/fakeuploadfile/Post.md | 9 +++- .../java/docs/paths/fakeuploadfiles/Post.md | 9 +++- .../docs/paths/fakewildcardresponses/Get.md | 9 +++- .../petstore/java/docs/paths/foo/Get.md | 9 +++- .../petstore/java/docs/paths/pet/Post.md | 9 +++- .../petstore/java/docs/paths/pet/Put.md | 9 +++- .../java/docs/paths/petfindbystatus/Get.md | 24 ++++++++-- .../java/docs/paths/petfindbytags/Get.md | 24 ++++++++-- .../java/docs/paths/petpetid/Delete.md | 21 +++++++-- .../petstore/java/docs/paths/petpetid/Get.md | 21 +++++++-- .../petstore/java/docs/paths/petpetid/Post.md | 21 +++++++-- .../docs/paths/petpetiduploadimage/Post.md | 21 +++++++-- .../petstore/java/docs/paths/solidus/Get.md | 9 +++- .../java/docs/paths/storeinventory/Get.md | 9 +++- .../java/docs/paths/storeorder/Post.md | 9 +++- .../docs/paths/storeorderorderid/Delete.md | 21 +++++++-- .../java/docs/paths/storeorderorderid/Get.md | 21 +++++++-- .../petstore/java/docs/paths/user/Post.md | 9 +++- .../docs/paths/usercreatewitharray/Post.md | 9 +++- .../docs/paths/usercreatewithlist/Post.md | 9 +++- .../petstore/java/docs/paths/userlogin/Get.md | 23 +++++++-- .../java/docs/paths/userlogout/Get.md | 9 +++- .../java/docs/paths/userusername/Delete.md | 21 +++++++-- .../java/docs/paths/userusername/Get.md | 21 +++++++-- .../java/docs/paths/userusername/Put.md | 21 +++++++-- .../path/verb/_OperationDocCodeSample.hbs | 17 +++++-- 68 files changed, 919 insertions(+), 128 deletions(-) diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 6ac181d529f..a68925fbace 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.anotherfakedummy.Patch +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.paths.anotherfakedummy.Patch; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index b8534525d56..5807a67b7cb 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -33,7 +33,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.commonparamsubdir.Delete +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.paths.commonparamsubdir.Delete; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -52,8 +59,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .subDir("c") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index eb717f973bd..07d07eb66c7 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -33,7 +33,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.commonparamsubdir.Get +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.paths.commonparamsubdir.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -52,8 +59,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .subDir("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index eef9f6ecc3e..037b0db1b02 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -33,7 +33,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.commonparamsubdir.Post +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.paths.commonparamsubdir.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -52,8 +59,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .subDir("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index 940be858f89..55be5ebd9ac 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -38,7 +38,14 @@ import org.openapijsonschematools.client.components.securityschemes.BearerTest; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fake.Delete +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.paths.fake.Delete; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -65,10 +72,34 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); -// todo set sample for headerParameters -// HeaderParameters -// todo set sample for queryParameters -// QueryParameters + +// Map validation +HeaderParameters.HeaderParametersMap = + HeaderParameters.HeaderParameters1.validate( + new HeaderParameters.HeaderParametersMapBuilder() + .required_boolean_group("true") + + .boolean_group("true") + + .build(), + schemaConfiguration +); + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .required_int64_group(1L) + + .required_string_group("a") + + .int64_group(1L) + + .string_group("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index e4885eed008..b788b1ecbde 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fake.Get +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.paths.fake.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -53,10 +60,40 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // todo set sample for requestBody // RequestBody -// todo set sample for headerParameters -// HeaderParameters -// todo set sample for queryParameters -// QueryParameters + +// Map validation +HeaderParameters.HeaderParametersMap = + HeaderParameters.HeaderParameters1.validate( + new HeaderParameters.HeaderParametersMapBuilder() + .enum_header_string("_abc") + + .enum_header_string_array( + Arrays.asList( + ">" + ) + ) + .build(), + schemaConfiguration +); + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .enum_query_double(3.14d) + + .enum_query_string("_abc") + + .enum_query_integer(1) + + .enum_query_string_array( + Arrays.asList( + ">" + ) + ) + .build(), + schemaConfiguration +); // todo set sample for serverIndex // RootServerInfo // todo set sample for timeout diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index 5c912df1c94..6e551d80f35 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fake.Patch +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.paths.fake.Patch; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index 8b620477e0f..cc5f85804a8 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -33,7 +33,14 @@ import org.openapijsonschematools.client.components.securityschemes.HttpBasicTes import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fake.Post +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.paths.fake.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index 9700d54eba9..d8412467662 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.Get +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.paths.fakeadditionalpropertieswitharrayofenums.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index fcb3ee26e24..70e473445e5 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.Put +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.paths.fakebodywithfileschema.Put; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index 71f0dd3cd73..aff2d14aeea 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -35,7 +35,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.Put +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.paths.fakebodywithqueryparams.Put; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -56,8 +63,16 @@ Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); // todo set sample for requestBody // RequestBody -// todo set sample for queryParameters -// QueryParameters + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .query("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index e796e4a93af..7f29d042948 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.Put +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.paths.fakecasesensitiveparams.Put; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -51,8 +58,20 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); -// todo set sample for queryParameters -// QueryParameters + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .SomeVar("a") + + .someVar("a") + + .some_var("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index bf9a9beeb52..fc1e84f2f99 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -35,7 +35,14 @@ import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakeclassnametest.Patch +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.paths.fakeclassnametest.Patch; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index a3cae497c10..43418fac3b7 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.Delete +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.paths.fakedeletecoffeeid.Delete; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -51,8 +58,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .id("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index df41cbf87e0..57d69a17720 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -29,7 +29,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakehealth.Get +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.paths.fakehealth.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index 60cc7c7ff20..b4191147154 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.Post +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.paths.fakeinlineadditionalproperties.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 82b1578dd8c..5d097c3c9d4 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -31,7 +31,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.Post +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.paths.fakeinlinecomposition.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -52,8 +59,18 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // todo set sample for requestBody // RequestBody -// todo set sample for queryParameters -// QueryParameters + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .compositionInProperty( + MapUtils.makeMap( + ) + ) + .build(), + schemaConfiguration +); // todo set sample for serverIndex // RootServerInfo // todo set sample for timeout diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index 980f27db281..f0a320b104d 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakejsonformdata.Get +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.paths.fakejsonformdata.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index 0388d954b5c..69f80f6ea16 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakejsonpatch.Patch +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.paths.fakejsonpatch.Patch; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index 720b8ce3655..1dcaef173ff 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.Post +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.paths.fakejsonwithcharset.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 8ce14187193..4d61d318494 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.Post +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.paths.fakemultiplerequestbodycontenttypes.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index c9fe7da95b0..75910090026 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -29,7 +29,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.Get +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.paths.fakemultipleresponsebodies.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index 9285113fdcd..fcbd5af5c6b 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -34,7 +34,14 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.Get +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.paths.fakemultiplesecurities.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index 30396fa9c01..cbf04f3fce0 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakeobjinquery.Get +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.paths.fakeobjinquery.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -49,8 +56,22 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for queryParameters -// QueryParameters + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .mapBean( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "keyword", + "a" + ) + ) + ) + .build(), + schemaConfiguration +); // todo set sample for serverIndex // RootServerInfo // todo set sample for timeout diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index 0684cf3ecf2..63ffc3b1e37 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -36,7 +36,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.Post +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.paths.fakeparametercollisions1ababselfab.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -55,8 +62,24 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .positive1("a") + + .aHyphenMinusB("a") + + .Ab("a") + + .aB("a") + + .self("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index bc8954f6397..41fbaf3107c 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakepemcontenttype.Get +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.paths.fakepemcontenttype.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index 8997b73c070..cea9d608338 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -36,7 +36,14 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.Post +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.paths.fakepetiduploadimagewithrequiredfile.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -60,8 +67,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index f6e6ff907fc..29ee7839b83 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.Get +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.paths.fakequeryparamwithjsoncontenttype.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -51,8 +58,14 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for queryParameters -// QueryParameters + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index 8c2287c0576..8f0654bf2fa 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -29,7 +29,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakeredirection.Get +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.paths.fakeredirection.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index 13f1f40d410..032862b1c20 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakerefobjinquery.Get +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.paths.fakerefobjinquery.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -49,8 +56,22 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for queryParameters -// QueryParameters + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .mapBean( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "bar", + "a" + ) + ) + ) + .build(), + schemaConfiguration +); // todo set sample for serverIndex // RootServerInfo // todo set sample for timeout diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index 66d0b7bc2f7..e795fcb3a8f 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakerefsarraymodel.Post +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.paths.fakerefsarraymodel.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index 29e0a82d21e..aadedc2d983 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.Post +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.paths.fakerefsarrayofenums.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index 15f4fb221d7..34b1325bfa3 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakerefsboolean.Post +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.paths.fakerefsboolean.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index e9d48b0d039..afa86335db3 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.Post +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.paths.fakerefscomposedoneofnumberwithvalidations.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index ea5f9b6a98b..00a4a3a414a 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakerefsenum.Post +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.paths.fakerefsenum.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index 8a507813c11..fb6c73bcccb 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakerefsmammal.Post +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.paths.fakerefsmammal.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index 846179372d1..b1c20dbc620 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakerefsnumber.Post +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.paths.fakerefsnumber.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 2217cdd3114..f2691423bc1 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.Post +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.paths.fakerefsobjectmodelwithrefprops.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 06396b50203..62a0f5cc484 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakerefsstring.Post +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.paths.fakerefsstring.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index 0f206a16d40..2159f030d88 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -29,7 +29,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.Get +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.paths.fakeresponsewithoutschema.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index bba64fa6ad0..31138db274b 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.faketestqueryparamters.Put +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.paths.faketestqueryparamters.Put; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -51,8 +58,41 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); -// todo set sample for queryParameters -// QueryParameters + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .context( + Arrays.asList( + "a" + ) + ) + .http( + Arrays.asList( + "a" + ) + ) + .ioutil( + Arrays.asList( + "a" + ) + ) + .pipe( + Arrays.asList( + "a" + ) + ) + .refParam("a") + + .url( + Arrays.asList( + "a" + ) + ) + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index 54802a11480..d4d8a7ea1c3 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.Post +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.paths.fakeuploaddownloadfile.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index f388a47cb31..30aa9fbd00b 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakeuploadfile.Post +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.paths.fakeuploadfile.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index 614f5797eff..2e10773f656 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -30,7 +30,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakeuploadfiles.Post +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.paths.fakeuploadfiles.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index f285d7ddc31..7dc055e3353 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -29,7 +29,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.fakewildcardresponses.Get +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.paths.fakewildcardresponses.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index 135add5b3e7..c03f55ce87c 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -28,7 +28,14 @@ import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer1; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.foo.Get +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.paths.foo.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index 5635d8d2000..6f7ec515d63 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -37,7 +37,14 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.pet.Post +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.paths.pet.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index b3850c8efa3..f07b8bcf90b 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -36,7 +36,14 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.pet.Put +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.paths.pet.Put; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 2e34d66a814..0f26389cc3c 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -36,7 +36,14 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.petfindbystatus.Get +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.paths.petfindbystatus.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -62,8 +69,19 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for queryParameters -// QueryParameters + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .status( + Arrays.asList( + "available" + ) + ) + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index 8ac4affdab4..7c24f1eeaf0 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -36,7 +36,14 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.petfindbytags.Get +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.paths.petfindbytags.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -60,8 +67,19 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for queryParameters -// QueryParameters + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .tags( + Arrays.asList( + "a" + ) + ) + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index 49826b4114a..c8fdac15cb7 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -37,7 +37,14 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.petpetid.Delete +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.paths.petpetid.Delete; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -64,8 +71,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index fcc9e6a215f..63f37dc3984 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -35,7 +35,14 @@ import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.petpetid.Get +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.paths.petpetid.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -62,8 +69,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index 5ddb6d9ac34..14ea8a7fb4c 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -37,7 +37,14 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.petpetid.Post +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.paths.petpetid.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -64,8 +71,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index 9c4b21bdf23..d9eba132bb8 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -36,7 +36,14 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.petpetiduploadimage.Post +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.paths.petpetiduploadimage.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -60,8 +67,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index c825e74fcdb..fcf29e3a5e4 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -29,7 +29,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.solidus.Get +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.paths.solidus.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index f720d9ad79a..d0fee6393a1 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.storeinventory.Get +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.paths.storeinventory.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index 4ca67c80338..316a817fe75 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.storeorder.Post +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.paths.storeorder.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index 661422ba5aa..d2c1d674062 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.storeorderorderid.Delete +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.paths.storeorderorderid.Delete; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -51,8 +58,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .order_id("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index 2fdbd65816c..79b25560db9 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.storeorderorderid.Get +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.paths.storeorderorderid.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -51,8 +58,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .order_id(1L) + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index 8b077fd19ba..3d486cf1b6a 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.user.Post +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.paths.user.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index 6aee879141a..afc3194dc03 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.usercreatewitharray.Post +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.paths.usercreatewitharray.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index 1673337c8a9..8bf648688b2 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.usercreatewithlist.Post +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.paths.usercreatewithlist.Post; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index 3969bd67eca..13d9226fd5c 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.userlogin.Get +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.paths.userlogin.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -51,8 +58,18 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for queryParameters -// QueryParameters + +// Map validation +QueryParameters.QueryParametersMap = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .password("a") + + .username("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index d6a5af81285..389f0ade513 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -29,7 +29,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.userlogout.Get +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.paths.userlogout.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index bda70f8b6d4..04935f3b9a7 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.userusername.Delete +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.paths.userusername.Delete; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -51,8 +58,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index 7e084cee6b6..2e4980089af 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -32,7 +32,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.userusername.Get +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.paths.userusername.Get; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -51,8 +58,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index 15044575c36..2a6c73f963d 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -35,7 +35,14 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.paths.userusername.Put +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.paths.userusername.Put; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -56,8 +63,16 @@ Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); // todo set sample for requestBody // RequestBody -// todo set sample for pathParameters -// PathParameters + +// Map validation +PathParameters.PathParametersMap = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .username("a") + + .build(), + schemaConfiguration +); ``` ### Constructor Summary | Constructor and Description | diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index 51e1956c6f7..41c01a8ae40 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -50,7 +50,14 @@ import {{packageName}}.components.securityschemes.{{jsonPathPiece.pascalCase}}; import {{packageName}}.configurations.ApiConfiguration; import {{packageName}}.configurations.SchemaConfiguration; import {{packageName}}.configurations.JsonSchemaKeywordFlags; -import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}} +import {{{packageName}}}.schemas.validation.MapUtils; +import {{{packageName}}}.schemas.validation.FrozenList; +import {{{packageName}}}.schemas.validation.FrozenMap; +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; // if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( @@ -129,11 +136,15 @@ SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeyw {{#each builders}} {{#if @last}} {{#each keyToBuilder}} -// todo set sample for {{@key.camelCase}} {{#with property}} {{#if containerJsonPathPiece}} -// {{containerJsonPathPiece.pascalCase}} + {{#each (reverse getSchemas)}} + {{#eq instanceType "schema"}} +{{> src/main/java/packagename/components/schemas/docschema_codeSample payloadVarName=@key.camelCase configVarName="schemaConfiguration" }} + {{/eq}} + {{/each}} {{else}} +// todo set sample for {{@key.camelCase}} // {{jsonPathPiece.pascalCase}} {{/if}} {{/with}} From 71f5b1d65e4b60a6b31535d1d1cdc4e3aaa82584 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 31 Mar 2024 14:32:46 -0700 Subject: [PATCH 13/53] Fixes request body doc links --- .../components/requestbodies/RefUserArray.md | 2 +- .../anotherfakedummy/patch/RequestBody.md | 4 ++-- .../java/docs/paths/fake/get/RequestBody.md | 10 +++++----- .../java/docs/paths/fake/patch/RequestBody.md | 4 ++-- .../java/docs/paths/fake/post/RequestBody.md | 10 +++++----- .../get/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../fakebodywithfileschema/put/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../put/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../fakeclassnametest/patch/RequestBody.md | 4 ++-- .../post/RequestBody.md | 10 +++++----- .../fakeinlinecomposition/post/RequestBody.md | 20 +++++++++---------- .../paths/fakejsonformdata/get/RequestBody.md | 10 +++++----- .../paths/fakejsonpatch/patch/RequestBody.md | 10 +++++----- .../ApplicationjsonpatchjsonSchema.md | 4 ++-- .../fakejsonwithcharset/post/RequestBody.md | 4 ++-- .../post/RequestBody.md | 20 +++++++++---------- .../post/RequestBody.md | 4 ++-- .../fakepemcontenttype/get/RequestBody.md | 4 ++-- .../post/RequestBody.md | 10 +++++----- .../fakerefsarraymodel/post/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../fakerefsarrayofenums/post/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../paths/fakerefsboolean/post/RequestBody.md | 4 ++-- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../post/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../paths/fakerefsenum/post/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../paths/fakerefsmammal/post/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../paths/fakerefsnumber/post/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../post/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../paths/fakerefsstring/post/RequestBody.md | 4 ++-- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../post/RequestBody.md | 4 ++-- .../paths/fakeuploadfile/post/RequestBody.md | 10 +++++----- .../paths/fakeuploadfiles/post/RequestBody.md | 10 +++++----- .../java/docs/paths/pet/post/RequestBody.md | 4 ++-- .../java/docs/paths/pet/put/RequestBody.md | 4 ++-- .../docs/paths/petpetid/post/RequestBody.md | 10 +++++----- .../petpetiduploadimage/post/RequestBody.md | 10 +++++----- .../docs/paths/storeorder/post/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../java/docs/paths/user/post/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../usercreatewitharray/post/RequestBody.md | 4 ++-- .../usercreatewithlist/post/RequestBody.md | 4 ++-- .../paths/userusername/put/RequestBody.md | 10 +++++----- .../applicationjson/ApplicationjsonSchema.md | 4 ++-- .../DefaultGeneratorRunner.java | 4 ++-- .../requestbodies/RequestBodyDoc.hbs | 4 ++-- 57 files changed, 198 insertions(+), 198 deletions(-) diff --git a/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md b/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md index d0a1d8d650c..0cbbab8d412 100644 --- a/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md +++ b/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md @@ -12,7 +12,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RefUserArray.RefUserArray1](#refuserarray1)
class that serializes request bodies | ## RefUserArray1 -public static class RefUserArray1 extends [UserArray](../../components/requestbodies/UserArray.md#userarray1)
+public static class RefUserArray1 extends [UserArray](../../components/requestbodies/UserArray.md)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md index a4283fe34f8..aa127019744 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Client](../../components/requestbodies/Client.md) +public class RequestBody extends [Client](../../../components/requestbodies/Client.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client](../../components/requestbodies/Client.md#client1)
+public static class RequestBody1 extends [Client](../../../components/requestbodies/Client.md)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md b/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md index ecb0c751dc6..f65e52d102c 100644 --- a/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationxwwwformurlencodedMediaType public record ApplicationxwwwformurlencodedMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md index a4283fe34f8..aa127019744 100644 --- a/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Client](../../components/requestbodies/Client.md) +public class RequestBody extends [Client](../../../components/requestbodies/Client.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client](../../components/requestbodies/Client.md#client1)
+public static class RequestBody1 extends [Client](../../../components/requestbodies/Client.md)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md index a6cfa244081..0b707158f4f 100644 --- a/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationxwwwformurlencodedMediaType public record ApplicationxwwwformurlencodedMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.md index d1732bbde96..1619a3e89be 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md index 3c5d3360d21..e583d49bf2d 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [AdditionalPropertiesWithArrayOfEnums1](../../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums) +extends [AdditionalPropertiesWithArrayOfEnums1](../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](../../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) +extends [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/RequestBody.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/RequestBody.md index 3cc5e3947ba..5184498774c 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md index a3c6ea7cd01..16f5864b396 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [FileSchemaTestClass1](../../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass) +extends [FileSchemaTestClass1](../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [FileSchemaTestClass.FileSchemaTestClass1](../../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1) +extends [FileSchemaTestClass.FileSchemaTestClass1](../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/RequestBody.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/RequestBody.md index 3f13a2d8233..bbaa1842a70 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md index 3433b43b8a4..87ec51870cc 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [User1](../../../../../../../components/schemas/User.md#user) +extends [User1](../../../../../../components/schemas/User.md#user) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../../components/schemas/User.md#user1) +extends [User.User1](../../../../../../components/schemas/User.md#user1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md index a4283fe34f8..aa127019744 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Client](../../components/requestbodies/Client.md) +public class RequestBody extends [Client](../../../components/requestbodies/Client.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client](../../components/requestbodies/Client.md#client1)
+public static class RequestBody1 extends [Client](../../../components/requestbodies/Client.md)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/post/RequestBody.md index 5baadc2ff57..a7b497c88fa 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md index 7ffb61525e4..42b8f6dd39d 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md @@ -31,7 +31,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -43,12 +43,12 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -60,7 +60,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -95,34 +95,34 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/get/RequestBody.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/get/RequestBody.md index 021868e106d..e90d97b831b 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/get/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/get/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationxwwwformurlencodedMediaType public record ApplicationxwwwformurlencodedMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md index 1030df8f6d8..8f4044c6273 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonpatchjsonMediaType public record ApplicationjsonpatchjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonpatchjsonRequestBody public record ApplicationjsonpatchjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json-patch+json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonpatchjsonRequestBody(ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) body)
Creates an instance | +| ApplicationjsonpatchjsonRequestBody(ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json-patch+json" | -| ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md index d1984604169..c8f50418586 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonpatchjsonSchema public class ApplicationjsonpatchjsonSchema
-extends [JSONPatchRequest1](../../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest) +extends [JSONPatchRequest1](../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonpatchjsonSchema1 public static class ApplicationjsonpatchjsonSchema1
-extends [JSONPatchRequest.JSONPatchRequest1](../../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1) +extends [JSONPatchRequest.JSONPatchRequest1](../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md index 4d62929c09a..8e7015ce024 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## Applicationjsoncharsetutf8MediaType public record Applicationjsoncharsetutf8MediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1) | schema()
the schema for this MediaType | +| [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md index 3790fd6e579..5258ce593d8 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md @@ -31,7 +31,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -43,12 +43,12 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -60,7 +60,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -95,34 +95,34 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/post/RequestBody.md index 370a2edc196..ad5c1348c48 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/get/RequestBody.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/get/RequestBody.md index 146375fd629..b15697012da 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/get/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/get/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationxpemfileMediaType public record ApplicationxpemfileMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1) | schema()
the schema for this MediaType | +| [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md index 26648d87300..dfcea020fdb 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/RequestBody.md index 6c9a7436a02..759fe5a28e5 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[AnimalFarm1Boxed](../../../../components/schemas/AnimalFarm.md#animalfarm1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[AnimalFarm1Boxed](../../../components/schemas/AnimalFarm.md#animalfarm1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[AnimalFarm1Boxed](../../../../components/schemas/AnimalFarm.md#animalfarm1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[AnimalFarm1Boxed](../../../components/schemas/AnimalFarm.md#animalfarm1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index f4786efc35d..1418728fbd4 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [AnimalFarm1](../../../../../../../components/schemas/AnimalFarm.md#animalfarm) +extends [AnimalFarm1](../../../../../../components/schemas/AnimalFarm.md#animalfarm) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [AnimalFarm.AnimalFarm1](../../../../../../../components/schemas/AnimalFarm.md#animalfarm1) +extends [AnimalFarm.AnimalFarm1](../../../../../../components/schemas/AnimalFarm.md#animalfarm1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md index ae1cbe63ddf..8cdc705b119 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 82450aa4900..c49c361c228 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [ArrayOfEnums1](../../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums) +extends [ArrayOfEnums1](../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [ArrayOfEnums.ArrayOfEnums1](../../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums1) +extends [ArrayOfEnums.ArrayOfEnums1](../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md index 9e85a660909..6097f74bea9 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 1694ac4a00a..d0446d3d804 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [BooleanSchema1](../../../../../../../components/schemas/BooleanSchema.md#booleanschema) +extends [BooleanSchema1](../../../../../../components/schemas/BooleanSchema.md#booleanschema) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [BooleanSchema.BooleanSchema1](../../../../../../../components/schemas/BooleanSchema.md#booleanschema1) +extends [BooleanSchema.BooleanSchema1](../../../../../../components/schemas/BooleanSchema.md#booleanschema1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md index 3c736c0054a..0e61ede331b 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 1e3738551c2..6d15e5f1438 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [ComposedOneOfDifferentTypes1](../../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes) +extends [ComposedOneOfDifferentTypes1](../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](../../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) +extends [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md index 759f5de5c67..385c2e4a878 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[StringEnum1Boxed](../../../../components/schemas/StringEnum.md#stringenum1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[StringEnum1Boxed](../../../components/schemas/StringEnum.md#stringenum1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[StringEnum1Boxed](../../../../components/schemas/StringEnum.md#stringenum1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[StringEnum1Boxed](../../../components/schemas/StringEnum.md#stringenum1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 2ac02fd09b9..d83adaf246f 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [StringEnum1](../../../../../../../components/schemas/StringEnum.md#stringenum) +extends [StringEnum1](../../../../../../components/schemas/StringEnum.md#stringenum) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [StringEnum.StringEnum1](../../../../../../../components/schemas/StringEnum.md#stringenum1) +extends [StringEnum.StringEnum1](../../../../../../components/schemas/StringEnum.md#stringenum1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md index 6b08a8b5a27..64fb8aa98e1 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[Mammal1Boxed](../../../../components/schemas/Mammal.md#mammal1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[Mammal1Boxed](../../../components/schemas/Mammal.md#mammal1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[Mammal1Boxed](../../../../components/schemas/Mammal.md#mammal1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[Mammal1Boxed](../../../components/schemas/Mammal.md#mammal1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index f0a5b53544f..b1b525d94da 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [Mammal1](../../../../../../../components/schemas/Mammal.md#mammal) +extends [Mammal1](../../../../../../components/schemas/Mammal.md#mammal) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [Mammal.Mammal1](../../../../../../../components/schemas/Mammal.md#mammal1) +extends [Mammal.Mammal1](../../../../../../components/schemas/Mammal.md#mammal1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md index 22ca5825b4d..bf52e31b42d 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index a903474b2ee..a6a485e5657 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [NumberWithValidations1](../../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations) +extends [NumberWithValidations1](../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [NumberWithValidations.NumberWithValidations1](../../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1) +extends [NumberWithValidations.NumberWithValidations1](../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md index 6d81f6580ca..fa402eba521 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 495e07e6094..0cdc2140e3a 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [ObjectModelWithRefProps1](../../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops) +extends [ObjectModelWithRefProps1](../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [ObjectModelWithRefProps.ObjectModelWithRefProps1](../../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) +extends [ObjectModelWithRefProps.ObjectModelWithRefProps1](../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md index 546531f6ffd..dadb1fcd877 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 8fadd779761..abe4f0713c9 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [StringSchema1](../../../../../../../components/schemas/StringSchema.md#stringschema) +extends [StringSchema1](../../../../../../components/schemas/StringSchema.md#stringschema) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [StringSchema.StringSchema1](../../../../../../../components/schemas/StringSchema.md#stringschema1) +extends [StringSchema.StringSchema1](../../../../../../components/schemas/StringSchema.md#stringschema1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/post/RequestBody.md index 008291f2580..f031c76d24d 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationoctetstreamMediaType public record ApplicationoctetstreamMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1) | schema()
the schema for this MediaType | +| [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md index 50e947003b9..bd73b367e08 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md index 2f0056fe248..0b3ec075d2c 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md b/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md index da70cdc38c1..ca0e394f8a2 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Pet](../../components/requestbodies/Pet.md) +public class RequestBody extends [Pet](../../../components/requestbodies/Pet.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Pet](../../components/requestbodies/Pet.md#pet1)
+public static class RequestBody1 extends [Pet](../../../components/requestbodies/Pet.md)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md b/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md index da70cdc38c1..ca0e394f8a2 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Pet](../../components/requestbodies/Pet.md) +public class RequestBody extends [Pet](../../../components/requestbodies/Pet.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Pet](../../components/requestbodies/Pet.md#pet1)
+public static class RequestBody1 extends [Pet](../../../components/requestbodies/Pet.md)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md b/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md index 37eadc5c54d..672ae8e9af1 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationxwwwformurlencodedMediaType public record ApplicationxwwwformurlencodedMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md index c5faf95b33b..d65d0664340 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md b/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md index 64d7782838d..98ae13f9473 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[Order1Boxed](../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[Order1Boxed](../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index e069f9c21c8..25524457185 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [Order1](../../../../../../../components/schemas/Order.md#order) +extends [Order1](../../../../../../components/schemas/Order.md#order) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [Order.Order1](../../../../../../../components/schemas/Order.md#order1) +extends [Order.Order1](../../../../../../components/schemas/Order.md#order1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/user/post/RequestBody.md b/samples/client/petstore/java/docs/paths/user/post/RequestBody.md index bffc9b8065b..5717d3014a3 100644 --- a/samples/client/petstore/java/docs/paths/user/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/user/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 3433b43b8a4..87ec51870cc 100644 --- a/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [User1](../../../../../../../components/schemas/User.md#user) +extends [User1](../../../../../../components/schemas/User.md#user) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../../components/schemas/User.md#user1) +extends [User.User1](../../../../../../components/schemas/User.md#user1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md index 33628aac017..1802770580d 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [UserArray](../../components/requestbodies/UserArray.md) +public class RequestBody extends [UserArray](../../../components/requestbodies/UserArray.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [UserArray](../../components/requestbodies/UserArray.md#userarray1)
+public static class RequestBody1 extends [UserArray](../../../components/requestbodies/UserArray.md)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md index 63751df47b6..745b6abfabb 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [RefUserArray](../../components/requestbodies/RefUserArray.md) +public class RequestBody extends [RefUserArray](../../../components/requestbodies/RefUserArray.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [RefUserArray](../../components/requestbodies/RefUserArray.md#refuserarray1)
+public static class RequestBody1 extends [RefUserArray](../../../components/requestbodies/RefUserArray.md)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/userusername/put/RequestBody.md b/samples/client/petstore/java/docs/paths/userusername/put/RequestBody.md index 2c9a8f2bfb8..d5acae4f843 100644 --- a/samples/client/petstore/java/docs/paths/userusername/put/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/userusername/put/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md index 3433b43b8a4..87ec51870cc 100644 --- a/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [User1](../../../../../../../components/schemas/User.md#user) +extends [User1](../../../../../../components/schemas/User.md#user) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../../components/schemas/User.md#user1) +extends [User.User1](../../../../../../components/schemas/User.md#user1) A schema class that validates payloads diff --git a/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java b/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java index 78a2bb2c398..46742e3d501 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java +++ b/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java @@ -504,8 +504,8 @@ private void generatePathItem(List files, CodegenKey pathKey, CodegenPathI // paths.some_path.post.request_body.py, only written if there is no refModule if (operation.requestBody != null) { String requestBodyJsonPath = operationJsonPath + "/requestBody"; - generateRequestBody(files, operation.requestBody, requestBodyJsonPath, "../../../../"); - generateRequestBodyDoc(files, operation.requestBody, requestBodyJsonPath, "../../../../", generator.shouldGenerateFile(requestBodyJsonPath, true)); + generateRequestBody(files, operation.requestBody, requestBodyJsonPath, "../../../"); + generateRequestBodyDoc(files, operation.requestBody, requestBodyJsonPath, "../../../", generator.shouldGenerateFile(requestBodyJsonPath, true)); } if (operation.servers != null) { diff --git a/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBodyDoc.hbs b/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBodyDoc.hbs index ec4eced6d0b..6f70b85571c 100644 --- a/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBodyDoc.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBodyDoc.hbs @@ -9,7 +9,7 @@ {{/if}} {{#if refInfo}} -public class {{jsonPathPiece.pascalCase}} extends [{{refInfo.refClass}}](../../components/requestbodies/{{refInfo.refClass}}.md) +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 @@ -20,7 +20,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/java/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that serializes request bodies | {{> src/main/java/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/requestbodies/{{refInfo.refClass}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}1)
+public static class {{jsonPathPiece.pascalCase}}1 extends [{{refInfo.refClass}}]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md)
a class that serializes SealedRequestBody request bodies, extended from the $ref class From 6447c33f675feaaf1fdcbad6d96479ddd10369e7 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 31 Mar 2024 15:07:07 -0700 Subject: [PATCH 14/53] Fixes request body path query header cookie variable name for code sample --- .../components/requestbodies/RefUserArray.md | 2 +- .../anotherfakedummy/patch/RequestBody.md | 2 +- .../docs/paths/commonparamsubdir/Delete.md | 2 +- .../java/docs/paths/commonparamsubdir/Get.md | 2 +- .../java/docs/paths/commonparamsubdir/Post.md | 2 +- .../petstore/java/docs/paths/fake/Delete.md | 4 +-- .../petstore/java/docs/paths/fake/Get.md | 4 +-- .../java/docs/paths/fake/patch/RequestBody.md | 2 +- .../docs/paths/fakebodywithqueryparams/Put.md | 2 +- .../docs/paths/fakecasesensitiveparams/Put.md | 2 +- .../fakeclassnametest/patch/RequestBody.md | 2 +- .../docs/paths/fakedeletecoffeeid/Delete.md | 2 +- .../docs/paths/fakeinlinecomposition/Post.md | 2 +- .../java/docs/paths/fakeobjinquery/Get.md | 2 +- .../Post.md | 2 +- .../Post.md | 2 +- .../fakequeryparamwithjsoncontenttype/Get.md | 2 +- .../java/docs/paths/fakerefobjinquery/Get.md | 2 +- .../docs/paths/faketestqueryparamters/Put.md | 2 +- .../java/docs/paths/pet/post/RequestBody.md | 2 +- .../java/docs/paths/pet/put/RequestBody.md | 2 +- .../java/docs/paths/petfindbystatus/Get.md | 2 +- .../java/docs/paths/petfindbytags/Get.md | 2 +- .../java/docs/paths/petpetid/Delete.md | 2 +- .../petstore/java/docs/paths/petpetid/Get.md | 2 +- .../petstore/java/docs/paths/petpetid/Post.md | 2 +- .../docs/paths/petpetiduploadimage/Post.md | 2 +- .../docs/paths/storeorderorderid/Delete.md | 2 +- .../java/docs/paths/storeorderorderid/Get.md | 2 +- .../usercreatewitharray/post/RequestBody.md | 2 +- .../usercreatewithlist/post/RequestBody.md | 2 +- .../petstore/java/docs/paths/userlogin/Get.md | 2 +- .../java/docs/paths/userusername/Delete.md | 2 +- .../java/docs/paths/userusername/Get.md | 2 +- .../java/docs/paths/userusername/Put.md | 2 +- .../requestbodies/RequestBodyDoc.hbs | 2 +- .../schemas/docschema_codeSample.hbs | 28 +++++++++---------- .../path/verb/_OperationDocCodeSample.hbs | 2 +- 38 files changed, 53 insertions(+), 53 deletions(-) diff --git a/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md b/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md index 0cbbab8d412..dbe40f61ba7 100644 --- a/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md +++ b/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md @@ -12,7 +12,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RefUserArray.RefUserArray1](#refuserarray1)
class that serializes request bodies | ## RefUserArray1 -public static class RefUserArray1 extends [UserArray](../../components/requestbodies/UserArray.md)
+public static class RefUserArray1 extends [UserArray1](../../components/requestbodies/UserArray.md#userarray1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md index aa127019744..72d0a1a3ced 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client](../../../components/requestbodies/Client.md)
+public static class RequestBody1 extends [Client1](../../../components/requestbodies/Client.md#client1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index 5807a67b7cb..40a4a188ddc 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -61,7 +61,7 @@ Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfigurat // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .subDir("c") diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index 07d07eb66c7..398f4f9ce3c 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -61,7 +61,7 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .subDir("a") diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index 037b0db1b02..e5c45b2134c 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -61,7 +61,7 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .subDir("a") diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index 55be5ebd9ac..473efd4c831 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -74,7 +74,7 @@ Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfigurat // Map validation -HeaderParameters.HeaderParametersMap = +HeaderParameters.HeaderParametersMap headerParameters = HeaderParameters.HeaderParameters1.validate( new HeaderParameters.HeaderParametersMapBuilder() .required_boolean_group("true") @@ -86,7 +86,7 @@ HeaderParameters.HeaderParametersMap = ); // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .required_int64_group(1L) diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index b788b1ecbde..4a07833baee 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -62,7 +62,7 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // RequestBody // Map validation -HeaderParameters.HeaderParametersMap = +HeaderParameters.HeaderParametersMap headerParameters = HeaderParameters.HeaderParameters1.validate( new HeaderParameters.HeaderParametersMapBuilder() .enum_header_string("_abc") @@ -77,7 +77,7 @@ HeaderParameters.HeaderParametersMap = ); // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .enum_query_double(3.14d) diff --git a/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md index aa127019744..72d0a1a3ced 100644 --- a/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client](../../../components/requestbodies/Client.md)
+public static class RequestBody1 extends [Client1](../../../components/requestbodies/Client.md#client1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index aff2d14aeea..43969b09ce7 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -65,7 +65,7 @@ Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); // RequestBody // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .query("a") diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index 7f29d042948..fb8ace3ec94 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -60,7 +60,7 @@ Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .SomeVar("a") diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md index aa127019744..72d0a1a3ced 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client](../../../components/requestbodies/Client.md)
+public static class RequestBody1 extends [Client1](../../../components/requestbodies/Client.md#client1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index 43418fac3b7..4ed40390eed 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -60,7 +60,7 @@ Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfigurat // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .id("a") diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 5d097c3c9d4..77c1e3902bb 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -61,7 +61,7 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // RequestBody // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .compositionInProperty( diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index cbf04f3fce0..73cd111c120 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -58,7 +58,7 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .mapBean( diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index 63ffc3b1e37..f21c5eb5d38 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -64,7 +64,7 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .positive1("a") diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index cea9d608338..96fe6717ba7 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -69,7 +69,7 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .petId(1L) diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index 29ee7839b83..fab70f007ef 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -60,7 +60,7 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .build(), diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index 032862b1c20..c2083108e02 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -58,7 +58,7 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .mapBean( diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index 31138db274b..9a6eac63454 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -60,7 +60,7 @@ Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .context( diff --git a/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md b/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md index ca0e394f8a2..ee81d9d563b 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Pet](../../../components/requestbodies/Pet.md)
+public static class RequestBody1 extends [Pet1](../../../components/requestbodies/Pet.md#pet1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md b/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md index ca0e394f8a2..ee81d9d563b 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Pet](../../../components/requestbodies/Pet.md)
+public static class RequestBody1 extends [Pet1](../../../components/requestbodies/Pet.md#pet1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 0f26389cc3c..315c0c13056 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -71,7 +71,7 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .status( diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index 7c24f1eeaf0..65ee522fca8 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -69,7 +69,7 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .tags( diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index c8fdac15cb7..0285b28bd00 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -73,7 +73,7 @@ Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfigurat // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .petId(1L) diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index 63f37dc3984..24912dd7ed9 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -71,7 +71,7 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .petId(1L) diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index 14ea8a7fb4c..881d6ada698 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -73,7 +73,7 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .petId(1L) diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index d9eba132bb8..8d8159b7e75 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -69,7 +69,7 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .petId(1L) diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index d2c1d674062..a895ebd04b2 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -60,7 +60,7 @@ Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfigurat // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .order_id("a") diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index 79b25560db9..94210812836 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -60,7 +60,7 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .order_id(1L) diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md index 1802770580d..c3f2cf9f53e 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [UserArray](../../../components/requestbodies/UserArray.md)
+public static class RequestBody1 extends [UserArray1](../../../components/requestbodies/UserArray.md#userarray1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md index 745b6abfabb..8a4cde3614a 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [RefUserArray](../../../components/requestbodies/RefUserArray.md)
+public static class RequestBody1 extends [RefUserArray1](../../../components/requestbodies/RefUserArray.md#refuserarray1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index 13d9226fd5c..3c68e316cea 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -60,7 +60,7 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // Map validation -QueryParameters.QueryParametersMap = +QueryParameters.QueryParametersMap queryParameters = QueryParameters.QueryParameters1.validate( new QueryParameters.QueryParametersMapBuilder() .password("a") diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index 04935f3b9a7..03cf74241b6 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -60,7 +60,7 @@ Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfigurat // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .username("a") diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index 2e4980089af..20091f107c4 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -60,7 +60,7 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .username("a") diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index 2a6c73f963d..472aecde756 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -65,7 +65,7 @@ Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); // RequestBody // Map validation -PathParameters.PathParametersMap = +PathParameters.PathParametersMap pathParameters = PathParameters.PathParameters1.validate( new PathParameters.PathParametersMapBuilder() .username("a") diff --git a/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBodyDoc.hbs b/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBodyDoc.hbs index 6f70b85571c..6b430b1bd32 100644 --- a/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBodyDoc.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBodyDoc.hbs @@ -20,7 +20,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/java/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that serializes request bodies | {{> src/main/java/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}}]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md)
+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 diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/docschema_codeSample.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/docschema_codeSample.hbs index 55c9cf6500b..133688dabb5 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/docschema_codeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/docschema_codeSample.hbs @@ -2,63 +2,63 @@ {{#eq @key "null"}} // null validation -Void {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +Void {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} {{#eq @key "object"}} {{#if ../mapOutputJsonPathPiece}} // Map validation -{{../../../containerJsonPathPiece.pascalCase}}.{{../mapOutputJsonPathPiece.pascalCase}} {{payloadVarName}} = +{{../../../containerJsonPathPiece.pascalCase}}.{{../mapOutputJsonPathPiece.pascalCase}} {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} // Map validation -FrozenMap {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +FrozenMap {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{/if}} {{else}} {{#eq @key "array"}} {{#if ../arrayOutputJsonPathPiece}} // List validation -{{../../../containerJsonPathPiece.pascalCase}}.{{../arrayOutputJsonPathPiece.pascalCase}} {{payloadVarName}} = +{{../../../containerJsonPathPiece.pascalCase}}.{{../arrayOutputJsonPathPiece.pascalCase}} {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} // List validation -FrozenList {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +FrozenList {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{/if}} {{else}} {{#eq @key "string" }} // String validation -String {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +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( +long {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} // int validation -int {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +int {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{/or}} {{else}} {{#eq @key "number"}} {{#eq ../format "int64"}} // long validation -long {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +long {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} {{#eq ../format "float"}} // float validation -float {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +float {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} {{#eq ../format "double"}} // double validation -double {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +double {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{else}} // int validation -int {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +int {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{/eq}} {{/eq}} {{/eq}} {{else}} {{#eq @key "boolean"}} // boolean validation -boolean {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +boolean {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( {{/eq}} {{/eq}} {{/eq}} @@ -81,6 +81,6 @@ boolean {{payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{.. {{/and}} {{/and}} {{/with}} - {{configVarName}} + {{../configVarName}} ); {{/each}} \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index 41c01a8ae40..c9469d6b2c4 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -140,7 +140,7 @@ SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeyw {{#if containerJsonPathPiece}} {{#each (reverse getSchemas)}} {{#eq instanceType "schema"}} -{{> src/main/java/packagename/components/schemas/docschema_codeSample payloadVarName=@key.camelCase configVarName="schemaConfiguration" }} +{{> src/main/java/packagename/components/schemas/docschema_codeSample payloadVarName=../@key.camelCase configVarName="schemaConfiguration" }} {{/eq}} {{/each}} {{else}} From fa2aa7b07c38e1863ed2e0b5363e7e3c91442b6b Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 1 Apr 2024 12:17:00 -0700 Subject: [PATCH 15/53] Adds requestBoud samples in operation code sample --- .../java/docs/paths/anotherfakedummy/Patch.md | 14 ++- .../petstore/java/docs/paths/fake/Get.md | 23 +++-- .../petstore/java/docs/paths/fake/Patch.md | 14 ++- .../petstore/java/docs/paths/fake/Post.md | 46 ++++++++-- .../Get.md | 22 +++-- .../docs/paths/fakebodywithfileschema/Put.md | 16 +++- .../docs/paths/fakebodywithqueryparams/Put.md | 30 ++++++- .../docs/paths/fakeclassnametest/Patch.md | 14 ++- .../java/docs/paths/fakehealth/Get.md | 4 - .../fakeinlineadditionalproperties/Post.md | 14 ++- .../docs/paths/fakeinlinecomposition/Post.md | 8 +- .../java/docs/paths/fakejsonformdata/Get.md | 20 +++-- .../java/docs/paths/fakejsonpatch/Patch.md | 16 ++-- .../docs/paths/fakejsonwithcharset/Post.md | 8 +- .../Post.md | 18 ++-- .../paths/fakemultipleresponsebodies/Get.md | 4 - .../docs/paths/fakemultiplesecurities/Get.md | 6 -- .../java/docs/paths/fakeobjinquery/Get.md | 4 - .../java/docs/paths/fakepemcontenttype/Get.md | 14 +-- .../java/docs/paths/fakeredirection/Get.md | 4 - .../java/docs/paths/fakerefobjinquery/Get.md | 4 - .../docs/paths/fakerefsarraymodel/Post.md | 28 ++++-- .../docs/paths/fakerefsarrayofenums/Post.md | 18 ++-- .../java/docs/paths/fakerefsboolean/Post.md | 14 +-- .../Post.md | 8 +- .../java/docs/paths/fakerefsenum/Post.md | 20 +++-- .../java/docs/paths/fakerefsmammal/Post.md | 4 +- .../java/docs/paths/fakerefsnumber/Post.md | 14 +-- .../fakerefsobjectmodelwithrefprops/Post.md | 16 ++-- .../java/docs/paths/fakerefsstring/Post.md | 14 +-- .../paths/fakeresponsewithoutschema/Get.md | 4 - .../docs/paths/fakeuploaddownloadfile/Post.md | 10 ++- .../java/docs/paths/fakeuploadfile/Post.md | 20 +++-- .../java/docs/paths/fakeuploadfiles/Post.md | 21 +++-- .../docs/paths/fakewildcardresponses/Get.md | 4 - .../petstore/java/docs/paths/foo/Get.md | 4 - .../petstore/java/docs/paths/pet/Post.md | 45 +++++++++- .../petstore/java/docs/paths/pet/Put.md | 45 +++++++++- .../petstore/java/docs/paths/solidus/Get.md | 4 - .../java/docs/paths/storeinventory/Get.md | 6 -- .../java/docs/paths/storeorder/Post.md | 24 +++++- .../petstore/java/docs/paths/user/Post.md | 30 ++++++- .../docs/paths/usercreatewitharray/Post.md | 52 ++++++++++- .../docs/paths/usercreatewithlist/Post.md | 52 ++++++++++- .../java/docs/paths/userlogout/Get.md | 4 - .../java/docs/paths/userusername/Put.md | 30 ++++++- .../openapimodels/CodegenSchema.java | 1 + .../components/schemas/Schema_doc.hbs | 2 +- .../validateAndBoxSchemaCodeSample.hbs | 86 +++++++++++++++++++ ...ample.hbs => validateSchemaCodeSample.hbs} | 0 .../path/verb/_OperationDocCodeSample.hbs | 18 +++- 51 files changed, 699 insertions(+), 202 deletions(-) create mode 100644 src/main/resources/java/src/main/java/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs rename src/main/resources/java/src/main/java/packagename/components/schemas/{docschema_codeSample.hbs => validateSchemaCodeSample.hbs} (100%) diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index a68925fbace..46754ac238c 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -58,8 +58,18 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index 4a07833baee..1c23a242d95 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -58,8 +58,23 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +ApplicationxwwwformurlencodedSchema1BoxedMap requestBodyPayload = + ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validateAndBox( + new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() + .enum_form_string_array( + Arrays.asList( + ">" + ) + ) + .enum_form_string("_abc") + + .build(), + schemaConfiguration +); +Get.SealedRequestBody requestBody = new Get.ApplicationxwwwformurlencodedRequestBody(requestBodyPayload); // Map validation HeaderParameters.HeaderParametersMap headerParameters = @@ -94,10 +109,6 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index 6e551d80f35..1b9bde15db7 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -58,8 +58,18 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index cc5f85804a8..94dcd6db6da 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -67,14 +67,44 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for securityIndex -// FakePostSecurityInfo -// todo set sample for timeout -// Post +// todo add this import + +// Map validation +ApplicationxwwwformurlencodedSchema1BoxedMap requestBodyPayload = + ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validateAndBox( + new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() + .setByte("a") + + .setDouble(3.14d) + + .setNumber(1) + + .pattern_without_delimiter("AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>") + + .setInteger(1) + + .int32(1) + + .int64(1L) + + .setFloat(3.14f) + + .setString("A") + + .binary("a") + + .date("2020-12-13") + + .dateTime("1970-01-01T00:00:00.00Z") + + .password("a") + + .callback("a") + + .build(), + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationxwwwformurlencodedRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index d8412467662..aba15f58481 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -56,12 +56,22 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get +// todo add this import + +// Map validation +AdditionalPropertiesWithArrayOfEnums1BoxedMap requestBodyPayload = + AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1.validateAndBox( + new AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnumsMapBuilder() + .additionalProperty( + "someAdditionalProperty", + Arrays.asList( + "_abc" + ) + ) + .build(), + schemaConfiguration +); +Get.SealedRequestBody requestBody = new Get.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index 70e473445e5..4fdfa9f3132 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -58,8 +58,20 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +FileSchemaTestClass1BoxedMap requestBodyPayload = + FileSchemaTestClass.FileSchemaTestClass1.validateAndBox( + new FileSchemaTestClass.FileSchemaTestClassMapBuilder() + .files( + Arrays.asList( + ) + ) + .build(), + schemaConfiguration +); +Put.SealedRequestBody requestBody = new Put.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index 43969b09ce7..24e55483d40 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -61,8 +61,34 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +User1BoxedMap requestBodyPayload = + User.User1.validateAndBox( + new User.UserMapBuilder() + .id(1L) + + .username("a") + + .firstName("a") + + .lastName("a") + + .email("a") + + .password("a") + + .phone("a") + + .userStatus(1) + + .objectWithNoDeclaredPropsNullable(null) + + .build(), + schemaConfiguration +); +Put.SealedRequestBody requestBody = new Put.ApplicationjsonRequestBody(requestBodyPayload); // Map validation QueryParameters.QueryParametersMap queryParameters = diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index fc1e84f2f99..58d5dcd4598 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -69,8 +69,18 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index 57d69a17720..5c0e3492caa 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -55,10 +55,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index b4191147154..4eb29e181f1 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -58,8 +58,18 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +ApplicationjsonSchema1BoxedMap requestBodyPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( + new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() + .additionalProperty("someAdditionalProperty", "a") + + .build(), + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 77c1e3902bb..4f742fbc4f0 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -57,8 +57,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); // Map validation QueryParameters.QueryParametersMap queryParameters = @@ -71,10 +71,6 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index f0a320b104d..e3a29b2f017 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -56,12 +56,20 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get +// todo add this import + +// Map validation +ApplicationxwwwformurlencodedSchema1BoxedMap requestBodyPayload = + ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validateAndBox( + new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() + .param("a") + + .param2("a") + + .build(), + schemaConfiguration +); +Get.SealedRequestBody requestBody = new Get.ApplicationxwwwformurlencodedRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index 69f80f6ea16..b9410c4d7e8 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -56,12 +56,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Patch +// todo add this import + +// List validation +JSONPatchRequest1BoxedList requestBodyPayload = + JSONPatchRequest.JSONPatchRequest1.validateAndBox( + new JSONPatchRequest.JSONPatchRequestListBuilder() + .build(), + schemaConfiguration +); +Patch.SealedRequestBody requestBody = new Patch.ApplicationjsonpatchjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index 1dcaef173ff..55b31bdf96c 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -56,12 +56,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import +Post.SealedRequestBody requestBody = new Post.Applicationjsoncharsetutf8RequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 4d61d318494..610b8065f2a 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -56,12 +56,18 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import + +// Map validation +ApplicationjsonSchema1BoxedMap requestBodyPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( + new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() + .a("a") + + .build(), + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index 75910090026..f4faca105fd 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -55,10 +55,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index fcbd5af5c6b..a62cfbf0fa0 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -71,12 +71,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for securityIndex -// FakemultiplesecuritiesGetSecurityInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index 73cd111c120..353e5d3855e 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -72,10 +72,6 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index 41fbaf3107c..142f2cdbd8c 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -56,12 +56,14 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get +// todo add this import + +// String validation +ApplicationxpemfileSchema1BoxedString requestBodyPayload = ApplicationxpemfileSchema.ApplicationxpemfileSchema1.validateAndBox( + "a", + schemaConfiguration +); +Get.SealedRequestBody requestBody = new Get.ApplicationxpemfileRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index 8f0654bf2fa..55ee2d26c84 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -55,10 +55,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index c2083108e02..4a63c4d93d2 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -72,10 +72,6 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index e795fcb3a8f..5184a2e06b2 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -56,12 +56,28 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import + +// List validation +AnimalFarm1BoxedList requestBodyPayload = + AnimalFarm.AnimalFarm1.validateAndBox( + new AnimalFarm.AnimalFarmListBuilder() + .add( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "className", + "a" + ), + new AbstractMap.SimpleEntry( + "color", + "a" + ) + ) + ) + .build(), + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index aadedc2d983..697d751e7b8 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -56,12 +56,18 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import + +// List validation +ArrayOfEnums1BoxedList requestBodyPayload = + ArrayOfEnums.ArrayOfEnums1.validateAndBox( + new ArrayOfEnums.ArrayOfEnumsListBuilder() + .add((Void) null) + + .build(), + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index 34b1325bfa3..782119ace3f 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -56,12 +56,14 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import + +// boolean validation +BooleanSchema1BoxedBoolean requestBodyPayload = BooleanSchema.BooleanSchema1.validateAndBox( + true, + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index afa86335db3..3ff614d3358 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -56,12 +56,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index 00a4a3a414a..70fedc57c6d 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -56,12 +56,20 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import + +// null validation +StringEnum1BoxedVoid requestBodyPayload = StringEnum.StringEnum1.validateAndBox( + (Void) null, + schemaConfiguration +); + +// String validation +StringEnum1BoxedString requestBodyPayload = StringEnum.StringEnum1.validateAndBox( + "placed", + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index fb6c73bcccb..9f1d20080dd 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -58,8 +58,8 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index b1c20dbc620..1ca1c885fe3 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -56,12 +56,14 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import + +// int validation +NumberWithValidations1BoxedNumber requestBodyPayload = NumberWithValidations.NumberWithValidations1.validateAndBox( + 1, + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index f2691423bc1..2fae2d19203 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -56,12 +56,16 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import + +// Map validation +ObjectModelWithRefProps1BoxedMap requestBodyPayload = + ObjectModelWithRefProps.ObjectModelWithRefProps1.validateAndBox( + new ObjectModelWithRefProps.ObjectModelWithRefPropsMapBuilder() + .build(), + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 62a0f5cc484..7f722249d1f 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -56,12 +56,14 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import + +// String validation +StringSchema1BoxedString requestBodyPayload = StringSchema.StringSchema1.validateAndBox( + "a", + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index 2159f030d88..c5f1005813b 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -55,10 +55,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index d4d8a7ea1c3..4c26390fcff 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -58,8 +58,14 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// String validation +ApplicationoctetstreamSchema1BoxedString requestBodyPayload = ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.validateAndBox( + "a", + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationoctetstreamRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index 30aa9fbd00b..1b55fd49ef8 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -56,12 +56,20 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import + +// Map validation +MultipartformdataSchema1BoxedMap requestBodyPayload = + MultipartformdataSchema.MultipartformdataSchema1.validateAndBox( + new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() + .file("a") + + .additionalMetadata("a") + + .build(), + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.MultipartformdataRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index 2e10773f656..1330b7037cf 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -56,12 +56,21 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Post +// todo add this import + +// Map validation +MultipartformdataSchema1BoxedMap requestBodyPayload = + MultipartformdataSchema.MultipartformdataSchema1.validateAndBox( + new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() + .files( + Arrays.asList( + "a" + ) + ) + .build(), + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.MultipartformdataRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index 7dc055e3353..d52dc82e796 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -55,10 +55,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index c03f55ce87c..64520d83a76 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -53,10 +53,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for serverIndex -// FooGetServerInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index 6f7ec515d63..39a78811e47 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -71,8 +71,49 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +Pet1BoxedMap requestBodyPayload = + Pet.Pet1.validateAndBox( + new Pet.PetMapBuilder() + .name("a") + + .photoUrls( + Arrays.asList( + "a" + ) + ) + .id(1L) + + .category( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ), + new AbstractMap.SimpleEntry( + "id", + 1L + ) + ) + ) + .tags( + Arrays.asList( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ) + ) + ) + ) + .status("available") + + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index f07b8bcf90b..eb00084b95e 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -67,8 +67,49 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +Pet1BoxedMap requestBodyPayload = + Pet.Pet1.validateAndBox( + new Pet.PetMapBuilder() + .name("a") + + .photoUrls( + Arrays.asList( + "a" + ) + ) + .id(1L) + + .category( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ), + new AbstractMap.SimpleEntry( + "id", + 1L + ) + ) + ) + .tags( + Arrays.asList( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ) + ) + ) + ) + .status("available") + + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index fcf29e3a5e4..72c88761357 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -55,10 +55,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index d0fee6393a1..16f24de522d 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -66,12 +66,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for securityIndex -// StoreinventoryGetSecurityInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index 316a817fe75..6fd2f606293 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -58,8 +58,28 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +Order1BoxedMap requestBodyPayload = + Order.Order1.validateAndBox( + new Order.OrderMapBuilder() + .id(1L) + + .petId(1L) + + .quantity(1) + + .shipDate("1970-01-01T00:00:00.00Z") + + .status("placed") + + .complete(true) + + .build(), + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index 3d486cf1b6a..d21b72978f8 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -58,8 +58,34 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +User1BoxedMap requestBodyPayload = + User.User1.validateAndBox( + new User.UserMapBuilder() + .id(1L) + + .username("a") + + .firstName("a") + + .lastName("a") + + .email("a") + + .password("a") + + .phone("a") + + .userStatus(1) + + .objectWithNoDeclaredPropsNullable(null) + + .build(), + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index afc3194dc03..82907a389d3 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -58,8 +58,56 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// List validation +ApplicationjsonSchema1BoxedList requestBodyPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( + new ApplicationjsonSchema.ApplicationjsonSchemaListBuilder() + .add( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "id", + 1L + ), + new AbstractMap.SimpleEntry( + "username", + "a" + ), + new AbstractMap.SimpleEntry( + "firstName", + "a" + ), + new AbstractMap.SimpleEntry( + "lastName", + "a" + ), + new AbstractMap.SimpleEntry( + "email", + "a" + ), + new AbstractMap.SimpleEntry( + "password", + "a" + ), + new AbstractMap.SimpleEntry( + "phone", + "a" + ), + new AbstractMap.SimpleEntry( + "userStatus", + 1 + ), + new AbstractMap.SimpleEntry( + "objectWithNoDeclaredPropsNullable", + null + ) + ) + ) + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index 8bf648688b2..24c9c0336b0 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -58,8 +58,56 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// List validation +ApplicationjsonSchema1BoxedList requestBodyPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( + new ApplicationjsonSchema.ApplicationjsonSchemaListBuilder() + .add( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "id", + 1L + ), + new AbstractMap.SimpleEntry( + "username", + "a" + ), + new AbstractMap.SimpleEntry( + "firstName", + "a" + ), + new AbstractMap.SimpleEntry( + "lastName", + "a" + ), + new AbstractMap.SimpleEntry( + "email", + "a" + ), + new AbstractMap.SimpleEntry( + "password", + "a" + ), + new AbstractMap.SimpleEntry( + "phone", + "a" + ), + new AbstractMap.SimpleEntry( + "userStatus", + 1 + ), + new AbstractMap.SimpleEntry( + "objectWithNoDeclaredPropsNullable", + null + ) + ) + ) + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index 389f0ade513..2b29c71b886 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -55,10 +55,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo set sample for serverIndex -// RootServerInfo -// todo set sample for timeout -// Get ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index 472aecde756..1a839bcec81 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -61,8 +61,34 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); -// todo set sample for requestBody -// RequestBody +// todo add this import + +// Map validation +User1BoxedMap requestBodyPayload = + User.User1.validateAndBox( + new User.UserMapBuilder() + .id(1L) + + .username("a") + + .firstName("a") + + .lastName("a") + + .email("a") + + .password("a") + + .phone("a") + + .userStatus(1) + + .objectWithNoDeclaredPropsNullable(null) + + .build(), + schemaConfiguration +); +Put.SealedRequestBody requestBody = new Put.ApplicationjsonRequestBody(requestBodyPayload); // Map validation PathParameters.PathParametersMap pathParameters = diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenSchema.java b/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenSchema.java index 24724279262..fdb78838a27 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenSchema.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenSchema.java @@ -942,6 +942,7 @@ protected void addInstanceInfo(StringBuilder sb) { sb.append(", instanceType=").append(instanceType); sb.append(", jsonPath=").append(jsonPath); sb.append(", arrayOutputJsonPathPiece=").append(arrayOutputJsonPathPiece); + sb.append(", typeToExample=").append(typeToExample); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/Schema_doc.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/Schema_doc.hbs index 6c6097ed863..9f1f33ad456 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/Schema_doc.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/Schema_doc.hbs @@ -149,7 +149,7 @@ import java.util.List; import java.util.AbstractMap; static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -{{> src/main/java/packagename/components/schemas/docschema_codeSample payloadVarName="validatedPayload" configVarName="configuration" }} +{{> src/main/java/packagename/components/schemas/validateSchemaCodeSample payloadVarName="validatedPayload" configVarName="configuration" }} ``` {{/if}} diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs new file mode 100644 index 00000000000..49aba4b3080 --- /dev/null +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs @@ -0,0 +1,86 @@ + {{#each typeToExample}} + +{{#eq @key "null"}} +// null validation +{{../jsonPathPiece.pascalCase}}BoxedVoid {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( +{{else}} + {{#eq @key "object"}} + {{#if ../mapOutputJsonPathPiece}} +// Map validation +{{../jsonPathPiece.pascalCase}}BoxedMap {{../payloadVarName}} = + {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +// Map validation +{{../jsonPathPiece.pascalCase}}BoxedMap {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/if}} + {{else}} + {{#eq @key "array"}} + {{#if ../arrayOutputJsonPathPiece}} +// List validation +{{../jsonPathPiece.pascalCase}}BoxedList {{../payloadVarName}} = + {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +// List validation +{{../jsonPathPiece.pascalCase}}BoxedList {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/if}} + {{else}} + {{#eq @key "string" }} +// String validation +{{../jsonPathPiece.pascalCase}}BoxedString {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} + {{#eq @key "integer"}} + {{#or (eq ../format null) (eq ../format "int64") }} +// long validation +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +// int validation +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/or}} + {{else}} + {{#eq @key "number"}} + {{#eq ../format "int64"}} +// long validation +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} + {{#eq ../format "float"}} +// float validation +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} + {{#eq ../format "double"}} +// double validation +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +// int validation +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq @key "boolean"}} +// boolean validation +{{../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/java/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=true }} + .build(), + {{else}} + {{#and (eq type "object") ../mapInputJsonPathPiece.pascalCase }} + new {{../containerJsonPathPiece.pascalCase}}.{{../mapInputJsonPathPiece.pascalCase}}() + {{> src/main/java/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=true optionalProperties=../optionalProperties requiredProperties=../requiredProperties }} + .build(), + {{else}} + {{> src/main/java/packagename/components/schemas/helpers/payload_renderer endChar="," }} + {{/and}} + {{/and}} + {{/with}} + {{../configVarName}} +); + {{/each}} \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/docschema_codeSample.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/validateSchemaCodeSample.hbs similarity index 100% rename from src/main/resources/java/src/main/java/packagename/components/schemas/docschema_codeSample.hbs rename to src/main/resources/java/src/main/java/packagename/components/schemas/validateSchemaCodeSample.hbs diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index c9469d6b2c4..3c87dfdaf21 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -140,12 +140,24 @@ SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeyw {{#if containerJsonPathPiece}} {{#each (reverse getSchemas)}} {{#eq instanceType "schema"}} -{{> src/main/java/packagename/components/schemas/docschema_codeSample payloadVarName=../@key.camelCase configVarName="schemaConfiguration" }} +{{> src/main/java/packagename/components/schemas/validateSchemaCodeSample payloadVarName=../@key.camelCase configVarName="schemaConfiguration" }} {{/eq}} {{/each}} {{else}} -// todo set sample for {{@key.camelCase}} -// {{jsonPathPiece.pascalCase}} + {{! CodegenRequestBody }} + {{#with getSelfOrDeepestRef}} + {{#each content}} + {{#if @first}} + {{#with schema}} +// todo add this import + {{#with getSelfOrDeepestRef}} +{{> src/main/java/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}} From c9e01b4e6a066328e0f61c7bc015b210ef4aa9c7 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 1 Apr 2024 12:57:13 -0700 Subject: [PATCH 16/53] Adds response retrieval to operation docs --- .../java/docs/paths/anotherfakedummy/Patch.md | 7 ++- .../docs/paths/commonparamsubdir/Delete.md | 6 +++ .../java/docs/paths/commonparamsubdir/Get.md | 6 +++ .../java/docs/paths/commonparamsubdir/Post.md | 6 +++ .../petstore/java/docs/paths/fake/Delete.md | 7 +++ .../petstore/java/docs/paths/fake/Get.md | 51 +------------------ .../petstore/java/docs/paths/fake/Patch.md | 7 ++- .../petstore/java/docs/paths/fake/Post.md | 38 +------------- .../Get.md | 20 ++------ .../docs/paths/fakebodywithfileschema/Put.md | 7 ++- .../docs/paths/fakebodywithqueryparams/Put.md | 8 ++- .../docs/paths/fakecasesensitiveparams/Put.md | 6 +++ .../docs/paths/fakeclassnametest/Patch.md | 7 ++- .../docs/paths/fakedeletecoffeeid/Delete.md | 6 +++ .../java/docs/paths/fakehealth/Get.md | 4 ++ .../fakeinlineadditionalproperties/Post.md | 7 ++- .../docs/paths/fakeinlinecomposition/Post.md | 18 ++----- .../java/docs/paths/fakejsonformdata/Get.md | 14 +---- .../java/docs/paths/fakejsonpatch/Patch.md | 14 ++--- .../docs/paths/fakejsonwithcharset/Post.md | 6 ++- .../Post.md | 12 +---- .../paths/fakemultipleresponsebodies/Get.md | 4 ++ .../docs/paths/fakemultiplesecurities/Get.md | 4 ++ .../java/docs/paths/fakeobjinquery/Get.md | 18 ++----- .../Post.md | 6 +++ .../java/docs/paths/fakepemcontenttype/Get.md | 10 ++-- .../Post.md | 6 +++ .../fakequeryparamwithjsoncontenttype/Get.md | 6 +++ .../java/docs/paths/fakeredirection/Get.md | 4 ++ .../java/docs/paths/fakerefobjinquery/Get.md | 18 ++----- .../docs/paths/fakerefsarraymodel/Post.md | 26 ++-------- .../docs/paths/fakerefsarrayofenums/Post.md | 12 +---- .../java/docs/paths/fakerefsboolean/Post.md | 10 ++-- .../Post.md | 6 ++- .../java/docs/paths/fakerefsenum/Post.md | 14 +---- .../java/docs/paths/fakerefsmammal/Post.md | 6 +++ .../java/docs/paths/fakerefsnumber/Post.md | 10 ++-- .../fakerefsobjectmodelwithrefprops/Post.md | 14 ++--- .../java/docs/paths/fakerefsstring/Post.md | 10 ++-- .../paths/fakeresponsewithoutschema/Get.md | 4 ++ .../docs/paths/faketestqueryparamters/Put.md | 6 +++ .../docs/paths/fakeuploaddownloadfile/Post.md | 7 ++- .../java/docs/paths/fakeuploadfile/Post.md | 14 +---- .../java/docs/paths/fakeuploadfiles/Post.md | 19 ++----- .../docs/paths/fakewildcardresponses/Get.md | 4 ++ .../petstore/java/docs/paths/foo/Get.md | 4 ++ .../petstore/java/docs/paths/pet/Post.md | 7 ++- .../petstore/java/docs/paths/pet/Put.md | 7 ++- .../java/docs/paths/petfindbystatus/Get.md | 6 +++ .../java/docs/paths/petfindbytags/Get.md | 6 +++ .../java/docs/paths/petpetid/Delete.md | 6 +++ .../petstore/java/docs/paths/petpetid/Get.md | 6 +++ .../petstore/java/docs/paths/petpetid/Post.md | 6 +++ .../docs/paths/petpetiduploadimage/Post.md | 6 +++ .../petstore/java/docs/paths/solidus/Get.md | 4 ++ .../java/docs/paths/storeinventory/Get.md | 4 ++ .../java/docs/paths/storeorder/Post.md | 7 ++- .../docs/paths/storeorderorderid/Delete.md | 6 +++ .../java/docs/paths/storeorderorderid/Get.md | 6 +++ .../petstore/java/docs/paths/user/Post.md | 7 ++- .../docs/paths/usercreatewitharray/Post.md | 7 ++- .../docs/paths/usercreatewithlist/Post.md | 7 ++- .../petstore/java/docs/paths/userlogin/Get.md | 6 +++ .../java/docs/paths/userlogout/Get.md | 4 ++ .../java/docs/paths/userusername/Delete.md | 6 +++ .../java/docs/paths/userusername/Get.md | 6 +++ .../java/docs/paths/userusername/Put.md | 8 ++- .../validateAndBoxSchemaCodeSample.hbs | 13 ----- .../path/verb/_OperationDocCodeSample.hbs | 23 +++++++++ 69 files changed, 346 insertions(+), 317 deletions(-) diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 46754ac238c..e07f07fe48c 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -60,7 +60,6 @@ Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration) // todo add this import -// Map validation Client1BoxedMap requestBodyPayload = Client.Client1.validateAndBox( new Client.ClientMapBuilder1() @@ -70,6 +69,12 @@ Client1BoxedMap requestBodyPayload = schemaConfiguration ); RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.patch(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index 40a4a188ddc..a503cf5db1e 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -69,6 +69,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response = apiClient.delete(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index 398f4f9ce3c..bd12e2dc14e 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -69,6 +69,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index e5c45b2134c..794d2899adb 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -69,6 +69,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index 473efd4c831..b090ee53ccc 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -100,6 +100,13 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); + +var request = new DeleteRequestBuilder() + .headerParameters(headerParameters) + .queryParameters(queryParameters) + .build(); + +Responses.EndpointResponse response = apiClient.delete(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index 1c23a242d95..562256eef95 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -58,57 +58,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo add this import - -// Map validation -ApplicationxwwwformurlencodedSchema1BoxedMap requestBodyPayload = - ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validateAndBox( - new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() - .enum_form_string_array( - Arrays.asList( - ">" - ) - ) - .enum_form_string("_abc") - - .build(), - schemaConfiguration -); -Get.SealedRequestBody requestBody = new Get.ApplicationxwwwformurlencodedRequestBody(requestBodyPayload); - -// Map validation -HeaderParameters.HeaderParametersMap headerParameters = - HeaderParameters.HeaderParameters1.validate( - new HeaderParameters.HeaderParametersMapBuilder() - .enum_header_string("_abc") - - .enum_header_string_array( - Arrays.asList( - ">" - ) - ) - .build(), - schemaConfiguration -); - -// Map validation -QueryParameters.QueryParametersMap queryParameters = - QueryParameters.QueryParameters1.validate( - new QueryParameters.QueryParametersMapBuilder() - .enum_query_double(3.14d) - .enum_query_string("_abc") +var request = new GetRequestBuilder().build(); - .enum_query_integer(1) - - .enum_query_string_array( - Arrays.asList( - ">" - ) - ) - .build(), - schemaConfiguration -); +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index 1b9bde15db7..25effed1e3e 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -60,7 +60,6 @@ Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration) // todo add this import -// Map validation Client1BoxedMap requestBodyPayload = Client.Client1.validateAndBox( new Client.ClientMapBuilder1() @@ -70,6 +69,12 @@ Client1BoxedMap requestBodyPayload = schemaConfiguration ); RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.patch(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index 94dcd6db6da..7c139976b15 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -67,44 +67,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import -// Map validation -ApplicationxwwwformurlencodedSchema1BoxedMap requestBodyPayload = - ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validateAndBox( - new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() - .setByte("a") +var request = new PostRequestBuilder().build(); - .setDouble(3.14d) - - .setNumber(1) - - .pattern_without_delimiter("AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>") - - .setInteger(1) - - .int32(1) - - .int64(1L) - - .setFloat(3.14f) - - .setString("A") - - .binary("a") - - .date("2020-12-13") - - .dateTime("1970-01-01T00:00:00.00Z") - - .password("a") - - .callback("a") - - .build(), - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.ApplicationxwwwformurlencodedRequestBody(requestBodyPayload); +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index aba15f58481..cc745028353 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -56,22 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo add this import - -// Map validation -AdditionalPropertiesWithArrayOfEnums1BoxedMap requestBodyPayload = - AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1.validateAndBox( - new AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnumsMapBuilder() - .additionalProperty( - "someAdditionalProperty", - Arrays.asList( - "_abc" - ) - ) - .build(), - schemaConfiguration -); -Get.SealedRequestBody requestBody = new Get.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index 4fdfa9f3132..3afdb9cf7af 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -60,7 +60,6 @@ Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); // todo add this import -// Map validation FileSchemaTestClass1BoxedMap requestBodyPayload = FileSchemaTestClass.FileSchemaTestClass1.validateAndBox( new FileSchemaTestClass.FileSchemaTestClassMapBuilder() @@ -72,6 +71,12 @@ FileSchemaTestClass1BoxedMap requestBodyPayload = schemaConfiguration ); Put.SealedRequestBody requestBody = new Put.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PutRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.put(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index 24e55483d40..744ae8e6da5 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -63,7 +63,6 @@ Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); // todo add this import -// Map validation User1BoxedMap requestBodyPayload = User.User1.validateAndBox( new User.UserMapBuilder() @@ -99,6 +98,13 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); + +var request = new PutRequestBuilder() + .requestBody(requestBody) + .queryParameters(queryParameters) + .build(); + +Responses.EndpointResponse response = apiClient.put(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index fb8ace3ec94..fcb3d0edc3e 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -72,6 +72,12 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); + +var request = new PutRequestBuilder() + .queryParameters(queryParameters) + .build(); + +Responses.EndpointResponse response = apiClient.put(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index 58d5dcd4598..5a3765712ee 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -71,7 +71,6 @@ Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration) // todo add this import -// Map validation Client1BoxedMap requestBodyPayload = Client.Client1.validateAndBox( new Client.ClientMapBuilder1() @@ -81,6 +80,12 @@ Client1BoxedMap requestBodyPayload = schemaConfiguration ); RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.patch(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index 4ed40390eed..f6a4edb2e80 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -68,6 +68,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response = apiClient.delete(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index 5c0e3492caa..29253f865ab 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -55,6 +55,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index 4eb29e181f1..9256d0e2e23 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -60,7 +60,6 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // todo add this import -// Map validation ApplicationjsonSchema1BoxedMap requestBodyPayload = ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() @@ -70,6 +69,12 @@ ApplicationjsonSchema1BoxedMap requestBodyPayload = schemaConfiguration ); Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 4f742fbc4f0..66eb974e2a0 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -57,20 +57,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); - -// Map validation -QueryParameters.QueryParametersMap queryParameters = - QueryParameters.QueryParameters1.validate( - new QueryParameters.QueryParametersMapBuilder() - .compositionInProperty( - MapUtils.makeMap( - ) - ) - .build(), - schemaConfiguration -); + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index e3a29b2f017..817ebfb359f 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -56,20 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo add this import -// Map validation -ApplicationxwwwformurlencodedSchema1BoxedMap requestBodyPayload = - ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1.validateAndBox( - new ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchemaMapBuilder() - .param("a") +var request = new GetRequestBuilder().build(); - .param2("a") - - .build(), - schemaConfiguration -); -Get.SealedRequestBody requestBody = new Get.ApplicationxwwwformurlencodedRequestBody(requestBodyPayload); +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index b9410c4d7e8..24903a8b9cc 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -56,16 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); -// todo add this import - -// List validation -JSONPatchRequest1BoxedList requestBodyPayload = - JSONPatchRequest.JSONPatchRequest1.validateAndBox( - new JSONPatchRequest.JSONPatchRequestListBuilder() - .build(), - schemaConfiguration -); -Patch.SealedRequestBody requestBody = new Patch.ApplicationjsonpatchjsonRequestBody(requestBodyPayload); + +var request = new PatchRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.patch(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index 55b31bdf96c..5c2eb975f17 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -56,8 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import -Post.SealedRequestBody requestBody = new Post.Applicationjsoncharsetutf8RequestBody(requestBodyPayload); + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 610b8065f2a..bc0797b3281 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -56,18 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import -// Map validation -ApplicationjsonSchema1BoxedMap requestBodyPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( - new ApplicationjsonSchema.ApplicationjsonSchemaMapBuilder() - .a("a") +var request = new PostRequestBuilder().build(); - .build(), - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index f4faca105fd..c37d809cd27 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -55,6 +55,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index a62cfbf0fa0..ddaad2b9150 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -71,6 +71,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index 353e5d3855e..af51c2cd9ed 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -57,21 +57,9 @@ SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeyw Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// Map validation -QueryParameters.QueryParametersMap queryParameters = - QueryParameters.QueryParameters1.validate( - new QueryParameters.QueryParametersMapBuilder() - .mapBean( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "keyword", - "a" - ) - ) - ) - .build(), - schemaConfiguration -); +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index f21c5eb5d38..682a9adfb90 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -80,6 +80,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index 142f2cdbd8c..a2da5b67760 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -56,14 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// todo add this import -// String validation -ApplicationxpemfileSchema1BoxedString requestBodyPayload = ApplicationxpemfileSchema.ApplicationxpemfileSchema1.validateAndBox( - "a", - schemaConfiguration -); -Get.SealedRequestBody requestBody = new Get.ApplicationxpemfileRequestBody(requestBodyPayload); +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index 96fe6717ba7..c54e388e992 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -77,6 +77,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index fab70f007ef..9551822f41e 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -66,6 +66,12 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); + +var request = new GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index 55ee2d26c84..d7f88ad3725 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -55,6 +55,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index 4a63c4d93d2..79d79017b8e 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -57,21 +57,9 @@ SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeyw Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); -// Map validation -QueryParameters.QueryParametersMap queryParameters = - QueryParameters.QueryParameters1.validate( - new QueryParameters.QueryParametersMapBuilder() - .mapBean( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "bar", - "a" - ) - ) - ) - .build(), - schemaConfiguration -); +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index 5184a2e06b2..6f67226d0dd 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -56,28 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import - -// List validation -AnimalFarm1BoxedList requestBodyPayload = - AnimalFarm.AnimalFarm1.validateAndBox( - new AnimalFarm.AnimalFarmListBuilder() - .add( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "className", - "a" - ), - new AbstractMap.SimpleEntry( - "color", - "a" - ) - ) - ) - .build(), - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index 697d751e7b8..81c928aa0ab 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -56,18 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import -// List validation -ArrayOfEnums1BoxedList requestBodyPayload = - ArrayOfEnums.ArrayOfEnums1.validateAndBox( - new ArrayOfEnums.ArrayOfEnumsListBuilder() - .add((Void) null) +var request = new PostRequestBuilder().build(); - .build(), - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index 782119ace3f..c05826dfbb0 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -56,14 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import -// boolean validation -BooleanSchema1BoxedBoolean requestBodyPayload = BooleanSchema.BooleanSchema1.validateAndBox( - true, - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index 3ff614d3358..0dae4d3b0d4 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -56,8 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index 70fedc57c6d..fe6d3ab58c7 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -56,20 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import -// null validation -StringEnum1BoxedVoid requestBodyPayload = StringEnum.StringEnum1.validateAndBox( - (Void) null, - schemaConfiguration -); +var request = new PostRequestBuilder().build(); -// String validation -StringEnum1BoxedString requestBodyPayload = StringEnum.StringEnum1.validateAndBox( - "placed", - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index 9f1d20080dd..cd995867ea8 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -60,6 +60,12 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // todo add this import Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index 1ca1c885fe3..a7323ed9403 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -56,14 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import -// int validation -NumberWithValidations1BoxedNumber requestBodyPayload = NumberWithValidations.NumberWithValidations1.validateAndBox( - 1, - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 2fae2d19203..ff02c00d61c 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -56,16 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import - -// Map validation -ObjectModelWithRefProps1BoxedMap requestBodyPayload = - ObjectModelWithRefProps.ObjectModelWithRefProps1.validateAndBox( - new ObjectModelWithRefProps.ObjectModelWithRefPropsMapBuilder() - .build(), - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 7f722249d1f..3ae2f7d5689 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -56,14 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import -// String validation -StringSchema1BoxedString requestBodyPayload = StringSchema.StringSchema1.validateAndBox( - "a", - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index c5f1005813b..a8bea54b6b0 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -55,6 +55,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index 9a6eac63454..80397a74301 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -93,6 +93,12 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); + +var request = new PutRequestBuilder() + .queryParameters(queryParameters) + .build(); + +Responses.EndpointResponse response = apiClient.put(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index 4c26390fcff..7fe0cd7864e 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -60,12 +60,17 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // todo add this import -// String validation ApplicationoctetstreamSchema1BoxedString requestBodyPayload = ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.validateAndBox( "a", schemaConfiguration ); Post.SealedRequestBody requestBody = new Post.ApplicationoctetstreamRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index 1b55fd49ef8..8dec3ce4c5a 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -56,20 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import -// Map validation -MultipartformdataSchema1BoxedMap requestBodyPayload = - MultipartformdataSchema.MultipartformdataSchema1.validateAndBox( - new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() - .file("a") +var request = new PostRequestBuilder().build(); - .additionalMetadata("a") - - .build(), - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.MultipartformdataRequestBody(requestBodyPayload); +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index 1330b7037cf..9097e541cfc 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -56,21 +56,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import - -// Map validation -MultipartformdataSchema1BoxedMap requestBodyPayload = - MultipartformdataSchema.MultipartformdataSchema1.validateAndBox( - new MultipartformdataSchema.MultipartformdataSchemaMapBuilder() - .files( - Arrays.asList( - "a" - ) - ) - .build(), - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.MultipartformdataRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index d52dc82e796..bf212a3b357 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -55,6 +55,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index 64520d83a76..7bfed2392a5 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -53,6 +53,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index 39a78811e47..37a886a8557 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -73,7 +73,6 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // todo add this import -// Map validation Pet1BoxedMap requestBodyPayload = Pet.Pet1.validateAndBox( new Pet.PetMapBuilder() @@ -114,6 +113,12 @@ Pet1BoxedMap requestBodyPayload = schemaConfiguration ); RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index eb00084b95e..1928e6b3e33 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -69,7 +69,6 @@ Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); // todo add this import -// Map validation Pet1BoxedMap requestBodyPayload = Pet.Pet1.validateAndBox( new Pet.PetMapBuilder() @@ -110,6 +109,12 @@ Pet1BoxedMap requestBodyPayload = schemaConfiguration ); RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PutRequestBuilder() + .requestBody(requestBody) + .build(); + +Void response = apiClient.put(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 315c0c13056..30a3cbe3725 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -82,6 +82,12 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); + +var request = new GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index 65ee522fca8..a6db9f228d4 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -80,6 +80,12 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); + +var request = new GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index 0285b28bd00..f833f813d30 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -81,6 +81,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Void response = apiClient.delete(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index 24912dd7ed9..b5836080de6 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -79,6 +79,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index 881d6ada698..d1171f3d199 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -81,6 +81,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Void response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index 8d8159b7e75..7f4d8647ca2 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -77,6 +77,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index 72c88761357..f800f38adc9 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -55,6 +55,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index 16f24de522d..8ae3c300103 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -66,6 +66,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index 6fd2f606293..0ac37c07916 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -60,7 +60,6 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // todo add this import -// Map validation Order1BoxedMap requestBodyPayload = Order.Order1.validateAndBox( new Order.OrderMapBuilder() @@ -80,6 +79,12 @@ Order1BoxedMap requestBodyPayload = schemaConfiguration ); Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index a895ebd04b2..1887b75dbd7 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -68,6 +68,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Void response = apiClient.delete(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index 94210812836..8f43d232df1 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -68,6 +68,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index d21b72978f8..32ebca81dc0 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -60,7 +60,6 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // todo add this import -// Map validation User1BoxedMap requestBodyPayload = User.User1.validateAndBox( new User.UserMapBuilder() @@ -86,6 +85,12 @@ User1BoxedMap requestBodyPayload = schemaConfiguration ); Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index 82907a389d3..0871a42a311 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -60,7 +60,6 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // todo add this import -// List validation ApplicationjsonSchema1BoxedList requestBodyPayload = ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( new ApplicationjsonSchema.ApplicationjsonSchemaListBuilder() @@ -108,6 +107,12 @@ ApplicationjsonSchema1BoxedList requestBodyPayload = schemaConfiguration ); RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index 24c9c0336b0..23c9ddd41d8 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -60,7 +60,6 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); // todo add this import -// List validation ApplicationjsonSchema1BoxedList requestBodyPayload = ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( new ApplicationjsonSchema.ApplicationjsonSchemaListBuilder() @@ -108,6 +107,12 @@ ApplicationjsonSchema1BoxedList requestBodyPayload = schemaConfiguration ); RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response = apiClient.post(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index 3c68e316cea..cb4fcdda2f8 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -70,6 +70,12 @@ QueryParameters.QueryParametersMap queryParameters = .build(), schemaConfiguration ); + +var request = new GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index 2b29c71b886..aa7a237112d 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -55,6 +55,10 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index 03cf74241b6..dcb41645eec 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -68,6 +68,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response = apiClient.delete(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index 20091f107c4..61bf3d9a9a8 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -68,6 +68,12 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response = apiClient.get(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index 1a839bcec81..4f1472e3d8e 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -63,7 +63,6 @@ Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); // todo add this import -// Map validation User1BoxedMap requestBodyPayload = User.User1.validateAndBox( new User.UserMapBuilder() @@ -99,6 +98,13 @@ PathParameters.PathParametersMap pathParameters = .build(), schemaConfiguration ); + +var request = new PutRequestBuilder() + .requestBody(requestBody) + .pathParameters(pathParameters) + .build(); + +Void response = apiClient.put(request); ``` ### Constructor Summary | Constructor and Description | diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs index 49aba4b3080..636284e6daa 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs @@ -1,63 +1,50 @@ {{#each typeToExample}} {{#eq @key "null"}} -// null validation {{../jsonPathPiece.pascalCase}}BoxedVoid {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{else}} {{#eq @key "object"}} {{#if ../mapOutputJsonPathPiece}} -// Map validation {{../jsonPathPiece.pascalCase}}BoxedMap {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{else}} -// Map validation {{../jsonPathPiece.pascalCase}}BoxedMap {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{/if}} {{else}} {{#eq @key "array"}} {{#if ../arrayOutputJsonPathPiece}} -// List validation {{../jsonPathPiece.pascalCase}}BoxedList {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{else}} -// List validation {{../jsonPathPiece.pascalCase}}BoxedList {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{/if}} {{else}} {{#eq @key "string" }} -// String validation {{../jsonPathPiece.pascalCase}}BoxedString {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{else}} {{#eq @key "integer"}} {{#or (eq ../format null) (eq ../format "int64") }} -// long validation {{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{else}} -// int validation {{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{/or}} {{else}} {{#eq @key "number"}} {{#eq ../format "int64"}} -// long validation {{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{else}} {{#eq ../format "float"}} -// float validation {{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{else}} {{#eq ../format "double"}} -// double validation {{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{else}} -// int validation {{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{/eq}} {{/eq}} {{/eq}} {{else}} {{#eq @key "boolean"}} -// boolean validation {{../jsonPathPiece.pascalCase}}BoxedBoolean {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( {{/eq}} {{/eq}} diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index 3c87dfdaf21..5f8a5ba8bbe 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -133,6 +133,7 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 apiClient = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1(apiConfiguration, schemaConfiguration); + {{#gt builders.size 1}} {{#each builders}} {{#if @last}} {{#each keyToBuilder}} @@ -163,5 +164,27 @@ SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeyw {{/each}} {{/if}} {{/each}} + {{/gt}} + + {{#eq builders.size 1}} + {{! only option props}} + {{#each builders}} +var request = new {{className.pascalCase}}().build(); + {{/each}} + {{else}} + {{#each builders}} + {{#if @last}} +var request = new {{className.pascalCase}}() + {{#each keyToBuilder}} + .{{@key.camelCase}}({{@key.camelCase}}) + {{#if @last}} + .build(); + {{/if}} + {{/each}} + {{/if}} + {{/each}} + {{/eq}} + +{{#if nonErrorResponses }}{{responses.jsonPathPiece.pascalCase}}.EndpointResponse{{else}}Void{{/if}} response = apiClient.{{jsonPathPiece.camelCase}}(request); {{/with}} ``` \ No newline at end of file From a1f6314888010bbcc964756d2bf56a7d706f8205 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 1 Apr 2024 14:21:03 -0700 Subject: [PATCH 17/53] Changes all exceptions to be based on Exception --- .../petstore/java/.openapi-generator/FILES | 2 ++ .../java/docs/paths/anotherfakedummy/Patch.md | 10 +++++++++- .../docs/paths/commonparamsubdir/Delete.md | 10 +++++++++- .../java/docs/paths/commonparamsubdir/Get.md | 10 +++++++++- .../java/docs/paths/commonparamsubdir/Post.md | 10 +++++++++- .../petstore/java/docs/paths/fake/Delete.md | 10 +++++++++- .../petstore/java/docs/paths/fake/Get.md | 10 +++++++++- .../petstore/java/docs/paths/fake/Patch.md | 10 +++++++++- .../petstore/java/docs/paths/fake/Post.md | 10 +++++++++- .../Get.md | 10 +++++++++- .../docs/paths/fakebodywithfileschema/Put.md | 10 +++++++++- .../docs/paths/fakebodywithqueryparams/Put.md | 10 +++++++++- .../docs/paths/fakecasesensitiveparams/Put.md | 10 +++++++++- .../docs/paths/fakeclassnametest/Patch.md | 10 +++++++++- .../docs/paths/fakedeletecoffeeid/Delete.md | 10 +++++++++- .../java/docs/paths/fakehealth/Get.md | 10 +++++++++- .../fakeinlineadditionalproperties/Post.md | 10 +++++++++- .../docs/paths/fakeinlinecomposition/Post.md | 10 +++++++++- .../java/docs/paths/fakejsonformdata/Get.md | 10 +++++++++- .../java/docs/paths/fakejsonpatch/Patch.md | 10 +++++++++- .../docs/paths/fakejsonwithcharset/Post.md | 10 +++++++++- .../Post.md | 10 +++++++++- .../paths/fakemultipleresponsebodies/Get.md | 10 +++++++++- .../docs/paths/fakemultiplesecurities/Get.md | 10 +++++++++- .../java/docs/paths/fakeobjinquery/Get.md | 10 +++++++++- .../Post.md | 10 +++++++++- .../java/docs/paths/fakepemcontenttype/Get.md | 10 +++++++++- .../Post.md | 10 +++++++++- .../fakequeryparamwithjsoncontenttype/Get.md | 10 +++++++++- .../java/docs/paths/fakeredirection/Get.md | 10 +++++++++- .../java/docs/paths/fakerefobjinquery/Get.md | 10 +++++++++- .../docs/paths/fakerefsarraymodel/Post.md | 10 +++++++++- .../docs/paths/fakerefsarrayofenums/Post.md | 10 +++++++++- .../java/docs/paths/fakerefsboolean/Post.md | 10 +++++++++- .../Post.md | 10 +++++++++- .../java/docs/paths/fakerefsenum/Post.md | 10 +++++++++- .../java/docs/paths/fakerefsmammal/Post.md | 10 +++++++++- .../java/docs/paths/fakerefsnumber/Post.md | 10 +++++++++- .../fakerefsobjectmodelwithrefprops/Post.md | 10 +++++++++- .../java/docs/paths/fakerefsstring/Post.md | 10 +++++++++- .../paths/fakeresponsewithoutschema/Get.md | 10 +++++++++- .../docs/paths/faketestqueryparamters/Put.md | 10 +++++++++- .../docs/paths/fakeuploaddownloadfile/Post.md | 10 +++++++++- .../java/docs/paths/fakeuploadfile/Post.md | 10 +++++++++- .../java/docs/paths/fakeuploadfiles/Post.md | 10 +++++++++- .../docs/paths/fakewildcardresponses/Get.md | 10 +++++++++- .../petstore/java/docs/paths/foo/Get.md | 10 +++++++++- .../petstore/java/docs/paths/pet/Post.md | 10 +++++++++- .../petstore/java/docs/paths/pet/Put.md | 10 +++++++++- .../java/docs/paths/petfindbystatus/Get.md | 10 +++++++++- .../java/docs/paths/petfindbytags/Get.md | 10 +++++++++- .../java/docs/paths/petpetid/Delete.md | 10 +++++++++- .../petstore/java/docs/paths/petpetid/Get.md | 10 +++++++++- .../petstore/java/docs/paths/petpetid/Post.md | 10 +++++++++- .../docs/paths/petpetiduploadimage/Post.md | 10 +++++++++- .../petstore/java/docs/paths/solidus/Get.md | 10 +++++++++- .../java/docs/paths/storeinventory/Get.md | 10 +++++++++- .../java/docs/paths/storeorder/Post.md | 10 +++++++++- .../docs/paths/storeorderorderid/Delete.md | 10 +++++++++- .../java/docs/paths/storeorderorderid/Get.md | 10 +++++++++- .../petstore/java/docs/paths/user/Post.md | 10 +++++++++- .../docs/paths/usercreatewitharray/Post.md | 10 +++++++++- .../docs/paths/usercreatewithlist/Post.md | 10 +++++++++- .../petstore/java/docs/paths/userlogin/Get.md | 10 +++++++++- .../java/docs/paths/userlogout/Get.md | 10 +++++++++- .../java/docs/paths/userusername/Delete.md | 10 +++++++++- .../java/docs/paths/userusername/Get.md | 10 +++++++++- .../java/docs/paths/userusername/Put.md | 10 +++++++++- .../responses/HeadersWithNoBody.java | 1 + .../responses/SuccessDescriptionOnly.java | 1 + .../SuccessInlineContentAndHeader.java | 5 +++-- .../responses/SuccessWithJsonApiResponse.java | 5 +++-- .../SuccessfulXmlAndJsonArrayOfPet.java | 5 +++-- .../configurations/ApiConfiguration.java | 3 ++- .../client/exceptions/BaseException.java | 2 +- .../exceptions/NotImplementedException.java | 8 ++++++++ .../exceptions/OpenapiDocumentException.java | 8 ++++++++ .../client/header/ContentHeader.java | 14 ++++++++------ .../client/header/Rfc6570Serializer.java | 19 ++++++++++--------- .../client/header/SchemaHeader.java | 13 +++++++------ .../client/parameter/ContentParameter.java | 8 +++++--- .../client/parameter/SchemaParameter.java | 5 +++-- .../patch/responses/Code200Response.java | 5 +++-- .../fake/get/responses/Code404Response.java | 5 +++-- .../fake/patch/responses/Code200Response.java | 5 +++-- .../fake/post/responses/Code404Response.java | 1 + .../get/responses/Code200Response.java | 5 +++-- .../patch/responses/Code200Response.java | 5 +++-- .../delete/responses/CodedefaultResponse.java | 1 + .../get/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../get/responses/Code200Response.java | 5 +++-- .../get/responses/Code202Response.java | 5 +++-- .../get/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../get/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../get/responses/Code200Response.java | 5 +++-- .../get/responses/Code303Response.java | 1 + .../get/responses/Code3XXResponse.java | 1 + .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../get/responses/Code200Response.java | 1 + .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code200Response.java | 5 +++-- .../get/responses/Code1XXResponse.java | 5 +++-- .../get/responses/Code200Response.java | 5 +++-- .../get/responses/Code2XXResponse.java | 5 +++-- .../get/responses/Code3XXResponse.java | 5 +++-- .../get/responses/Code4XXResponse.java | 5 +++-- .../get/responses/Code5XXResponse.java | 5 +++-- .../get/responses/CodedefaultResponse.java | 5 +++-- .../pet/post/responses/Code405Response.java | 1 + .../pet/put/responses/Code400Response.java | 1 + .../pet/put/responses/Code404Response.java | 1 + .../pet/put/responses/Code405Response.java | 1 + .../get/responses/Code400Response.java | 1 + .../get/responses/Code400Response.java | 1 + .../delete/responses/Code400Response.java | 1 + .../get/responses/Code200Response.java | 5 +++-- .../get/responses/Code400Response.java | 1 + .../get/responses/Code404Response.java | 1 + .../post/responses/Code405Response.java | 1 + .../post/responses/Code200Response.java | 5 +++-- .../post/responses/Code400Response.java | 1 + .../delete/responses/Code400Response.java | 1 + .../delete/responses/Code404Response.java | 1 + .../get/responses/Code200Response.java | 5 +++-- .../get/responses/Code400Response.java | 1 + .../get/responses/Code404Response.java | 1 + .../post/responses/CodedefaultResponse.java | 1 + .../post/responses/CodedefaultResponse.java | 1 + .../post/responses/CodedefaultResponse.java | 1 + .../get/responses/Code200Response.java | 5 +++-- .../get/responses/Code400Response.java | 1 + .../delete/responses/Code404Response.java | 1 + .../get/responses/Code200Response.java | 5 +++-- .../get/responses/Code400Response.java | 1 + .../get/responses/Code404Response.java | 1 + .../put/responses/Code400Response.java | 1 + .../put/responses/Code404Response.java | 1 + .../requestbody/RequestBodySerializer.java | 5 +++-- .../client/response/ResponseDeserializer.java | 14 +++++++++----- .../generators/JavaClientGenerator.java | 2 ++ .../components/responses/Response.hbs | 5 +++-- .../configurations/ApiConfiguration.hbs | 3 ++- .../packagename/exceptions/BaseException.hbs | 2 +- .../exceptions/NotImplementedException.hbs | 8 ++++++++ .../exceptions/OpenapiDocumentException.hbs | 8 ++++++++ .../java/packagename/header/ContentHeader.hbs | 14 ++++++++------ .../packagename/header/Rfc6570Serializer.hbs | 19 ++++++++++--------- .../java/packagename/header/SchemaHeader.hbs | 13 +++++++------ .../parameter/ContentParameter.hbs | 8 +++++--- .../packagename/parameter/SchemaParameter.hbs | 5 +++-- .../path/verb/_OperationDocCodeSample.hbs | 10 +++++++++- .../requestbody/RequestBodySerializer.hbs | 5 +++-- .../response/ResponseDeserializer.hbs | 14 +++++++++----- 167 files changed, 907 insertions(+), 226 deletions(-) create mode 100644 samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java create mode 100644 samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java create mode 100644 src/main/resources/java/src/main/java/packagename/exceptions/NotImplementedException.hbs create mode 100644 src/main/resources/java/src/main/java/packagename/exceptions/OpenapiDocumentException.hbs diff --git a/samples/client/petstore/java/.openapi-generator/FILES b/samples/client/petstore/java/.openapi-generator/FILES index ba6c49d0594..66dbdce1926 100644 --- a/samples/client/petstore/java/.openapi-generator/FILES +++ b/samples/client/petstore/java/.openapi-generator/FILES @@ -897,6 +897,8 @@ src/main/java/org/openapijsonschematools/client/exceptions/ApiException.java src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidTypeException.java +src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java +src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java src/main/java/org/openapijsonschematools/client/exceptions/UnsetPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/ValidationException.java src/main/java/org/openapijsonschematools/client/header/ContentHeader.java diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index e07f07fe48c..20b17135851 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -74,7 +74,15 @@ var request = new PatchRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.patch(request); +try { + Responses.EndpointResponse response = apiClient.patch(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index a503cf5db1e..96c6c730cc6 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -74,7 +74,15 @@ var request = new DeleteRequestBuilder() .pathParameters(pathParameters) .build(); -Responses.EndpointResponse response = apiClient.delete(request); +try { + Responses.EndpointResponse response = apiClient.delete(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index bd12e2dc14e..1fd7d542083 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -74,7 +74,15 @@ var request = new GetRequestBuilder() .pathParameters(pathParameters) .build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index 794d2899adb..cebd6984d74 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -74,7 +74,15 @@ var request = new PostRequestBuilder() .pathParameters(pathParameters) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index b090ee53ccc..8a7081793c6 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -106,7 +106,15 @@ var request = new DeleteRequestBuilder() .queryParameters(queryParameters) .build(); -Responses.EndpointResponse response = apiClient.delete(request); +try { + Responses.EndpointResponse response = apiClient.delete(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index 562256eef95..4ddb62855d0 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -61,7 +61,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index 25effed1e3e..eb2ec1e00be 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -74,7 +74,15 @@ var request = new PatchRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.patch(request); +try { + Responses.EndpointResponse response = apiClient.patch(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index 7c139976b15..5f533a5cdc4 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -70,7 +70,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index cc745028353..6f136de0d69 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -59,7 +59,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index 3afdb9cf7af..eb7221822b0 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -76,7 +76,15 @@ var request = new PutRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.put(request); +try { + Responses.EndpointResponse response = apiClient.put(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index 744ae8e6da5..431f52cc529 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -104,7 +104,15 @@ var request = new PutRequestBuilder() .queryParameters(queryParameters) .build(); -Responses.EndpointResponse response = apiClient.put(request); +try { + Responses.EndpointResponse response = apiClient.put(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index fcb3d0edc3e..e0e5a69148c 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -77,7 +77,15 @@ var request = new PutRequestBuilder() .queryParameters(queryParameters) .build(); -Responses.EndpointResponse response = apiClient.put(request); +try { + Responses.EndpointResponse response = apiClient.put(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index 5a3765712ee..9ad224b4702 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -85,7 +85,15 @@ var request = new PatchRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.patch(request); +try { + Responses.EndpointResponse response = apiClient.patch(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index f6a4edb2e80..d357865b4a9 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -73,7 +73,15 @@ var request = new DeleteRequestBuilder() .pathParameters(pathParameters) .build(); -Responses.EndpointResponse response = apiClient.delete(request); +try { + Responses.EndpointResponse response = apiClient.delete(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index 29253f865ab..cf95e4875bb 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -58,7 +58,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index 9256d0e2e23..2d878ebb16a 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -74,7 +74,15 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 66eb974e2a0..2567faafc1c 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -60,7 +60,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index 817ebfb359f..9f58f37b727 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -59,7 +59,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index 24903a8b9cc..6847b1c00c1 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -59,7 +59,15 @@ Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration) var request = new PatchRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.patch(request); +try { + Responses.EndpointResponse response = apiClient.patch(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index 5c2eb975f17..ec626fcd765 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index bc0797b3281..76df904bffe 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index c37d809cd27..ae6cb301945 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -58,7 +58,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index ddaad2b9150..7facab804f9 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -74,7 +74,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index af51c2cd9ed..f1f0c201c3c 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -59,7 +59,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index 682a9adfb90..a0cc65cb357 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -85,7 +85,15 @@ var request = new PostRequestBuilder() .pathParameters(pathParameters) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index a2da5b67760..ec8f40c44dc 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -59,7 +59,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index c54e388e992..25d941df316 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -82,7 +82,15 @@ var request = new PostRequestBuilder() .pathParameters(pathParameters) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index 9551822f41e..e17289d1fb1 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -71,7 +71,15 @@ var request = new GetRequestBuilder() .queryParameters(queryParameters) .build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index d7f88ad3725..e7948db0117 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -58,7 +58,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index 79d79017b8e..5b6ef0cf4fa 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -59,7 +59,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index 6f67226d0dd..00a1a55f74d 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index 81c928aa0ab..d0053d163fe 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index c05826dfbb0..8f0ac00363d 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index 0dae4d3b0d4..a51633064eb 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index fe6d3ab58c7..005c18e18ad 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index cd995867ea8..d3f78dc1da2 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -65,7 +65,15 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index a7323ed9403..0d3e071ed71 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index ff02c00d61c..9745c78a642 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 3ae2f7d5689..171ec9b3282 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index a8bea54b6b0..a60aee7b298 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -58,7 +58,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index 80397a74301..77d8d046f50 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -98,7 +98,15 @@ var request = new PutRequestBuilder() .queryParameters(queryParameters) .build(); -Responses.EndpointResponse response = apiClient.put(request); +try { + Responses.EndpointResponse response = apiClient.put(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index 7fe0cd7864e..71fcc504e0e 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -70,7 +70,15 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index 8dec3ce4c5a..aeeffb50866 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index 9097e541cfc..ee9ea0873db 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -59,7 +59,15 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index bf212a3b357..6ee9a9cd69e 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -58,7 +58,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index 7bfed2392a5..cde10f5fbf7 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -56,7 +56,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index 37a886a8557..f50cfb338a1 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -118,7 +118,15 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index 1928e6b3e33..fd27b03f291 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -114,7 +114,15 @@ var request = new PutRequestBuilder() .requestBody(requestBody) .build(); -Void response = apiClient.put(request); +try { + Void response = apiClient.put(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 30a3cbe3725..fd4f1988669 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -87,7 +87,15 @@ var request = new GetRequestBuilder() .queryParameters(queryParameters) .build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index a6db9f228d4..136c5e2783d 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -85,7 +85,15 @@ var request = new GetRequestBuilder() .queryParameters(queryParameters) .build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index f833f813d30..051c55bfaf1 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -86,7 +86,15 @@ var request = new DeleteRequestBuilder() .pathParameters(pathParameters) .build(); -Void response = apiClient.delete(request); +try { + Void response = apiClient.delete(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index b5836080de6..650fa3afc3f 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -84,7 +84,15 @@ var request = new GetRequestBuilder() .pathParameters(pathParameters) .build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index d1171f3d199..5d225590744 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -86,7 +86,15 @@ var request = new PostRequestBuilder() .pathParameters(pathParameters) .build(); -Void response = apiClient.post(request); +try { + Void response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index 7f4d8647ca2..443cc7ef17a 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -82,7 +82,15 @@ var request = new PostRequestBuilder() .pathParameters(pathParameters) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index f800f38adc9..efeeb014d47 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -58,7 +58,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index 8ae3c300103..51eb3785217 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -69,7 +69,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index 0ac37c07916..5f3151768c3 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -84,7 +84,15 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index 1887b75dbd7..ae2e56de8f0 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -73,7 +73,15 @@ var request = new DeleteRequestBuilder() .pathParameters(pathParameters) .build(); -Void response = apiClient.delete(request); +try { + Void response = apiClient.delete(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index 8f43d232df1..c0b1dc52f9d 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -73,7 +73,15 @@ var request = new GetRequestBuilder() .pathParameters(pathParameters) .build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index 32ebca81dc0..56711a5e2d2 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -90,7 +90,15 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index 0871a42a311..fb61b7a6327 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -112,7 +112,15 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index 23c9ddd41d8..92712bc5dc9 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -112,7 +112,15 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); -Responses.EndpointResponse response = apiClient.post(request); +try { + Responses.EndpointResponse response = apiClient.post(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index cb4fcdda2f8..aa2c3763341 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -75,7 +75,15 @@ var request = new GetRequestBuilder() .queryParameters(queryParameters) .build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index aa7a237112d..973147966c2 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -58,7 +58,15 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index dcb41645eec..7ffaa0b1639 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -73,7 +73,15 @@ var request = new DeleteRequestBuilder() .pathParameters(pathParameters) .build(); -Responses.EndpointResponse response = apiClient.delete(request); +try { + Responses.EndpointResponse response = apiClient.delete(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index 61bf3d9a9a8..c2457c24c34 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -73,7 +73,15 @@ var request = new GetRequestBuilder() .pathParameters(pathParameters) .build(); -Responses.EndpointResponse response = apiClient.get(request); +try { + Responses.EndpointResponse response = apiClient.get(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index 4f1472e3d8e..ecc51e4e52b 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -104,7 +104,15 @@ var request = new PutRequestBuilder() .pathParameters(pathParameters) .build(); -Void response = apiClient.put(request); +try { + Void response = apiClient.put(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java index 3c5e23a79cb..668c6dae840 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.components.responses.headerswithnobody.HeadersWithNoBodyHeadersSchema; import org.openapijsonschematools.client.components.responses.headerswithnobody.Headers; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java index c61f5c1dee0..afda75639cd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java index c1b9c74b65c..941550f2d00 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; @@ -42,13 +43,13 @@ public SuccessInlineContentAndHeader1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java index 61a2d19f509..bf767b15165 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; @@ -42,13 +43,13 @@ public SuccessWithJsonApiResponse1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java index 7ed6c0ef51e..4a0a5d6cea6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationjson.ApplicationjsonSchema; @@ -53,7 +54,7 @@ public SuccessfulXmlAndJsonArrayOfPet1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); @@ -62,7 +63,7 @@ protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConf var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index 2e74282e7bb..237ce45062d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -21,6 +21,7 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.checkerframework.checker.nullness.qual.Nullable; import java.time.Duration; @@ -419,7 +420,7 @@ public SecurityRequirementObject getSecurityRequirementObject(StoreinventoryGetS 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."); + throw new UnsetPropertyException("SecurityScheme of class " + securitySchemeClass + "cannot be returned because it is unset. Pass in an instance of it in securitySchemes when instantiating ApiConfiguration."); } return securityScheme; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java index 3bea6999da1..268e9373289 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.exceptions; @SuppressWarnings("serial") -public class BaseException extends RuntimeException { +public class BaseException extends Exception { public BaseException(String s) { super(s); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java new file mode 100644 index 00000000000..4e9633c9d8d --- /dev/null +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.exceptions; + +@SuppressWarnings("serial") +public class NotImplementedException extends BaseException { + public NotImplementedException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java new file mode 100644 index 00000000000..7614532f832 --- /dev/null +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.exceptions; + +@SuppressWarnings("serial") +public class OpenapiDocumentException extends BaseException { + public OpenapiDocumentException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java index 2b09f2f77df..48fb3731235 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -5,6 +5,8 @@ import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.parameter.ParameterStyle; @@ -28,7 +30,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, OpenapiDocumentException { for (Map.Entry> entry: content.entrySet()) { var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; String contentType = entry.getKey(); @@ -36,14 +38,14 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid var value = ContentTypeSerializer.toJson(castInData); return toHeaders(name, value); } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); } } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, OpenapiDocumentException { String inDataJoined = String.join(",", inData); // unsure if this is needed @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); if (validate) { @@ -52,10 +54,10 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid if (ContentTypeDetector.contentTypeIsJson(contentType)) { return entry.getValue().schema().validate(deserializedJson, configuration); } else { - throw new RuntimeException("Header deserialization of "+contentType+" has not yet been implemented"); + throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); } } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); } return deserializedJson; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java index 7bac0c8a6be..82974738b1f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java @@ -2,6 +2,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -20,7 +21,7 @@ public class Rfc6570Serializer { private static final String ENCODING = "UTF-8"; private static final Set namedParameterSeparators = Set.of("&", ";"); - private static String percentEncode(String s) { + private static String percentEncode(String s) throws NotImplementedException { if (s == null) { return ""; } @@ -31,11 +32,11 @@ private static String percentEncode(String s) { .replace("%7E", "~"); // This could be done faster with more hand-crafted code. } catch (UnsupportedEncodingException wow) { - throw new RuntimeException(wow.getMessage(), wow); + throw new NotImplementedException(wow.getMessage(), wow); } } - private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) { + 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= @@ -62,7 +63,7 @@ private static String percentEncode(String s) { // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 return null; } - throw new InvalidTypeException("Unable to generate a rfc6570 item representation of "+item); + throw new NotImplementedException("Unable to generate a rfc6570 item representation of "+item); } private static String rfc6570StrNumberExpansion( @@ -71,7 +72,7 @@ private static String rfc6570StrNumberExpansion( 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; @@ -87,7 +88,7 @@ private static String rfc6570ListExpansion( PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { + ) throws NotImplementedException { var itemValues = inData.stream() .map(v -> rfc6570ItemValue(v, percentEncode)) .filter(Objects::nonNull) @@ -116,7 +117,7 @@ private static String rfc6570MapExpansion( PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { + ) throws NotImplementedException { var inDataMap = inData.entrySet().stream() .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), rfc6570ItemValue(entry.getValue(), percentEncode))) .filter(entry -> entry.getValue() != null) @@ -143,7 +144,7 @@ protected static String rfc6570Expansion( boolean explode, boolean percentEncode, PrefixSeparatorIterator prefixSeparatorIterator - ) { + ) throws NotImplementedException { /* Separator is for separate variables like dict with explode true, not for array item separation @@ -181,6 +182,6 @@ protected static String rfc6570Expansion( ); } // bool, bytes, etc - throw new InvalidTypeException("Unable to generate a rfc6570 representation of "+inData); + throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java index e4fcfd99924..914a50d7d1f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java @@ -3,6 +3,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.parameter.ParameterStyle; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; @@ -49,7 +50,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid 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) { + 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<>(); @@ -60,7 +61,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return castList; } - private @Nullable Object getCastInData(JsonSchema schema, List inData) { + private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { if (schema.type == null) { if (inData.size() == 1) { return inData.get(0); @@ -68,7 +69,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return getList(schema, inData); } else if (schema.type.size() == 1) { if (schema.type.equals(BOOLEAN_TYPES)) { - throw new RuntimeException("Boolean serialization is not defined in Rfc6570, there is no agreed upon way to sent a boolean, send a string enum instead"); + 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) { @@ -76,16 +77,16 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid } else if (schema.type.equals(LIST_TYPES)) { return getList(schema, inData); } else if (schema.type.equals(MAP_TYPES)) { - throw new RuntimeException("Header map deserialization has not yet been implemented"); + 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 RuntimeException("Header deserialization for schemas with multiple types has not yet been implemented"); + 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) { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException { @Nullable Object castInData = getCastInData(schema, inData); if (validate) { return schema.validate(castInData, configuration); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java index 79a3e781051..431fa2c90da 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java @@ -3,6 +3,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import java.util.Map; @@ -17,16 +19,16 @@ public ContentParameter(String name, ParameterInType inType, boolean required, @ } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException { for (Map.Entry> entry: content.entrySet()) { String contentType = entry.getKey(); if (ContentTypeDetector.contentTypeIsJson(contentType)) { var value = ContentTypeSerializer.toJson(inData); return new AbstractMap.SimpleEntry<>(name, value); } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); } } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java index 8acfdafcc8a..eef0b6bc371 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java @@ -2,6 +2,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.header.StyleSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import java.util.AbstractMap; @@ -26,7 +27,7 @@ private ParameterStyle getStyle() { } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { ParameterStyle usedStyle = getStyle(); boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; String value; @@ -52,7 +53,7 @@ public AbstractMap.SimpleEntry serialize(@Nullable Object inData } else { // usedStyle == ParameterStyle.DEEP_OBJECT // query - throw new RuntimeException("Style deep object serialization has not yet been implemented."); + throw new NotImplementedException("Style deep object serialization has not yet been implemented."); } return new AbstractMap.SimpleEntry<>(name, value); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java index 27ad3c01c6a..056f15d6bf6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java index bad071e523a..3529cf03198 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fake.get.responses.code404response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code404Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java index dcd5c9d2941..8039dbe0b25 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fake.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java index fb498802410..d8110d89ad9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java index 5a4986b6599..c8224c9af44 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java index aa4e6dc53e3..a1e2e365273 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java index e770ec7cffa..fdef16fe8ad 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java index c627ade2788..9a10c168c6c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakehealth.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java index 27d0bbde2b1..e2f7034a0c6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.multipartformdata.MultipartformdataSchema; @@ -53,7 +54,7 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); @@ -62,7 +63,7 @@ protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConf var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new MultipartformdataResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java index a8ca91508c2..dad71472f80 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.code200response.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof Applicationjsoncharsetutf8MediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new Applicationjsoncharsetutf8ResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java index 9f1305f5a53..89548108ae7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java index 512d493671e..d10acdde19e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java index d1636e41852..c3c41f9310d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code202response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code202Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java index e7e77c03021..f67ff2f3bf2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java index 6cb92112b23..9a6323102b8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java index 35ea54800af..1e6f3cf2906 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.code200response.content.applicationxpemfile.ApplicationxpemfileSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationxpemfileMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxpemfileResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java index df5ef4ffa28..f74b1521612 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java index 44a7d6d9a17..0de083d95f0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java index fe6da3290d3..3d812da9d2c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java index 0bceda71429..6bed92fa9f4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java index d2fa881818b..dcb539f70de 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java index 9b5ea0b64fb..8859efafeb4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java index 390ac805456..093976f6854 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java index 2261c15e675..88aab07efef 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java index 8e6a2da362b..15854803e7e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java index 2d9310a09b8..337194bcca7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java index bb1a8ebb079..b7e5cdc80ad 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java index 83e7c808d89..c7943bcba31 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java index 7642e09bbab..eaba13c2ffd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java index d9cc9ea080e..3c369189086 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.AbstractMap; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java index ed9e9a5ddd3..ce3f6db3bc5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.code200response.content.applicationoctetstream.ApplicationoctetstreamSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationoctetstreamMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationoctetstreamResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java index 28e807c4652..0e63a6dd0b8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java index 3a6ae53b8c7..0b22d9a395e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java index 5ff45188ea1..2acfd0211cb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code1xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code1XXResponse1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java index d3071a30f8b..d68283badb1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java index f228579433a..6a0dc760f46 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code2xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code2XXResponse1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java index ed9d6a23972..639e8181015 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code3xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code3XXResponse1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java index eb7716a00f8..29484e94819 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code4xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code4XXResponse1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java index 9f7c642f907..0f90b52c550 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code5xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public Code5XXResponse1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java index 91752fd80e6..9d30ccd06e1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.foo.get.responses.codedefaultresponse.content.applicationjson.ApplicationjsonSchema; @@ -40,13 +41,13 @@ public CodedefaultResponse1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java index 539923899ea..a7baa5bdeff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java index e94b1366c9a..13316edda8b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java index 15458d50d4f..41448e477ca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java index e3ba5312b16..fb14c4ae021 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java index 43e52729869..703a195d0d1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java index 7d7ae379884..151dfd16669 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java index 1fdfd986a90..405f3e16a44 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java index ebd39fc2a6e..a22fd6a07b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -53,7 +54,7 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); @@ -62,7 +63,7 @@ protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConf var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java index 7a6c696b19d..21a73ecef8d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java index 58e9da0d7dc..ebae5c97585 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java index 62d6a28f1be..ff393dda042 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java index 955c9af34c2..6366cc09898 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -53,7 +54,7 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); @@ -62,7 +63,7 @@ protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConf var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java index bf641ab9529..3a8fe613194 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java index a0291a06814..1660246acfd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java index 99efb7324e5..b975b72c699 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java index 44e93fc81e5..54af7ec1753 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -53,7 +54,7 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); @@ -62,7 +63,7 @@ protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConf var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java index 00aa94771da..7bba68ec0a5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java index eb7b27cea75..3279aa5e422 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java index e3555812d7d..d2e7f5b7279 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java index 1de3940666e..deab4ccba65 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java index 71c7481101d..cf9857bbb90 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java index fc6f3fd1454..9cb43cc74a9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -55,7 +56,7 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); @@ -64,7 +65,7 @@ protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConf var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java index ff44cd75c14..4afc7473bd5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java index c456e073d08..153c9c0c118 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java index 3086e739dfb..1564a290264 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -53,7 +54,7 @@ public Code200Response1() { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); @@ -62,7 +63,7 @@ protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConf var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java index 1612e8c8da1..80b2aa13ca9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java index 7533ab39e11..4ad8dbb5634 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java index a9207b46b15..e65d8c25ebd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java index 6226880fa67..7815f74140d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java index 37fb90cd4f2..c18134a4086 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java @@ -5,6 +5,7 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.Map; @@ -33,13 +34,13 @@ private SerializedRequestBody serializeTextPlain(String contentType, @Nullable O 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) { + 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 RuntimeException("Serialization has not yet been implemented for contentType="+contentType+". If you need it please file a PR"); + 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); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java index 59079f9f1a1..0ab4d4ce702 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java @@ -15,6 +15,10 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.header.Header; public abstract class ResponseDeserializer { @@ -42,7 +46,7 @@ protected String deserializeTextPlain(byte[] body) { return new String(body, StandardCharsets.UTF_8); } - protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) { + protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { if (ContentTypeDetector.contentTypeIsJson(contentType)) { @Nullable Object bodyData = deserializeJson(body); return schema.validateAndBox(bodyData, configuration); @@ -50,17 +54,17 @@ protected T deserializeBody(String contentType, byte[] body, JsonSchema s String bodyData = deserializeTextPlain(body); return schema.validateAndBox(bodyData, configuration); } - throw new RuntimeException("Deserialization for contentType="+contentType+" has not yet been implemented."); + throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); } - public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { - throw new RuntimeException("Invalid response returned, Content-Type header is missing and it must be included"); + throw new OpenapiDocumentException("Invalid response returned, Content-Type header is missing and it must be included"); } String contentType = contentTypeInfo.get(); if (content != null && !content.containsKey(contentType)) { - throw new RuntimeException( + throw new OpenapiDocumentException( "Invalid contentType returned. contentType="+contentType+" was returned "+ "when only "+content.keySet()+" are defined for statusCode="+response.statusCode() ); diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java index 59eb84f6049..d79170e0661 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java @@ -730,6 +730,8 @@ public void processOpts() { exceptionClasses.add("BaseException"); exceptionClasses.add("InvalidAdditionalPropertyException"); exceptionClasses.add("InvalidTypeException"); + exceptionClasses.add("NotImplementedException"); + exceptionClasses.add("OpenapiDocumentException"); exceptionClasses.add("UnsetPropertyException"); exceptionClasses.add("ValidationException"); for (String exceptionClass: exceptionClasses) { diff --git a/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs b/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs index 6fc4e9b3745..49245cd4507 100644 --- a/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs @@ -14,6 +14,7 @@ import {{packageName}}.configurations.SchemaConfiguration; import {{packageName}}.response.ResponseDeserializer; import {{packageName}}.response.DeserializedHttpResponse; import {{packageName}}.exceptions.ApiException; +import {{packageName}}.exceptions.OpenapiDocumentException; {{#if hasContentSchema}} import {{packageName}}.mediatype.MediaType; {{else}} @@ -83,7 +84,7 @@ public class {{jsonPathPiece.pascalCase}} { protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); } {{#each content}} {{#if @first}} @@ -95,7 +96,7 @@ public class {{jsonPathPiece.pascalCase}} { return new {{@key.pascalCase}}ResponseBody(deserializedBody); {{/each}} } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } {{else}} @Override diff --git a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs index 86916d47b17..07c6e1d36d9 100644 --- a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs +++ b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs @@ -21,6 +21,7 @@ import {{packageName}}.{{jsonPathPiece.pascalCase}}; {{/each}} {{#if securitySchemes}} import {{packageName}}.securityschemes.SecurityScheme; +import {{packageName}}.exceptions.UnsetPropertyException; {{/if}} import org.checkerframework.checker.nullness.qual.Nullable; @@ -168,7 +169,7 @@ public class ApiConfiguration { 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."); + throw new UnsetPropertyException("SecurityScheme of class " + securitySchemeClass + "cannot be returned because it is unset. Pass in an instance of it in securitySchemes when instantiating ApiConfiguration."); } return securityScheme; } diff --git a/src/main/resources/java/src/main/java/packagename/exceptions/BaseException.hbs b/src/main/resources/java/src/main/java/packagename/exceptions/BaseException.hbs index eb3da9339a5..d678e2fcaff 100644 --- a/src/main/resources/java/src/main/java/packagename/exceptions/BaseException.hbs +++ b/src/main/resources/java/src/main/java/packagename/exceptions/BaseException.hbs @@ -1,7 +1,7 @@ package {{{packageName}}}.exceptions; @SuppressWarnings("serial") -public class BaseException extends RuntimeException { +public class BaseException extends Exception { public BaseException(String s) { super(s); } diff --git a/src/main/resources/java/src/main/java/packagename/exceptions/NotImplementedException.hbs b/src/main/resources/java/src/main/java/packagename/exceptions/NotImplementedException.hbs new file mode 100644 index 00000000000..00cdf1273d6 --- /dev/null +++ b/src/main/resources/java/src/main/java/packagename/exceptions/NotImplementedException.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.exceptions; + +@SuppressWarnings("serial") +public class NotImplementedException extends BaseException { + public NotImplementedException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/exceptions/OpenapiDocumentException.hbs b/src/main/resources/java/src/main/java/packagename/exceptions/OpenapiDocumentException.hbs new file mode 100644 index 00000000000..6514551b1f5 --- /dev/null +++ b/src/main/resources/java/src/main/java/packagename/exceptions/OpenapiDocumentException.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.exceptions; + +@SuppressWarnings("serial") +public class OpenapiDocumentException extends BaseException { + public OpenapiDocumentException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs b/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs index ced388d5803..ebbd848f094 100644 --- a/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs @@ -5,6 +5,8 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.contenttype.ContentTypeDetector; import {{{packageName}}}.contenttype.ContentTypeSerializer; import {{{packageName}}}.contenttype.ContentTypeDeserializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.OpenapiDocumentException; import {{{packageName}}}.mediatype.MediaType; import {{{packageName}}}.parameter.ParameterStyle; @@ -28,7 +30,7 @@ public class ContentHeader extends HeaderBase implements Header { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, OpenapiDocumentException { for (Map.Entry> entry: content.entrySet()) { var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; String contentType = entry.getKey(); @@ -36,14 +38,14 @@ public class ContentHeader extends HeaderBase implements Header { var value = ContentTypeSerializer.toJson(castInData); return toHeaders(name, value); } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); } } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, OpenapiDocumentException { String inDataJoined = String.join(",", inData); // unsure if this is needed @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); if (validate) { @@ -52,10 +54,10 @@ public class ContentHeader extends HeaderBase implements Header { if (ContentTypeDetector.contentTypeIsJson(contentType)) { return entry.getValue().schema().validate(deserializedJson, configuration); } else { - throw new RuntimeException("Header deserialization of "+contentType+" has not yet been implemented"); + throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); } } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); } return deserializedJson; } diff --git a/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs b/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs index f6e45696151..950c9c30dbd 100644 --- a/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs @@ -2,6 +2,7 @@ package {{{packageName}}}.header; import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.NotImplementedException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -20,7 +21,7 @@ public class Rfc6570Serializer { private static final String ENCODING = "UTF-8"; private static final Set namedParameterSeparators = Set.of("&", ";"); - private static String percentEncode(String s) { + private static String percentEncode(String s) throws NotImplementedException { if (s == null) { return ""; } @@ -31,11 +32,11 @@ public class Rfc6570Serializer { .replace("%7E", "~"); // This could be done faster with more hand-crafted code. } catch (UnsupportedEncodingException wow) { - throw new RuntimeException(wow.getMessage(), wow); + throw new NotImplementedException(wow.getMessage(), wow); } } - private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) { + 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= @@ -62,7 +63,7 @@ public class Rfc6570Serializer { // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 return null; } - throw new InvalidTypeException("Unable to generate a rfc6570 item representation of "+item); + throw new NotImplementedException("Unable to generate a rfc6570 item representation of "+item); } private static String rfc6570StrNumberExpansion( @@ -71,7 +72,7 @@ public class Rfc6570Serializer { 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; @@ -87,7 +88,7 @@ public class Rfc6570Serializer { PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { + ) throws NotImplementedException { var itemValues = inData.stream() .map(v -> rfc6570ItemValue(v, percentEncode)) .filter(Objects::nonNull) @@ -116,7 +117,7 @@ public class Rfc6570Serializer { PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { + ) throws NotImplementedException { var inDataMap = inData.entrySet().stream() .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), rfc6570ItemValue(entry.getValue(), percentEncode))) .filter(entry -> entry.getValue() != null) @@ -143,7 +144,7 @@ public class Rfc6570Serializer { boolean explode, boolean percentEncode, PrefixSeparatorIterator prefixSeparatorIterator - ) { + ) throws NotImplementedException { /* Separator is for separate variables like dict with explode true, not for array item separation @@ -181,6 +182,6 @@ public class Rfc6570Serializer { ); } // bool, bytes, etc - throw new InvalidTypeException("Unable to generate a rfc6570 representation of "+inData); + throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); } } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs b/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs index d09a12e8388..9542bf18f44 100644 --- a/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs @@ -3,6 +3,7 @@ package {{{packageName}}}.header; import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.contenttype.ContentTypeDeserializer; +import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.parameter.ParameterStyle; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaFactory; @@ -49,7 +50,7 @@ public class SchemaHeader extends HeaderBase implements Header { 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) { + 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<>(); @@ -60,7 +61,7 @@ public class SchemaHeader extends HeaderBase implements Header { return castList; } - private @Nullable Object getCastInData(JsonSchema schema, List inData) { + private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { if (schema.type == null) { if (inData.size() == 1) { return inData.get(0); @@ -68,7 +69,7 @@ public class SchemaHeader extends HeaderBase implements Header { return getList(schema, inData); } else if (schema.type.size() == 1) { if (schema.type.equals(BOOLEAN_TYPES)) { - throw new RuntimeException("Boolean serialization is not defined in Rfc6570, there is no agreed upon way to sent a boolean, send a string enum instead"); + 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) { @@ -76,16 +77,16 @@ public class SchemaHeader extends HeaderBase implements Header { } else if (schema.type.equals(LIST_TYPES)) { return getList(schema, inData); } else if (schema.type.equals(MAP_TYPES)) { - throw new RuntimeException("Header map deserialization has not yet been implemented"); + 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 RuntimeException("Header deserialization for schemas with multiple types has not yet been implemented"); + 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) { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException { @Nullable Object castInData = getCastInData(schema, inData); if (validate) { return schema.validate(castInData, configuration); diff --git a/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs b/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs index 7c59ecc53b0..2902dd97a54 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs @@ -3,6 +3,8 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.contenttype.ContentTypeDetector; import {{{packageName}}}.contenttype.ContentTypeSerializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.OpenapiDocumentException; import {{{packageName}}}.mediatype.MediaType; import java.util.Map; @@ -17,16 +19,16 @@ public class ContentParameter extends ParameterBase implements Parameter { } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException { for (Map.Entry> entry: content.entrySet()) { String contentType = entry.getKey(); if (ContentTypeDetector.contentTypeIsJson(contentType)) { var value = ContentTypeSerializer.toJson(inData); return new AbstractMap.SimpleEntry<>(name, value); } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); } } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); } } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/parameter/SchemaParameter.hbs b/src/main/resources/java/src/main/java/packagename/parameter/SchemaParameter.hbs index 210d5a7909b..23327283938 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/SchemaParameter.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/SchemaParameter.hbs @@ -2,6 +2,7 @@ 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; @@ -26,7 +27,7 @@ public class SchemaParameter extends ParameterBase implements Parameter { } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { ParameterStyle usedStyle = getStyle(); boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; String value; @@ -52,7 +53,7 @@ public class SchemaParameter extends ParameterBase implements Parameter { } else { // usedStyle == ParameterStyle.DEEP_OBJECT // query - throw new RuntimeException("Style deep object serialization has not yet been implemented."); + throw new NotImplementedException("Style deep object serialization has not yet been implemented."); } return new AbstractMap.SimpleEntry<>(name, value); } diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index 5f8a5ba8bbe..b4340f479b5 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -185,6 +185,14 @@ var request = new {{className.pascalCase}}() {{/each}} {{/eq}} -{{#if nonErrorResponses }}{{responses.jsonPathPiece.pascalCase}}.EndpointResponse{{else}}Void{{/if}} response = apiClient.{{jsonPathPiece.camelCase}}(request); +try { + {{#if nonErrorResponses }}{{responses.jsonPathPiece.pascalCase}}.EndpointResponse{{else}}Void{{/if}} response = apiClient.{{jsonPathPiece.camelCase}}(request); +} catch (ApiException e) { + // server returned a response not defined in the openapi document + throw e; +} catch (RuntimeException e) { + // + throw e; +} {{/with}} ``` \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/requestbody/RequestBodySerializer.hbs b/src/main/resources/java/src/main/java/packagename/requestbody/RequestBodySerializer.hbs index 312b163fe2c..238c530d28f 100644 --- a/src/main/resources/java/src/main/java/packagename/requestbody/RequestBodySerializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/requestbody/RequestBodySerializer.hbs @@ -5,6 +5,7 @@ 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; @@ -33,13 +34,13 @@ public abstract class RequestBodySerializer { 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) { + 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 RuntimeException("Serialization has not yet been implemented for contentType="+contentType+". If you need it please file a PR"); + 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); diff --git a/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs b/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs index 0d19a394328..5d1b183fbd1 100644 --- a/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs @@ -15,6 +15,10 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.contenttype.ContentTypeDetector; import {{{packageName}}}.contenttype.ContentTypeDeserializer; +import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.OpenapiDocumentException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.header.Header; public abstract class ResponseDeserializer { @@ -42,7 +46,7 @@ public abstract class ResponseDeserializer T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) { + protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { if (ContentTypeDetector.contentTypeIsJson(contentType)) { @Nullable Object bodyData = deserializeJson(body); return schema.validateAndBox(bodyData, configuration); @@ -50,17 +54,17 @@ public abstract class ResponseDeserializer deserialize(HttpResponse response, SchemaConfiguration configuration) { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { - throw new RuntimeException("Invalid response returned, Content-Type header is missing and it must be included"); + throw new OpenapiDocumentException("Invalid response returned, Content-Type header is missing and it must be included"); } String contentType = contentTypeInfo.get(); if (content != null && !content.containsKey(contentType)) { - throw new RuntimeException( + throw new OpenapiDocumentException( "Invalid contentType returned. contentType="+contentType+" was returned "+ "when only "+content.keySet()+" are defined for statusCode="+response.statusCode() ); From 2f9419d3d8756c037c6d26866ef9013f5838ba1f Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 1 Apr 2024 15:19:50 -0700 Subject: [PATCH 18/53] Adds exception throwing to json schema code --- .../client/schemas/AnyTypeJsonSchema.java | 20 +++++++++---------- .../client/schemas/BooleanJsonSchema.java | 2 +- .../client/schemas/DateJsonSchema.java | 4 ++-- .../client/schemas/DateTimeJsonSchema.java | 4 ++-- .../client/schemas/DecimalJsonSchema.java | 2 +- .../client/schemas/DoubleJsonSchema.java | 4 ++-- .../client/schemas/FloatJsonSchema.java | 4 ++-- .../client/schemas/Int32JsonSchema.java | 6 +++--- .../client/schemas/Int64JsonSchema.java | 10 +++++----- .../client/schemas/IntJsonSchema.java | 10 +++++----- .../client/schemas/ListJsonSchema.java | 4 ++-- .../client/schemas/MapJsonSchema.java | 4 ++-- .../client/schemas/NotAnyTypeJsonSchema.java | 20 +++++++++---------- .../client/schemas/NullJsonSchema.java | 2 +- .../client/schemas/NumberJsonSchema.java | 10 +++++----- .../client/schemas/StringJsonSchema.java | 8 ++++---- .../client/schemas/UuidJsonSchema.java | 4 ++-- .../client/schemas/validation/JsonSchema.java | 14 ++++++------- .../validation/ListSchemaValidator.java | 2 +- .../validation/MapSchemaValidator.java | 2 +- .../validation/UnsetAnyTypeJsonSchema.java | 20 +++++++++---------- .../packagename/schemas/AnyTypeJsonSchema.hbs | 20 +++++++++---------- .../packagename/schemas/BooleanJsonSchema.hbs | 2 +- .../packagename/schemas/DateJsonSchema.hbs | 4 ++-- .../schemas/DateTimeJsonSchema.hbs | 4 ++-- .../packagename/schemas/DecimalJsonSchema.hbs | 2 +- .../packagename/schemas/DoubleJsonSchema.hbs | 4 ++-- .../packagename/schemas/FloatJsonSchema.hbs | 4 ++-- .../packagename/schemas/Int32JsonSchema.hbs | 6 +++--- .../packagename/schemas/Int64JsonSchema.hbs | 10 +++++----- .../packagename/schemas/IntJsonSchema.hbs | 10 +++++----- .../packagename/schemas/ListJsonSchema.hbs | 4 ++-- .../packagename/schemas/MapJsonSchema.hbs | 4 ++-- .../schemas/NotAnyTypeJsonSchema.hbs | 20 +++++++++---------- .../packagename/schemas/NullJsonSchema.hbs | 2 +- .../packagename/schemas/NumberJsonSchema.hbs | 10 +++++----- .../packagename/schemas/StringJsonSchema.hbs | 8 ++++---- .../packagename/schemas/UuidJsonSchema.hbs | 4 ++-- .../schemas/validation/JsonSchema.hbs | 14 ++++++------- .../validation/ListSchemaValidator.hbs | 2 +- .../schemas/validation/MapSchemaValidator.hbs | 2 +- .../validation/UnsetAnyTypeJsonSchema.hbs | 20 +++++++++---------- 42 files changed, 156 insertions(+), 156 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index 0ffcae114bd..962157dbcc6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -121,19 +121,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -149,20 +149,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -192,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -226,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java index 2cceae9d49f..f8b78b08c09 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java @@ -55,7 +55,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index 15b5ca67f26..9cfe5b9d861 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -57,12 +57,12 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java index e695f3c2ac9..cafbebb9017 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java @@ -57,12 +57,12 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java index f961e94f802..65b957698bc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java @@ -57,7 +57,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java index 56f7894f670..751e2f4d353 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java @@ -56,12 +56,12 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java index 65221627b46..7c8ddfa15f1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java @@ -56,12 +56,12 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java index 836fa1db724..384f09f1796 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java @@ -59,16 +59,16 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java index da3f9d8d5f7..1ce24379e6a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java @@ -61,24 +61,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java index 6205c5b4380..fdb1ce8d6a4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java @@ -61,24 +61,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index 7ebb3106467..565ac49ef93 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -48,7 +48,7 @@ public static ListJsonSchema1 getInstance() { } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -78,7 +78,7 @@ public static ListJsonSchema1 getInstance() { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index 47e141dac53..16a084a6a07 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -49,7 +49,7 @@ public static MapJsonSchema1 getInstance() { } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -82,7 +82,7 @@ public static MapJsonSchema1 getInstance() { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index de1ed91b0cd..e084922a19f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -123,19 +123,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -151,20 +151,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -194,7 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -228,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java index d028dbf295e..ae78802e2fe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java @@ -56,7 +56,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java index 5c33b047d95..d8d31a8e9e4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java @@ -60,24 +60,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java index 749f5faba63..fad38a479cc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java @@ -57,20 +57,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java index c2087929db7..b03821b3be8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java @@ -57,12 +57,12 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index beb7460b86c..8da18342f92 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -262,7 +262,7 @@ private List getContainsPathToSchemas( private PathToSchemasMap getPatternPropertiesPathToSchemas( @Nullable Object arg, ValidationMetadata validationMetadata - ) { + ) throws ValidationException { if (!(arg instanceof Map mapArg) || patternProperties == null) { return new PathToSchemasMap(); } @@ -270,7 +270,7 @@ private PathToSchemasMap getPatternPropertiesPathToSchemas( for (Map.Entry entry: mapArg.entrySet()) { Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new InvalidTypeException("Invalid non-string type for map key"); + throw new ValidationException("Invalid non-string type for map key"); } List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); propPathToItem.add(key); @@ -306,7 +306,7 @@ private PathToSchemasMap getIfPathToSchemas( try { var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException | InvalidTypeException ignored) {} + } catch (ValidationException ignored) {} return pathToSchemas; } @@ -389,7 +389,7 @@ protected Void castToAllowedTypes(Void arg, List pathToItem, Set castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws InvalidTypeException { pathSet.add(pathToItem); List<@Nullable Object> argFixed = new ArrayList<>(); int i =0; @@ -403,7 +403,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws throws InvalidTypeException { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @@ -420,7 +420,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set pathToItem, Set> pathSet) { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws throws InvalidTypeException { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { @@ -468,7 +468,7 @@ public String getNewInstance(String arg, List pathToItem, PathToSchemasM return arg; } - protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) { + protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) throws ValidationException { PathToSchemasMap pathToSchemasMap = new PathToSchemasMap(); // todo add check of validationMetadata.validationRanEarlier(this) PathToSchemasMap otherPathToSchemas = validate(jsonSchema, arg, validationMetadata); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index d0ff52b29c8..96a6688a960 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -7,7 +7,7 @@ import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws throws InvalidTypeException; OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java index 984693428e8..5633ebe09f9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java @@ -8,7 +8,7 @@ import java.util.Map; public interface MapSchemaValidator { - OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index 1c23a427dd0..f336ac80c0d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -108,19 +108,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -136,20 +136,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -179,7 +179,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -213,7 +213,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { diff --git a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs index 6b28b58204b..7b1694812d8 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs @@ -121,19 +121,19 @@ public class AnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -149,20 +149,20 @@ public class AnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -192,7 +192,7 @@ public class AnyTypeJsonSchema { } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -226,7 +226,7 @@ public class AnyTypeJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { diff --git a/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs index 3e7af6f87b4..3540f718fa5 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs @@ -55,7 +55,7 @@ public class BooleanJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs index dabd73a8398..964e449d4fc 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs @@ -57,12 +57,12 @@ public class DateJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs index b18195dce18..62b4823fae6 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs @@ -57,12 +57,12 @@ public class DateTimeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs index 609cdb31e4b..d8c618945c5 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs @@ -57,7 +57,7 @@ public class DecimalJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs index e668e781762..9149940ca6e 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs @@ -56,12 +56,12 @@ public class DoubleJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs index 7256d2d2b44..ed4d2e39fff 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs @@ -56,12 +56,12 @@ public class FloatJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs index 8070af2f97b..a6a0fd8b1fd 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs @@ -59,16 +59,16 @@ public class Int32JsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs index 0f02ee44e78..d81bf7853e5 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs @@ -61,24 +61,24 @@ public class Int64JsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs index 679b44450b0..5df7c400271 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs @@ -61,24 +61,24 @@ public class IntJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs index c50c191ac97..740968e12a8 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs @@ -48,7 +48,7 @@ public class ListJsonSchema { } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -78,7 +78,7 @@ public class ListJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs index b1035439e4c..7fd6e414867 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs @@ -49,7 +49,7 @@ public class MapJsonSchema { } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -82,7 +82,7 @@ public class MapJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs index d29ccc17ff9..50144c10d6e 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -123,19 +123,19 @@ public class NotAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -151,20 +151,20 @@ public class NotAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -194,7 +194,7 @@ public class NotAnyTypeJsonSchema { } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -228,7 +228,7 @@ public class NotAnyTypeJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs index 06da666054b..4690c66f136 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs @@ -56,7 +56,7 @@ public class NullJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs index a980452e6ab..4d2cefacd9d 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs @@ -60,24 +60,24 @@ public class NumberJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs index b1d30874a11..9d3face2485 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs @@ -57,20 +57,20 @@ public class StringJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs index 806c13edc67..12757a78386 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs @@ -57,12 +57,12 @@ public class UuidJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs index ce97034c425..ad3e44014b7 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs @@ -262,7 +262,7 @@ public abstract class JsonSchema { private PathToSchemasMap getPatternPropertiesPathToSchemas( @Nullable Object arg, ValidationMetadata validationMetadata - ) { + ) throws ValidationException { if (!(arg instanceof Map mapArg) || patternProperties == null) { return new PathToSchemasMap(); } @@ -270,7 +270,7 @@ public abstract class JsonSchema { for (Map.Entry entry: mapArg.entrySet()) { Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new InvalidTypeException("Invalid non-string type for map key"); + throw new ValidationException("Invalid non-string type for map key"); } List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); propPathToItem.add(key); @@ -306,7 +306,7 @@ public abstract class JsonSchema { try { var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException | InvalidTypeException ignored) {} + } catch (ValidationException ignored) {} return pathToSchemas; } @@ -389,7 +389,7 @@ public abstract class JsonSchema { return arg; } - protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws InvalidTypeException { pathSet.add(pathToItem); List<@Nullable Object> argFixed = new ArrayList<>(); int i =0; @@ -403,7 +403,7 @@ public abstract class JsonSchema { return argFixed; } - protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws throws InvalidTypeException { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @@ -420,7 +420,7 @@ public abstract class JsonSchema { return argFixed; } - private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws throws InvalidTypeException { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { @@ -468,7 +468,7 @@ public abstract class JsonSchema { return arg; } - protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) { + protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) throws ValidationException { PathToSchemasMap pathToSchemasMap = new PathToSchemasMap(); // todo add check of validationMetadata.validationRanEarlier(this) PathToSchemasMap otherPathToSchemas = validate(jsonSchema, arg, validationMetadata); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs index 211eefedc4b..05c8aabdeb8 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs @@ -7,7 +7,7 @@ import {{{packageName}}}.exceptions.ValidationException; import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws throws InvalidTypeException; OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs index b40a58ac39c..a82f53bede1 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs @@ -8,7 +8,7 @@ import java.util.List; import java.util.Map; public interface MapSchemaValidator { - OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index 54dfe11b32b..a1a444554c2 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -108,19 +108,19 @@ public class UnsetAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -136,20 +136,20 @@ public class UnsetAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -179,7 +179,7 @@ public class UnsetAnyTypeJsonSchema { } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -213,7 +213,7 @@ public class UnsetAnyTypeJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { From e91dc1381729f3ba9aab0ecd9ab9c56d899dc843 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 1 Apr 2024 15:52:17 -0700 Subject: [PATCH 19/53] Updates all valudators to include exception throws in their signatures --- .../schemas/validation/AdditionalPropertiesValidator.java | 4 +++- .../client/schemas/validation/AllOfValidator.java | 4 +++- .../client/schemas/validation/AnyOfValidator.java | 2 +- .../client/schemas/validation/BigDecimalValidator.java | 2 +- .../client/schemas/validation/ConstValidator.java | 2 +- .../client/schemas/validation/ContainsValidator.java | 2 +- .../schemas/validation/DependentRequiredValidator.java | 2 +- .../schemas/validation/DependentSchemasValidator.java | 3 ++- .../client/schemas/validation/ElseValidator.java | 2 +- .../client/schemas/validation/EnumValidator.java | 2 +- .../schemas/validation/ExclusiveMaximumValidator.java | 2 +- .../schemas/validation/ExclusiveMinimumValidator.java | 2 +- .../client/schemas/validation/FormatValidator.java | 6 +++--- .../client/schemas/validation/IfValidator.java | 2 +- .../client/schemas/validation/ItemsValidator.java | 3 ++- .../client/schemas/validation/JsonSchema.java | 4 ++-- .../client/schemas/validation/ListSchemaValidator.java | 2 +- .../client/schemas/validation/MaxContainsValidator.java | 2 +- .../client/schemas/validation/MaxItemsValidator.java | 2 +- .../client/schemas/validation/MaxLengthValidator.java | 2 +- .../client/schemas/validation/MaxPropertiesValidator.java | 2 +- .../client/schemas/validation/MaximumValidator.java | 2 +- .../client/schemas/validation/MinContainsValidator.java | 2 +- .../client/schemas/validation/MinItemsValidator.java | 2 +- .../client/schemas/validation/MinLengthValidator.java | 2 +- .../client/schemas/validation/MinPropertiesValidator.java | 2 +- .../client/schemas/validation/MinimumValidator.java | 2 +- .../client/schemas/validation/MultipleOfValidator.java | 2 +- .../client/schemas/validation/NotValidator.java | 2 +- .../client/schemas/validation/NullSchemaValidator.java | 3 --- .../client/schemas/validation/OneOfValidator.java | 2 +- .../client/schemas/validation/PatternValidator.java | 2 +- .../client/schemas/validation/PrefixItemsValidator.java | 3 ++- .../client/schemas/validation/PropertiesValidator.java | 3 ++- .../client/schemas/validation/PropertyNamesValidator.java | 3 ++- .../client/schemas/validation/RequiredValidator.java | 4 ++-- .../client/schemas/validation/ThenValidator.java | 3 +-- .../client/schemas/validation/TypeValidator.java | 4 ++-- .../schemas/validation/UnevaluatedItemsValidator.java | 3 ++- .../schemas/validation/UnevaluatedPropertiesValidator.java | 6 +++--- .../client/schemas/validation/UniqueItemsValidator.java | 4 ++-- .../schemas/validation/AdditionalPropertiesValidator.hbs | 4 +++- .../java/packagename/schemas/validation/AllOfValidator.hbs | 4 +++- .../java/packagename/schemas/validation/AnyOfValidator.hbs | 2 +- .../packagename/schemas/validation/BigDecimalValidator.hbs | 2 +- .../java/packagename/schemas/validation/ConstValidator.hbs | 2 +- .../packagename/schemas/validation/ContainsValidator.hbs | 2 +- .../schemas/validation/DependentRequiredValidator.hbs | 2 +- .../schemas/validation/DependentSchemasValidator.hbs | 3 ++- .../java/packagename/schemas/validation/ElseValidator.hbs | 2 +- .../java/packagename/schemas/validation/EnumValidator.hbs | 2 +- .../schemas/validation/ExclusiveMaximumValidator.hbs | 2 +- .../schemas/validation/ExclusiveMinimumValidator.hbs | 2 +- .../java/packagename/schemas/validation/FormatValidator.hbs | 6 +++--- .../java/packagename/schemas/validation/IfValidator.hbs | 2 +- .../java/packagename/schemas/validation/ItemsValidator.hbs | 3 ++- .../main/java/packagename/schemas/validation/JsonSchema.hbs | 4 ++-- .../packagename/schemas/validation/ListSchemaValidator.hbs | 2 +- .../packagename/schemas/validation/MaxContainsValidator.hbs | 2 +- .../packagename/schemas/validation/MaxItemsValidator.hbs | 2 +- .../packagename/schemas/validation/MaxLengthValidator.hbs | 2 +- .../schemas/validation/MaxPropertiesValidator.hbs | 2 +- .../packagename/schemas/validation/MaximumValidator.hbs | 2 +- .../packagename/schemas/validation/MinContainsValidator.hbs | 2 +- .../packagename/schemas/validation/MinItemsValidator.hbs | 2 +- .../packagename/schemas/validation/MinLengthValidator.hbs | 2 +- .../schemas/validation/MinPropertiesValidator.hbs | 2 +- .../packagename/schemas/validation/MinimumValidator.hbs | 2 +- .../packagename/schemas/validation/MultipleOfValidator.hbs | 2 +- .../java/packagename/schemas/validation/NotValidator.hbs | 2 +- .../packagename/schemas/validation/NullSchemaValidator.hbs | 3 --- .../java/packagename/schemas/validation/OneOfValidator.hbs | 2 +- .../packagename/schemas/validation/PatternValidator.hbs | 2 +- .../packagename/schemas/validation/PrefixItemsValidator.hbs | 3 ++- .../packagename/schemas/validation/PropertiesValidator.hbs | 3 ++- .../schemas/validation/PropertyNamesValidator.hbs | 3 ++- .../packagename/schemas/validation/RequiredValidator.hbs | 4 ++-- .../java/packagename/schemas/validation/ThenValidator.hbs | 3 +-- .../java/packagename/schemas/validation/TypeValidator.hbs | 4 ++-- .../schemas/validation/UnevaluatedItemsValidator.hbs | 3 ++- .../schemas/validation/UnevaluatedPropertiesValidator.hbs | 6 +++--- .../packagename/schemas/validation/UniqueItemsValidator.hbs | 4 ++-- 82 files changed, 116 insertions(+), 104 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java index 64d9f476798..b7afc854c15 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java @@ -1,5 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -11,7 +13,7 @@ public class AdditionalPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java index eb6bcf21d4a..4b969c68a20 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java @@ -1,11 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; public class AllOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var allOf = data.schema().allOf; if (allOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java index d466518d3fe..19d4e0337c9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java @@ -10,7 +10,7 @@ public class AnyOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var anyOf = data.schema().anyOf; if (anyOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java index cb28fcb9662..639d32e889e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java @@ -5,7 +5,7 @@ import java.math.BigDecimal; public abstract class BigDecimalValidator { - protected BigDecimal getBigDecimal(Number arg) { + protected BigDecimal getBigDecimal(Number arg) throws ValidationException { if (arg instanceof Integer) { return new BigDecimal((Integer) arg); } else if (arg instanceof Long) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java index 6409a23e5ca..93872adcc2f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java @@ -10,7 +10,7 @@ public class ConstValidator extends BigDecimalValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!data.schema().constValueSet) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java index fbfd1c9c700..41565577d58 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java @@ -9,7 +9,7 @@ public class ContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof List)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java index 77b21ca801d..2640e2f6d8d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java @@ -11,7 +11,7 @@ public class DependentRequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java index e329529fe8a..f51b5eaf339 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashSet; import java.util.Map; @@ -10,7 +11,7 @@ public class DependentSchemasValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java index 3f50d9326c4..337af4a9a60 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java @@ -8,7 +8,7 @@ public class ElseValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var elseSchema = data.schema().elseSchema; if (elseSchema == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java index 8af756619bd..66563d80960 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java @@ -15,7 +15,7 @@ private static boolean enumContainsArg(Set<@Nullable Object> enumValues, @Nullab @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var enumValues = data.schema().enumValues; if (enumValues == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java index 7d05ff65546..e05df98079f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMaximum = data.schema().exclusiveMaximum; if (exclusiveMaximum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java index 73eb1e547c3..0e06f391f62 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMinimum = data.schema().exclusiveMinimum; if (exclusiveMinimum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java index c1ca45e44f3..35c089a03c7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java @@ -18,7 +18,7 @@ public class FormatValidator implements KeywordValidator { private final static BigDecimal doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308d); private final static BigDecimal doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308d); - private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) { + private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) throws ValidationException { if (format.startsWith("int")) { // there is a json schema test where 1.0 validates as an integer BigInteger intArg; @@ -85,7 +85,7 @@ private static void validateNumericFormat(Number arg, ValidationMetadata validat } } - private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) { + private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { switch (format) { case "uuid" -> { try { @@ -133,7 +133,7 @@ private static void validateStringFormat(String arg, ValidationMetadata validati @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var format = data.schema().format; if (format == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java index b145ab8007a..2a05893a22a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java @@ -7,7 +7,7 @@ public class IfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var ifSchema = data.schema().ifSchema; if (ifSchema == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java index 1b03c0b3094..68d62107337 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class ItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var items = data.schema().items; if (items == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index 8da18342f92..5c34105ded0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -403,7 +403,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws throws InvalidTypeException { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws InvalidTypeException { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @@ -420,7 +420,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set pathToItem, Set> pathSet) throws throws InvalidTypeException { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws InvalidTypeException { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index 96a6688a960..2ef994a9c9f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -7,7 +7,7 @@ import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws throws InvalidTypeException; + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java index 9e9b3b92c18..315771b9e0c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java @@ -9,7 +9,7 @@ public class MaxContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxContains = data.schema().maxContains; if (maxContains == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java index 98ed5cb4ff4..2749843cbf2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java @@ -9,7 +9,7 @@ public class MaxItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxItems = data.schema().maxItems; if (maxItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java index 08d91666c5d..f2a77fa91f6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java @@ -7,7 +7,7 @@ public class MaxLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxLength = data.schema().maxLength; if (maxLength == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java index d117f1688e2..57a53e71be5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java @@ -9,7 +9,7 @@ public class MaxPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxProperties = data.schema().maxProperties; if (maxProperties == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java index 702f09686dc..df1c7f5c338 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java @@ -7,7 +7,7 @@ public class MaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maximum = data.schema().maximum; if (maximum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java index 1827e95cc83..6ea4404dc1f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java @@ -9,7 +9,7 @@ public class MinContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minContains = data.schema().minContains; if (minContains == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java index d1933ca7750..25bae60bda7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java @@ -9,7 +9,7 @@ public class MinItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minItems = data.schema().minItems; if (minItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java index 1defdc891e3..f4639e8a207 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java @@ -7,7 +7,7 @@ public class MinLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minLength = data.schema().minLength; if (minLength == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java index c0b99e7fb7d..011ac76dd31 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java @@ -9,7 +9,7 @@ public class MinPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minProperties = data.schema().minProperties; if (minProperties == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java index 3b539120e42..76065fe50b5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java @@ -7,7 +7,7 @@ public class MinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minimum = data.schema().minimum; if (minimum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java index eebc07a0f10..d8273d04d9c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java @@ -9,7 +9,7 @@ public class MultipleOfValidator extends BigDecimalValidator implements KeywordV @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var multipleOf = data.schema().multipleOf; if (multipleOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java index b077e2056a1..3e6b8e91e7c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java @@ -7,7 +7,7 @@ public class NotValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var not = data.schema().not; if (not == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java index c49fc0150fe..89924e90d5a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java @@ -4,9 +4,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; -import java.util.List; -import java.util.Set; - public interface NullSchemaValidator { Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java index 3c4f4b5a085..7dd5f4128ac 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java @@ -10,7 +10,7 @@ public class OneOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var oneOf = data.schema().oneOf; if (oneOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java index eceeb19e311..d7eebd78098 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java @@ -7,7 +7,7 @@ public class PatternValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var pattern = data.schema().pattern; if (pattern == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java index 237bc250190..510f3a8760e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class PrefixItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var prefixItems = data.schema().prefixItems; if (prefixItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java index b8ddd6fcb46..8803b661fd6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -12,7 +13,7 @@ public class PropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var properties = data.schema().properties; if (properties == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java index 087cd308b11..0169ff5bdba 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +11,7 @@ public class PropertyNamesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var propertyNames = data.schema().propertyNames; if (propertyNames == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java index f2e1a8ecde8..2519cbcfd3b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -12,7 +12,7 @@ public class RequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var required = data.schema().required; if (required == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java index bf599bc812f..75c083e2edc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ThenValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var then = data.schema().then; if (then == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java index bb4133a770e..300d472cfdf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; import java.util.Map; @@ -10,7 +10,7 @@ public class TypeValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var type = data.schema().type; if (type == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java index 8903d0b19a7..407904da444 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class UnevaluatedItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedItems = data.schema().unevaluatedItems; if (unevaluatedItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java index 344c0cfab1b..8fd34950404 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -11,7 +11,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedProperties = data.schema().unevaluatedProperties; if (unevaluatedProperties == null) { return null; @@ -27,7 +27,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { JsonSchema unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties); for(Map.Entry entry: mapArg.entrySet()) { if (!(entry.getKey() instanceof String propName)) { - throw new InvalidTypeException("Map keys must be strings"); + throw new ValidationException("Map keys must be strings"); } List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); propPathToItem.add(propName); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java index a42a7d60b60..6b40ba79fff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -11,7 +11,7 @@ public class UniqueItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var uniqueItems = data.schema().uniqueItems; if (uniqueItems == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/AdditionalPropertiesValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/AdditionalPropertiesValidator.hbs index 8bbf3e86757..7a7b89638e8 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/AdditionalPropertiesValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/AdditionalPropertiesValidator.hbs @@ -1,5 +1,7 @@ package {{{packageName}}}.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -11,7 +13,7 @@ public class AdditionalPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/AllOfValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/AllOfValidator.hbs index f771b150337..e4d3b3e0d78 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/AllOfValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/AllOfValidator.hbs @@ -1,11 +1,13 @@ package {{{packageName}}}.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; public class AllOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var allOf = data.schema().allOf; if (allOf == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/AnyOfValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/AnyOfValidator.hbs index 201e4aa0eb0..16514902bde 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/AnyOfValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/AnyOfValidator.hbs @@ -10,7 +10,7 @@ public class AnyOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var anyOf = data.schema().anyOf; if (anyOf == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/BigDecimalValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/BigDecimalValidator.hbs index 9997913acc2..47a5be850ee 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/BigDecimalValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/BigDecimalValidator.hbs @@ -5,7 +5,7 @@ import {{{packageName}}}.exceptions.ValidationException; import java.math.BigDecimal; public abstract class BigDecimalValidator { - protected BigDecimal getBigDecimal(Number arg) { + protected BigDecimal getBigDecimal(Number arg) throws ValidationException { if (arg instanceof Integer) { return new BigDecimal((Integer) arg); } else if (arg instanceof Long) { diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ConstValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ConstValidator.hbs index bd74714857c..c45ceaf07b2 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ConstValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ConstValidator.hbs @@ -10,7 +10,7 @@ public class ConstValidator extends BigDecimalValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!data.schema().constValueSet) { return null; } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ContainsValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ContainsValidator.hbs index 727dd1b9e5f..8bd70adb570 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ContainsValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ContainsValidator.hbs @@ -9,7 +9,7 @@ public class ContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof List)) { return null; } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/DependentRequiredValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/DependentRequiredValidator.hbs index c304af27833..83b1f7cf1bc 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/DependentRequiredValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/DependentRequiredValidator.hbs @@ -11,7 +11,7 @@ public class DependentRequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/DependentSchemasValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/DependentSchemasValidator.hbs index 075b96c4b38..6c05666c132 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/DependentSchemasValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/DependentSchemasValidator.hbs @@ -1,6 +1,7 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; import java.util.LinkedHashSet; import java.util.Map; @@ -10,7 +11,7 @@ public class DependentSchemasValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ElseValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ElseValidator.hbs index f5dc7ee36f4..af1a2be3193 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ElseValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ElseValidator.hbs @@ -8,7 +8,7 @@ public class ElseValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var elseSchema = data.schema().elseSchema; if (elseSchema == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/EnumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/EnumValidator.hbs index f3cc251e9c7..3d95fc99cfa 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/EnumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/EnumValidator.hbs @@ -15,7 +15,7 @@ public class EnumValidator extends BigDecimalValidator implements KeywordValidat @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var enumValues = data.schema().enumValues; if (enumValues == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ExclusiveMaximumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ExclusiveMaximumValidator.hbs index 56b8965aedc..33299752bf0 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ExclusiveMaximumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ExclusiveMaximumValidator.hbs @@ -7,7 +7,7 @@ public class ExclusiveMaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMaximum = data.schema().exclusiveMaximum; if (exclusiveMaximum == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ExclusiveMinimumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ExclusiveMinimumValidator.hbs index aad41595215..3ba4f4e778c 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ExclusiveMinimumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ExclusiveMinimumValidator.hbs @@ -7,7 +7,7 @@ public class ExclusiveMinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMinimum = data.schema().exclusiveMinimum; if (exclusiveMinimum == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/FormatValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/FormatValidator.hbs index 859da3127df..282a9516a6a 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/FormatValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/FormatValidator.hbs @@ -18,7 +18,7 @@ public class FormatValidator implements KeywordValidator { private final static BigDecimal doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308d); private final static BigDecimal doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308d); - private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) { + private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) throws ValidationException { if (format.startsWith("int")) { // there is a json schema test where 1.0 validates as an integer BigInteger intArg; @@ -85,7 +85,7 @@ public class FormatValidator implements KeywordValidator { } } - private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) { + private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { switch (format) { case "uuid" -> { try { @@ -133,7 +133,7 @@ public class FormatValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var format = data.schema().format; if (format == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/IfValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/IfValidator.hbs index f96f1770d7d..c9f1f79597c 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/IfValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/IfValidator.hbs @@ -7,7 +7,7 @@ public class IfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var ifSchema = data.schema().ifSchema; if (ifSchema == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ItemsValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ItemsValidator.hbs index 102f58e9ed8..314bb5ee2dc 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ItemsValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ItemsValidator.hbs @@ -1,6 +1,7 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class ItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var items = data.schema().items; if (items == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs index ad3e44014b7..c6960a075ab 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs @@ -403,7 +403,7 @@ public abstract class JsonSchema { return argFixed; } - protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws throws InvalidTypeException { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws InvalidTypeException { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @@ -420,7 +420,7 @@ public abstract class JsonSchema { return argFixed; } - private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws throws InvalidTypeException { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws InvalidTypeException { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs index 05c8aabdeb8..595e9d0b176 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs @@ -7,7 +7,7 @@ import {{{packageName}}}.exceptions.ValidationException; import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws throws InvalidTypeException; + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxContainsValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxContainsValidator.hbs index f2ba459cec9..9cd76afd2ef 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxContainsValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxContainsValidator.hbs @@ -9,7 +9,7 @@ public class MaxContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxContains = data.schema().maxContains; if (maxContains == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxItemsValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxItemsValidator.hbs index f557904e3c4..500b858fc52 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxItemsValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxItemsValidator.hbs @@ -9,7 +9,7 @@ public class MaxItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxItems = data.schema().maxItems; if (maxItems == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxLengthValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxLengthValidator.hbs index ab2fb133e14..cfa5bfd0f5a 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxLengthValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxLengthValidator.hbs @@ -7,7 +7,7 @@ public class MaxLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxLength = data.schema().maxLength; if (maxLength == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxPropertiesValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxPropertiesValidator.hbs index 79087edd170..d29dea4a9a1 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxPropertiesValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MaxPropertiesValidator.hbs @@ -9,7 +9,7 @@ public class MaxPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxProperties = data.schema().maxProperties; if (maxProperties == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MaximumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MaximumValidator.hbs index 809692b04c3..e366516dfc0 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MaximumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MaximumValidator.hbs @@ -7,7 +7,7 @@ public class MaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maximum = data.schema().maximum; if (maximum == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MinContainsValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MinContainsValidator.hbs index 7ab9c6d7c82..4628c705229 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MinContainsValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MinContainsValidator.hbs @@ -9,7 +9,7 @@ public class MinContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minContains = data.schema().minContains; if (minContains == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MinItemsValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MinItemsValidator.hbs index d65ca58eb65..ede47652f99 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MinItemsValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MinItemsValidator.hbs @@ -9,7 +9,7 @@ public class MinItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minItems = data.schema().minItems; if (minItems == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MinLengthValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MinLengthValidator.hbs index 24badcaa03c..38782795048 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MinLengthValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MinLengthValidator.hbs @@ -7,7 +7,7 @@ public class MinLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minLength = data.schema().minLength; if (minLength == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MinPropertiesValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MinPropertiesValidator.hbs index 30d0790416a..d383472a7a6 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MinPropertiesValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MinPropertiesValidator.hbs @@ -9,7 +9,7 @@ public class MinPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minProperties = data.schema().minProperties; if (minProperties == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MinimumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MinimumValidator.hbs index b096b0de71f..eba8b4387fa 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MinimumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MinimumValidator.hbs @@ -7,7 +7,7 @@ public class MinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minimum = data.schema().minimum; if (minimum == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MultipleOfValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MultipleOfValidator.hbs index 3151dfda95b..2b97d0ae2ed 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MultipleOfValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MultipleOfValidator.hbs @@ -9,7 +9,7 @@ public class MultipleOfValidator extends BigDecimalValidator implements KeywordV @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var multipleOf = data.schema().multipleOf; if (multipleOf == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/NotValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/NotValidator.hbs index 3d29af2e934..388fa8cee0d 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/NotValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/NotValidator.hbs @@ -7,7 +7,7 @@ public class NotValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var not = data.schema().not; if (not == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs index 4b04a80d7dd..afa624000fb 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs @@ -4,9 +4,6 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; -import java.util.List; -import java.util.Set; - public interface NullSchemaValidator { Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/OneOfValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/OneOfValidator.hbs index a3c40833442..d4fc3652aef 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/OneOfValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/OneOfValidator.hbs @@ -10,7 +10,7 @@ public class OneOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var oneOf = data.schema().oneOf; if (oneOf == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/PatternValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/PatternValidator.hbs index e020d585618..08f40c93530 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/PatternValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/PatternValidator.hbs @@ -7,7 +7,7 @@ public class PatternValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var pattern = data.schema().pattern; if (pattern == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/PrefixItemsValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/PrefixItemsValidator.hbs index ab1c1402059..8a778500981 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/PrefixItemsValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/PrefixItemsValidator.hbs @@ -1,6 +1,7 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class PrefixItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var prefixItems = data.schema().prefixItems; if (prefixItems == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/PropertiesValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/PropertiesValidator.hbs index 914170287d2..f339a2b52e5 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/PropertiesValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/PropertiesValidator.hbs @@ -1,6 +1,7 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -12,7 +13,7 @@ public class PropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var properties = data.schema().properties; if (properties == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/PropertyNamesValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/PropertyNamesValidator.hbs index 49315059c97..90b1599ee61 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/PropertyNamesValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/PropertyNamesValidator.hbs @@ -1,6 +1,7 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +11,7 @@ public class PropertyNamesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var propertyNames = data.schema().propertyNames; if (propertyNames == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/RequiredValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/RequiredValidator.hbs index eb6854827f9..e21584c2c19 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/RequiredValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/RequiredValidator.hbs @@ -1,7 +1,7 @@ package {{{packageName}}}.schemas.validation; -import {{{packageName}}}.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -12,7 +12,7 @@ public class RequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var required = data.schema().required; if (required == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ThenValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ThenValidator.hbs index c84fec4b79d..4b759d4a34b 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ThenValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ThenValidator.hbs @@ -1,14 +1,13 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public class ThenValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var then = data.schema().then; if (then == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/TypeValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/TypeValidator.hbs index 0fab57d0561..558c15da514 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/TypeValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/TypeValidator.hbs @@ -1,7 +1,7 @@ package {{{packageName}}}.schemas.validation; -import {{{packageName}}}.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; import java.util.List; import java.util.Map; @@ -10,7 +10,7 @@ public class TypeValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var type = data.schema().type; if (type == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedItemsValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedItemsValidator.hbs index 08491693ad1..7ff51ef0682 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedItemsValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedItemsValidator.hbs @@ -1,6 +1,7 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class UnevaluatedItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedItems = data.schema().unevaluatedItems; if (unevaluatedItems == null) { return null; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs index f8db065d12a..0dbf00afb1f 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs @@ -1,7 +1,7 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import {{{packageName}}}.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -11,7 +11,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedProperties = data.schema().unevaluatedProperties; if (unevaluatedProperties == null) { return null; @@ -27,7 +27,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { JsonSchema unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties); for(Map.Entry entry: mapArg.entrySet()) { if (!(entry.getKey() instanceof String propName)) { - throw new InvalidTypeException("Map keys must be strings"); + throw new ValidationException("Map keys must be strings"); } List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); propPathToItem.add(propName); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UniqueItemsValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UniqueItemsValidator.hbs index fca9e17c2e5..aba5b63684c 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UniqueItemsValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UniqueItemsValidator.hbs @@ -1,7 +1,7 @@ package {{{packageName}}}.schemas.validation; -import {{{packageName}}}.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -11,7 +11,7 @@ public class UniqueItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var uniqueItems = data.schema().uniqueItems; if (uniqueItems == null) { return null; From 9abe48e26fbfdb46745bfb4413224e81607ef137 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 1 Apr 2024 16:02:32 -0700 Subject: [PATCH 20/53] Adds more needed throws info --- .../client/configurations/ApiConfiguration.java | 8 ++++---- .../client/parameter/Parameter.java | 3 ++- .../client/schemas/DateJsonSchema.java | 2 +- .../java/packagename/configurations/ApiConfiguration.hbs | 4 ++-- .../src/main/java/packagename/parameter/Parameter.hbs | 3 ++- .../src/main/java/packagename/schemas/DateJsonSchema.hbs | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index 237ce45062d..86aab8c71d6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -103,7 +103,7 @@ public ServerIndexInfo petfindbystatusServerInfoServerIndex(PetfindbystatusServe } } - public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { + public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) throws UnsetPropertyException { var serverProvider = serverInfo.rootServerInfo; if (serverIndex == null) { RootServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.rootServerInfoServerIndex; @@ -115,7 +115,7 @@ public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { return serverProvider.getServer(serverIndex); } - public Server getServer(FooGetServerInfo. @Nullable ServerIndex serverIndex) { + public Server getServer(FooGetServerInfo. @Nullable ServerIndex serverIndex) throws UnsetPropertyException { var serverProvider = serverInfo.fooGetServerInfo; if (serverIndex == null) { FooGetServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.fooGetServerInfoServerIndex; @@ -127,7 +127,7 @@ public Server getServer(FooGetServerInfo. @Nullable ServerIndex serverIndex) { return serverProvider.getServer(serverIndex); } - public Server getServer(PetfindbystatusServerInfo. @Nullable ServerIndex serverIndex) { + public Server getServer(PetfindbystatusServerInfo. @Nullable ServerIndex serverIndex) throws UnsetPropertyException { var serverProvider = serverInfo.petfindbystatusServerInfo; if (serverIndex == null) { PetfindbystatusServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.petfindbystatusServerInfoServerIndex; @@ -417,7 +417,7 @@ public SecurityRequirementObject getSecurityRequirementObject(StoreinventoryGetS return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityScheme getSecurityScheme(Class securitySchemeClass) { + public SecurityScheme getSecurityScheme(Class securitySchemeClass) throws UnsetPropertyException { @Nullable SecurityScheme securityScheme = securitySchemeInfo.get(securitySchemeClass); if (securityScheme == null) { throw new UnsetPropertyException("SecurityScheme of class " + securitySchemeClass + "cannot be returned because it is unset. Pass in an instance of it in securitySchemes when instantiating ApiConfiguration."); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java index 9fe0745417c..adf3896d557 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java @@ -1,9 +1,10 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData); + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index 9cfe5b9d861..8b367834de7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -57,7 +57,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } diff --git a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs index 07c6e1d36d9..ce1d506339c 100644 --- a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs +++ b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs @@ -109,7 +109,7 @@ public class ApiConfiguration { } {{#each allServers}} - public Server getServer({{jsonPathPiece.pascalCase}}. @Nullable ServerIndex serverIndex) { + public Server getServer({{jsonPathPiece.pascalCase}}. @Nullable ServerIndex serverIndex) throws UnsetPropertyException { var serverProvider = serverInfo.{{jsonPathPiece.camelCase}}; if (serverIndex == null) { {{jsonPathPiece.pascalCase}}. @Nullable ServerIndex configServerIndex = serverIndexInfo.{{jsonPathPiece.camelCase}}ServerIndex; @@ -166,7 +166,7 @@ public class ApiConfiguration { {{/gt}} {{#if securitySchemes}} - public SecurityScheme getSecurityScheme(Class securitySchemeClass) { + public SecurityScheme getSecurityScheme(Class securitySchemeClass) throws UnsetPropertyException { @Nullable SecurityScheme securityScheme = securitySchemeInfo.get(securitySchemeClass); if (securityScheme == null) { throw new UnsetPropertyException("SecurityScheme of class " + securitySchemeClass + "cannot be returned because it is unset. Pass in an instance of it in securitySchemes when instantiating ApiConfiguration."); diff --git a/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs b/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs index d188c0babf0..b612b6a159a 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs @@ -1,9 +1,10 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData); + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs index 964e449d4fc..74632ff6940 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs @@ -57,7 +57,7 @@ public class DateJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } From 446f7d72a8252bbb72f932e06accafaa88a4113b Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 1 Apr 2024 16:41:58 -0700 Subject: [PATCH 21/53] throws signatures added to auto gen schemas --- .../ApplicationjsonSchema.java | 4 +- .../HeadersWithNoBodyHeadersSchema.java | 4 +- .../ApplicationjsonSchema.java | 4 +- .../applicationxml/ApplicationxmlSchema.java | 4 +- ...ssInlineContentAndHeaderHeadersSchema.java | 4 +- .../ApplicationjsonSchema.java | 4 +- ...ccessWithJsonApiResponseHeadersSchema.java | 4 +- .../schemas/AbstractStepMessage.java | 16 +- .../schemas/AdditionalPropertiesClass.java | 28 +-- .../schemas/AdditionalPropertiesSchema.java | 54 ++--- .../AdditionalPropertiesWithArrayOfEnums.java | 8 +- .../client/components/schemas/Address.java | 4 +- .../client/components/schemas/Animal.java | 8 +- .../client/components/schemas/AnimalFarm.java | 4 +- .../components/schemas/AnyTypeAndFormat.java | 184 +++++++++--------- .../components/schemas/AnyTypeNotString.java | 20 +- .../components/schemas/ApiResponseSchema.java | 4 +- .../client/components/schemas/Apple.java | 10 +- .../client/components/schemas/AppleReq.java | 4 +- .../schemas/ArrayHoldingAnyType.java | 4 +- .../schemas/ArrayOfArrayOfNumberOnly.java | 12 +- .../components/schemas/ArrayOfEnums.java | 4 +- .../components/schemas/ArrayOfNumberOnly.java | 8 +- .../client/components/schemas/ArrayTest.java | 24 +-- .../schemas/ArrayWithValidationsInItems.java | 14 +- .../client/components/schemas/Banana.java | 4 +- .../client/components/schemas/BananaReq.java | 4 +- .../client/components/schemas/Bar.java | 4 +- .../client/components/schemas/BasquePig.java | 8 +- .../components/schemas/BooleanEnum.java | 4 +- .../components/schemas/Capitalization.java | 4 +- .../client/components/schemas/Cat.java | 24 +-- .../client/components/schemas/Category.java | 8 +- .../client/components/schemas/ChildCat.java | 24 +-- .../client/components/schemas/ClassModel.java | 22 +-- .../client/components/schemas/Client.java | 4 +- .../schemas/ComplexQuadrilateral.java | 28 +-- ...posedAnyOfDifferentTypesNoValidations.java | 24 +-- .../components/schemas/ComposedArray.java | 4 +- .../components/schemas/ComposedBool.java | 2 +- .../components/schemas/ComposedNone.java | 2 +- .../components/schemas/ComposedNumber.java | 10 +- .../components/schemas/ComposedObject.java | 2 +- .../schemas/ComposedOneOfDifferentTypes.java | 28 +-- .../components/schemas/ComposedString.java | 2 +- .../client/components/schemas/Currency.java | 4 +- .../client/components/schemas/DanishPig.java | 8 +- .../components/schemas/DateTimeTest.java | 4 +- .../schemas/DateTimeWithValidations.java | 2 +- .../schemas/DateWithValidations.java | 2 +- .../client/components/schemas/Dog.java | 24 +-- .../client/components/schemas/Drawing.java | 8 +- .../client/components/schemas/EnumArrays.java | 16 +- .../client/components/schemas/EnumClass.java | 6 +- .../client/components/schemas/EnumTest.java | 34 ++-- .../schemas/EquilateralTriangle.java | 28 +-- .../client/components/schemas/File.java | 4 +- .../schemas/FileSchemaTestClass.java | 8 +- .../client/components/schemas/Foo.java | 4 +- .../client/components/schemas/FormatTest.java | 50 ++--- .../client/components/schemas/FromSchema.java | 4 +- .../client/components/schemas/Fruit.java | 22 +-- .../client/components/schemas/FruitReq.java | 20 +- .../client/components/schemas/GmFruit.java | 22 +-- .../components/schemas/GrandparentAnimal.java | 4 +- .../components/schemas/HasOnlyReadOnly.java | 4 +- .../components/schemas/HealthCheckResult.java | 8 +- .../components/schemas/IntegerEnum.java | 18 +- .../components/schemas/IntegerEnumBig.java | 18 +- .../schemas/IntegerEnumOneValue.java | 18 +- .../schemas/IntegerEnumWithDefaultValue.java | 18 +- .../components/schemas/IntegerMax10.java | 10 +- .../components/schemas/IntegerMin15.java | 10 +- .../components/schemas/IsoscelesTriangle.java | 28 +-- .../client/components/schemas/Items.java | 4 +- .../components/schemas/JSONPatchRequest.java | 24 +-- .../JSONPatchRequestAddReplaceTest.java | 14 +- .../schemas/JSONPatchRequestMoveCopy.java | 20 +- .../schemas/JSONPatchRequestRemove.java | 14 +- .../client/components/schemas/Mammal.java | 20 +- .../client/components/schemas/MapTest.java | 24 +-- ...ropertiesAndAdditionalPropertiesClass.java | 8 +- .../client/components/schemas/Money.java | 4 +- .../components/schemas/MyObjectDto.java | 4 +- .../client/components/schemas/Name.java | 22 +-- .../schemas/NoAdditionalProperties.java | 10 +- .../components/schemas/NullableClass.java | 96 ++++----- .../components/schemas/NullableShape.java | 20 +- .../components/schemas/NullableString.java | 4 +- .../client/components/schemas/NumberOnly.java | 4 +- .../schemas/NumberWithExclusiveMinMax.java | 10 +- .../schemas/NumberWithValidations.java | 10 +- .../schemas/ObjWithRequiredProps.java | 4 +- .../schemas/ObjWithRequiredPropsBase.java | 4 +- .../ObjectModelWithArgAndArgsProperties.java | 4 +- .../schemas/ObjectModelWithRefProps.java | 4 +- ...hAllOfWithReqTestPropFromUnsetAddProp.java | 30 +-- .../ObjectWithCollidingProperties.java | 4 +- .../schemas/ObjectWithDecimalProperties.java | 4 +- .../ObjectWithDifficultlyNamedProps.java | 4 +- .../ObjectWithInlineCompositionProperty.java | 26 +-- ...ObjectWithInvalidNamedRefedProperties.java | 4 +- .../ObjectWithNonIntersectingValues.java | 4 +- .../schemas/ObjectWithOnlyOptionalProps.java | 4 +- .../schemas/ObjectWithOptionalTestProp.java | 4 +- .../schemas/ObjectWithValidations.java | 2 +- .../client/components/schemas/Order.java | 8 +- .../schemas/PaginatedResultMyObjectDto.java | 8 +- .../client/components/schemas/ParentPet.java | 2 +- .../client/components/schemas/Pet.java | 16 +- .../client/components/schemas/Pig.java | 20 +- .../client/components/schemas/Player.java | 4 +- .../client/components/schemas/PublicKey.java | 4 +- .../components/schemas/Quadrilateral.java | 20 +- .../schemas/QuadrilateralInterface.java | 26 +-- .../components/schemas/ReadOnlyFirst.java | 4 +- .../schemas/ReqPropsFromExplicitAddProps.java | 10 +- .../schemas/ReqPropsFromTrueAddProps.java | 10 +- .../schemas/ReqPropsFromUnsetAddProps.java | 10 +- .../components/schemas/ReturnSchema.java | 22 +-- .../components/schemas/ScaleneTriangle.java | 28 +-- .../components/schemas/Schema200Response.java | 22 +-- .../schemas/SelfReferencingArrayModel.java | 4 +- .../schemas/SelfReferencingObjectModel.java | 4 +- .../client/components/schemas/Shape.java | 20 +- .../components/schemas/ShapeOrNull.java | 20 +- .../schemas/SimpleQuadrilateral.java | 28 +-- .../client/components/schemas/SomeObject.java | 20 +- .../components/schemas/SpecialModelname.java | 4 +- .../components/schemas/StringBooleanMap.java | 4 +- .../client/components/schemas/StringEnum.java | 8 +- .../schemas/StringEnumWithDefaultValue.java | 6 +- .../schemas/StringWithValidation.java | 2 +- .../client/components/schemas/Tag.java | 4 +- .../client/components/schemas/Triangle.java | 20 +- .../components/schemas/TriangleInterface.java | 26 +-- .../client/components/schemas/UUIDString.java | 2 +- .../client/components/schemas/User.java | 28 +-- .../client/components/schemas/Whale.java | 8 +- .../client/components/schemas/Zebra.java | 12 +- .../delete/HeaderParameters.java | 4 +- .../delete/PathParameters.java | 10 +- .../delete/parameters/parameter1/Schema1.java | 4 +- .../commonparamsubdir/get/PathParameters.java | 10 +- .../get/QueryParameters.java | 4 +- .../routeparameter0/RouteParamSchema0.java | 4 +- .../post/HeaderParameters.java | 4 +- .../post/PathParameters.java | 10 +- .../paths/fake/delete/HeaderParameters.java | 4 +- .../paths/fake/delete/QueryParameters.java | 4 +- .../delete/parameters/parameter1/Schema1.java | 4 +- .../delete/parameters/parameter4/Schema4.java | 4 +- .../paths/fake/get/HeaderParameters.java | 4 +- .../paths/fake/get/QueryParameters.java | 4 +- .../get/parameters/parameter0/Schema0.java | 10 +- .../get/parameters/parameter1/Schema1.java | 6 +- .../get/parameters/parameter2/Schema2.java | 10 +- .../get/parameters/parameter3/Schema3.java | 6 +- .../get/parameters/parameter4/Schema4.java | 14 +- .../get/parameters/parameter5/Schema5.java | 8 +- .../ApplicationxwwwformurlencodedSchema.java | 20 +- .../ApplicationxwwwformurlencodedSchema.java | 48 ++--- .../put/QueryParameters.java | 10 +- .../put/QueryParameters.java | 4 +- .../delete/PathParameters.java | 10 +- .../ApplicationjsonSchema.java | 4 +- .../post/QueryParameters.java | 4 +- .../post/parameters/parameter0/Schema0.java | 22 +-- .../post/parameters/parameter1/Schema1.java | 26 +-- .../ApplicationjsonSchema.java | 22 +-- .../MultipartformdataSchema.java | 26 +-- .../ApplicationjsonSchema.java | 22 +-- .../MultipartformdataSchema.java | 26 +-- .../ApplicationxwwwformurlencodedSchema.java | 4 +- .../ApplicationjsonSchema.java | 4 +- .../MultipartformdataSchema.java | 4 +- .../fakeobjinquery/get/QueryParameters.java | 4 +- .../get/parameters/parameter0/Schema0.java | 4 +- .../post/CookieParameters.java | 4 +- .../post/HeaderParameters.java | 4 +- .../post/PathParameters.java | 4 +- .../post/QueryParameters.java | 4 +- .../post/PathParameters.java | 10 +- .../MultipartformdataSchema.java | 4 +- .../get/QueryParameters.java | 10 +- .../get/QueryParameters.java | 4 +- .../put/QueryParameters.java | 4 +- .../put/parameters/parameter0/Schema0.java | 4 +- .../put/parameters/parameter1/Schema1.java | 4 +- .../put/parameters/parameter2/Schema2.java | 4 +- .../put/parameters/parameter3/Schema3.java | 4 +- .../put/parameters/parameter4/Schema4.java | 4 +- .../MultipartformdataSchema.java | 4 +- .../MultipartformdataSchema.java | 8 +- .../ApplicationjsonSchema.java | 4 +- .../paths/foo/get/servers/FooGetServer1.java | 21 +- .../foo/get/servers/server1/Variables.java | 16 +- .../petfindbystatus/get/QueryParameters.java | 10 +- .../get/parameters/parameter0/Schema0.java | 10 +- .../servers/PetfindbystatusServer1.java | 21 +- .../servers/server1/Variables.java | 16 +- .../petfindbytags/get/QueryParameters.java | 10 +- .../get/parameters/parameter0/Schema0.java | 4 +- .../petpetid/delete/HeaderParameters.java | 4 +- .../paths/petpetid/delete/PathParameters.java | 10 +- .../paths/petpetid/get/PathParameters.java | 10 +- .../paths/petpetid/post/PathParameters.java | 10 +- .../ApplicationxwwwformurlencodedSchema.java | 4 +- .../post/PathParameters.java | 10 +- .../MultipartformdataSchema.java | 4 +- .../delete/PathParameters.java | 10 +- .../storeorderorderid/get/PathParameters.java | 10 +- .../get/parameters/parameter0/Schema0.java | 10 +- .../paths/userlogin/get/QueryParameters.java | 4 +- .../Code200ResponseHeadersSchema.java | 4 +- .../userusername/delete/PathParameters.java | 10 +- .../userusername/get/PathParameters.java | 10 +- .../userusername/put/PathParameters.java | 10 +- .../validation/DefaultValueMethod.java | 4 +- .../client/servers/Server0.java | 21 +- .../client/servers/Server1.java | 21 +- .../client/servers/server0/Variables.java | 16 +- .../client/servers/server1/Variables.java | 16 +- .../schemas/SchemaClass/_Schema_string.hbs | 2 +- .../SchemaClass/_validate_implementor.hbs | 82 ++++---- .../schemas/_objectOutputGetProperty.hbs | 6 +- .../components/schemas/_objectOutputType.hbs | 4 +- .../schemas/validation/DefaultValueMethod.hbs | 4 +- .../main/java/packagename/servers/ServerN.hbs | 23 ++- 229 files changed, 1495 insertions(+), 1312 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java index 9e4ba1794ae..848f62880ce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java @@ -88,7 +88,7 @@ public static ApplicationjsonSchema1 getInstance() { } @Override - public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -110,7 +110,7 @@ public ApplicationjsonSchemaList getNewInstance(List arg, List pathTo return new ApplicationjsonSchemaList(newInstanceItems); } - public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java index d0cbaf812f0..fb258dbedbe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java @@ -50,7 +50,7 @@ protected HeadersWithNoBodyHeadersSchemaMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "location" ); - public static HeadersWithNoBodyHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static HeadersWithNoBodyHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return HeadersWithNoBodyHeadersSchema1.getInstance().validate(arg, configuration); } @@ -125,7 +125,7 @@ public static HeadersWithNoBodyHeadersSchema1 getInstance() { return instance; } - public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java index cf00c44021c..bf81e47d7d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java @@ -89,7 +89,7 @@ public static ApplicationjsonSchema1 getInstance() { } @Override - public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -111,7 +111,7 @@ public ApplicationjsonSchemaList getNewInstance(List arg, List pathTo return new ApplicationjsonSchemaList(newInstanceItems); } - public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java index 0ed36ee6a42..04014f3cd5d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java @@ -88,7 +88,7 @@ public static ApplicationxmlSchema1 getInstance() { } @Override - public ApplicationxmlSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationxmlSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -110,7 +110,7 @@ public ApplicationxmlSchemaList getNewInstance(List arg, List pathToI return new ApplicationxmlSchemaList(newInstanceItems); } - public ApplicationxmlSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxmlSchemaList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java index 227e14f64b5..4cc85c8e474 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java @@ -50,7 +50,7 @@ protected SuccessInlineContentAndHeaderHeadersSchemaMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "someHeader" ); - public static SuccessInlineContentAndHeaderHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static SuccessInlineContentAndHeaderHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return SuccessInlineContentAndHeaderHeadersSchema1.getInstance().validate(arg, configuration); } @@ -125,7 +125,7 @@ public static SuccessInlineContentAndHeaderHeadersSchema1 getInstance() { return instance; } - public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java index 7d1f6c17975..911bdc443a2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java @@ -45,7 +45,7 @@ protected ApplicationjsonSchemaMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } @@ -124,7 +124,7 @@ public static ApplicationjsonSchema1 getInstance() { return instance; } - public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java index e5a54a4d001..bc2b97562e7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java @@ -58,7 +58,7 @@ protected SuccessWithJsonApiResponseHeadersSchemaMap(FrozenMap<@Nullable Object> public static final Set optionalKeys = Set.of( "numberHeader" ); - public static SuccessWithJsonApiResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static SuccessWithJsonApiResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return SuccessWithJsonApiResponseHeadersSchema1.getInstance().validate(arg, configuration); } @@ -465,7 +465,7 @@ public static SuccessWithJsonApiResponseHeadersSchema1 getInstance() { return instance; } - public SuccessWithJsonApiResponseHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SuccessWithJsonApiResponseHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java index 0491701ee19..a2f3002e562 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java @@ -50,12 +50,16 @@ protected AbstractStepMessageMap(FrozenMap<@Nullable Object> m) { "sequenceNumber" ); public static final Set optionalKeys = Set.of(); - public static AbstractStepMessageMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AbstractStepMessageMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AbstractStepMessage1.getInstance().validate(arg, configuration); } public @Nullable Object description() { - return getOrThrow("description"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public String discriminator() { @@ -67,7 +71,11 @@ public String discriminator() { } public @Nullable Object sequenceNumber() { - return getOrThrow("sequenceNumber"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -384,7 +392,7 @@ public static AbstractStepMessage1 getInstance() { return instance; } - public AbstractStepMessageMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AbstractStepMessageMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java index e5c4d17f293..4c6b51e5cc7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java @@ -50,7 +50,7 @@ protected MapPropertyMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MapPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MapProperty.getInstance().validate(arg, configuration); } @@ -122,7 +122,7 @@ public static MapProperty getInstance() { return instance; } - public MapPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -204,7 +204,7 @@ protected AdditionalPropertiesMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AdditionalProperties1.getInstance().validate(arg, configuration); } @@ -276,7 +276,7 @@ public static AdditionalProperties1 getInstance() { return instance; } - public AdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -347,7 +347,7 @@ protected MapOfMapPropertyMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapOfMapPropertyMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + public static MapOfMapPropertyMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MapOfMapProperty.getInstance().validate(arg, configuration); } @@ -419,7 +419,7 @@ public static MapOfMapProperty getInstance() { return instance; } - public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -534,7 +534,7 @@ protected MapWithUndeclaredPropertiesAnytype3Map(FrozenMap<@Nullable Object> m) } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapWithUndeclaredPropertiesAnytype3Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MapWithUndeclaredPropertiesAnytype3Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MapWithUndeclaredPropertiesAnytype3.getInstance().validate(arg, configuration); } @@ -662,7 +662,7 @@ public static MapWithUndeclaredPropertiesAnytype3 getInstance() { return instance; } - public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -743,7 +743,7 @@ protected EmptyMapMap(FrozenMap<@Nullable Object> m) { public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); // map with no key value pairs - public static EmptyMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static EmptyMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return EmptyMap.getInstance().validate(arg, configuration); } } @@ -792,7 +792,7 @@ public static EmptyMap getInstance() { return instance; } - public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -871,7 +871,7 @@ protected MapWithUndeclaredPropertiesStringMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapWithUndeclaredPropertiesStringMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MapWithUndeclaredPropertiesStringMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MapWithUndeclaredPropertiesString.getInstance().validate(arg, configuration); } @@ -943,7 +943,7 @@ public static MapWithUndeclaredPropertiesString getInstance() { return instance; } - public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -1023,7 +1023,7 @@ protected AdditionalPropertiesClassMap(FrozenMap<@Nullable Object> m) { "empty_map", "map_with_undeclared_properties_string" ); - public static AdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AdditionalPropertiesClass1.getInstance().validate(arg, configuration); } @@ -1342,7 +1342,7 @@ public static AdditionalPropertiesClass1 getInstance() { return instance; } - public AdditionalPropertiesClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalPropertiesClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java index 6cc2511dad8..d2d487700c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java @@ -55,7 +55,7 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema0.getInstance().validate(arg, configuration); } @@ -183,7 +183,7 @@ public static Schema0 getInstance() { return instance; } - public Schema0Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema0Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -344,19 +344,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -372,20 +372,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -404,7 +404,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -415,7 +415,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -536,7 +536,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } @@ -664,7 +664,7 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -825,19 +825,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -853,20 +853,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -885,7 +885,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -896,7 +896,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -1017,7 +1017,7 @@ protected Schema2Map(FrozenMap<@Nullable Object> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static Schema2Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema2Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema2.getInstance().validate(arg, configuration); } @@ -1145,7 +1145,7 @@ public static Schema2 getInstance() { return instance; } - public Schema2Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema2Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -1246,7 +1246,7 @@ public static AdditionalPropertiesSchema1 getInstance() { return instance; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java index bcbef03c5d4..5c67bda20df 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java @@ -97,7 +97,7 @@ public static AdditionalProperties getInstance() { } @Override - public AdditionalPropertiesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalPropertiesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -119,7 +119,7 @@ public AdditionalPropertiesList getNewInstance(List arg, List pathToI return new AdditionalPropertiesList(newInstanceItems); } - public AdditionalPropertiesList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,7 +162,7 @@ protected AdditionalPropertiesWithArrayOfEnumsMap(FrozenMap requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AdditionalPropertiesWithArrayOfEnumsMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + public static AdditionalPropertiesWithArrayOfEnumsMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AdditionalPropertiesWithArrayOfEnums1.getInstance().validate(arg, configuration); } @@ -244,7 +244,7 @@ public static AdditionalPropertiesWithArrayOfEnums1 getInstance() { return instance; } - public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java index b0ed926c90e..4f46c0a211d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java @@ -45,7 +45,7 @@ protected AddressMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AddressMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AddressMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Address1.getInstance().validate(arg, configuration); } @@ -144,7 +144,7 @@ public static Address1 getInstance() { return instance; } - public AddressMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AddressMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java index bb25f8c14eb..8be00307078 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java @@ -75,7 +75,7 @@ public static Color getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -99,7 +99,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -128,7 +128,7 @@ protected AnimalMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "color" ); - public static AnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Animal1.getInstance().validate(arg, configuration); } @@ -260,7 +260,7 @@ public static Animal1 getInstance() { return instance; } - public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java index e6ee613c3e1..43ec7ed49a5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java @@ -93,7 +93,7 @@ public static AnimalFarm1 getInstance() { } @Override - public AnimalFarmList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AnimalFarmList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -115,7 +115,7 @@ public AnimalFarmList getNewInstance(List arg, List pathToItem, PathT return new AnimalFarmList(newInstanceItems); } - public AnimalFarmList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public AnimalFarmList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java index 8b3f5b7cd09..8348806068b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java @@ -136,19 +136,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -164,20 +164,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -196,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,7 +207,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -421,19 +421,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -449,20 +449,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -481,7 +481,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -492,7 +492,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -706,19 +706,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -734,20 +734,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -766,7 +766,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -777,7 +777,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -991,19 +991,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -1019,20 +1019,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1051,7 +1051,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1062,7 +1062,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -1276,19 +1276,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -1304,20 +1304,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1336,7 +1336,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1347,7 +1347,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -1561,19 +1561,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -1589,20 +1589,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1621,7 +1621,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1632,7 +1632,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -1846,19 +1846,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -1874,20 +1874,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1906,7 +1906,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1917,7 +1917,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -2131,19 +2131,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -2159,20 +2159,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -2191,7 +2191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2202,7 +2202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -2416,19 +2416,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -2444,20 +2444,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -2476,7 +2476,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2487,7 +2487,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -2618,7 +2618,7 @@ protected AnyTypeAndFormatMap(FrozenMap<@Nullable Object> m) { "double", "float" ); - public static AnyTypeAndFormatMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AnyTypeAndFormatMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AnyTypeAndFormat1.getInstance().validate(arg, configuration); } @@ -3279,7 +3279,7 @@ public static AnyTypeAndFormat1 getInstance() { return instance; } - public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java index 13dfb48e9a9..ef88da2c2a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java @@ -152,19 +152,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -180,20 +180,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -212,7 +212,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java index 19681cbe576..3f18d529be3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java @@ -73,7 +73,7 @@ protected ApiResponseMap(FrozenMap<@Nullable Object> m) { "type", "message" ); - public static ApiResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ApiResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApiResponseSchema1.getInstance().validate(arg, configuration); } @@ -226,7 +226,7 @@ public static ApiResponseSchema1 getInstance() { return instance; } - public ApiResponseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApiResponseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java index 1ff84d0d77f..5451924a185 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java @@ -66,7 +66,7 @@ public static Cultivar getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -139,7 +139,7 @@ public static Origin getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -186,7 +186,7 @@ protected AppleMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "origin" ); - public static AppleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AppleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Apple1.getInstance().validate(arg, configuration); } @@ -329,7 +329,7 @@ public static Apple1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -339,7 +339,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public AppleMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AppleMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java index e5e5ec8123c..c2dcd371375 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java @@ -75,7 +75,7 @@ protected AppleReqMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "mealy" ); - public static AppleReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AppleReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AppleReq1.getInstance().validate(arg, configuration); } @@ -199,7 +199,7 @@ public static AppleReq1 getInstance() { return instance; } - public AppleReqMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AppleReqMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java index 6b80d6a622a..736ead4f3f3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java @@ -144,7 +144,7 @@ public static ArrayHoldingAnyType1 getInstance() { } @Override - public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -163,7 +163,7 @@ public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToIt return new ArrayHoldingAnyTypeList(newInstanceItems); } - public ArrayHoldingAnyTypeList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayHoldingAnyTypeList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java index b7f9fd7e937..762d382590d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java @@ -120,7 +120,7 @@ public static Items getInstance() { } @Override - public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -142,7 +142,7 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche return new ItemsList(newInstanceItems); } - public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,7 +242,7 @@ public static ArrayArrayNumber getInstance() { } @Override - public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -264,7 +264,7 @@ public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, return new ArrayArrayNumberList(newInstanceItems); } - public ArrayArrayNumberList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayArrayNumberList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -309,7 +309,7 @@ protected ArrayOfArrayOfNumberOnlyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "ArrayArrayNumber" ); - public static ArrayOfArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayOfArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayOfArrayOfNumberOnly1.getInstance().validate(arg, configuration); } @@ -404,7 +404,7 @@ public static ArrayOfArrayOfNumberOnly1 getInstance() { return instance; } - public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java index 8364d46380d..aa2603a5f5d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java @@ -106,7 +106,7 @@ public static ArrayOfEnums1 getInstance() { } @Override - public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable String> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -128,7 +128,7 @@ public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, Pat return new ArrayOfEnumsList(newInstanceItems); } - public ArrayOfEnumsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfEnumsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java index 03b7659a3c1..a70e4a17ed4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java @@ -120,7 +120,7 @@ public static ArrayNumber getInstance() { } @Override - public ArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -142,7 +142,7 @@ public ArrayNumberList getNewInstance(List arg, List pathToItem, Path return new ArrayNumberList(newInstanceItems); } - public ArrayNumberList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayNumberList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -187,7 +187,7 @@ protected ArrayOfNumberOnlyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "ArrayNumber" ); - public static ArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayOfNumberOnly1.getInstance().validate(arg, configuration); } @@ -282,7 +282,7 @@ public static ArrayOfNumberOnly1 getInstance() { return instance; } - public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java index a6de7bc8168..e7cabccb619 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java @@ -106,7 +106,7 @@ public static ArrayOfString getInstance() { } @Override - public ArrayOfStringList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayOfStringList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -128,7 +128,7 @@ public ArrayOfStringList getNewInstance(List arg, List pathToItem, Pa return new ArrayOfStringList(newInstanceItems); } - public ArrayOfStringList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfStringList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +254,7 @@ public static Items1 getInstance() { } @Override - public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -276,7 +276,7 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche return new ItemsList(newInstanceItems); } - public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -376,7 +376,7 @@ public static ArrayArrayOfInteger getInstance() { } @Override - public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -398,7 +398,7 @@ public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToIt return new ArrayArrayOfIntegerList(newInstanceItems); } - public ArrayArrayOfIntegerList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayArrayOfIntegerList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -498,7 +498,7 @@ public static Items3 getInstance() { } @Override - public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -520,7 +520,7 @@ public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSch return new ItemsList1(newInstanceItems); } - public ItemsList1 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsList1 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -620,7 +620,7 @@ public static ArrayArrayOfModel getInstance() { } @Override - public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -642,7 +642,7 @@ public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem return new ArrayArrayOfModelList(newInstanceItems); } - public ArrayArrayOfModelList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayArrayOfModelList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -689,7 +689,7 @@ protected ArrayTestMap(FrozenMap<@Nullable Object> m) { "array_array_of_integer", "array_array_of_model" ); - public static ArrayTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayTest1.getInstance().validate(arg, configuration); } @@ -836,7 +836,7 @@ public static ArrayTest1 getInstance() { return instance; } - public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java index 99a7c45a8d2..85bafd5af53 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java @@ -60,7 +60,7 @@ public static Items getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -70,19 +70,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -198,7 +198,7 @@ public static ArrayWithValidationsInItems1 getInstance() { } @Override - public ArrayWithValidationsInItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayWithValidationsInItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -220,7 +220,7 @@ public ArrayWithValidationsInItemsList getNewInstance(List arg, List return new ArrayWithValidationsInItemsList(newInstanceItems); } - public ArrayWithValidationsInItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithValidationsInItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java index ffa0682bd6c..1737b8a9ff7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java @@ -48,7 +48,7 @@ protected BananaMap(FrozenMap<@Nullable Object> m) { "lengthCm" ); public static final Set optionalKeys = Set.of(); - public static BananaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static BananaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Banana1.getInstance().validate(arg, configuration); } @@ -172,7 +172,7 @@ public static Banana1 getInstance() { return instance; } - public BananaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public BananaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java index 9ca17cb18fc..659b52e8645 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java @@ -75,7 +75,7 @@ protected BananaReqMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "sweet" ); - public static BananaReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static BananaReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return BananaReq1.getInstance().validate(arg, configuration); } @@ -217,7 +217,7 @@ public static BananaReq1 getInstance() { return instance; } - public BananaReqMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public BananaReqMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java index a46435968b3..24a993b902f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java @@ -59,7 +59,7 @@ public static Bar1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -83,7 +83,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java index 826127d11ee..bcf56696004 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java @@ -79,7 +79,7 @@ public static ClassName getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,7 +90,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -129,7 +129,7 @@ protected BasquePigMap(FrozenMap<@Nullable Object> m) { "className" ); public static final Set optionalKeys = Set.of(); - public static BasquePigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static BasquePigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return BasquePig1.getInstance().validate(arg, configuration); } @@ -241,7 +241,7 @@ public static BasquePig1 getInstance() { return instance; } - public BasquePigMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public BasquePigMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java index 0681c9d4961..ec496bb4807 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java @@ -73,7 +73,7 @@ public static BooleanEnum1 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -84,7 +84,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public boolean validate(BooleanBooleanEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { + public boolean validate(BooleanBooleanEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java index d5fb609e4e8..395c2dfbe01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java @@ -108,7 +108,7 @@ protected CapitalizationMap(FrozenMap<@Nullable Object> m) { "SCA_ETH_Flow_Points", "ATT_NAME" ); - public static CapitalizationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static CapitalizationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Capitalization1.getInstance().validate(arg, configuration); } @@ -333,7 +333,7 @@ public static Capitalization1 getInstance() { return instance; } - public CapitalizationMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public CapitalizationMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java index b05aec208e2..c8d73ddd815 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java @@ -57,7 +57,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "declawed" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } @@ -146,7 +146,7 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -316,19 +316,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -344,20 +344,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -376,7 +376,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -387,7 +387,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java index b19f935049b..69587740b50 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java @@ -75,7 +75,7 @@ public static Name getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -99,7 +99,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -128,7 +128,7 @@ protected CategoryMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "id" ); - public static CategoryMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static CategoryMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Category1.getInstance().validate(arg, configuration); } @@ -278,7 +278,7 @@ public static Category1 getInstance() { return instance; } - public CategoryMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public CategoryMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java index fdb76bf0d38..b509a1e3c06 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java @@ -57,7 +57,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "name" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } @@ -146,7 +146,7 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -316,19 +316,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -344,20 +344,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -376,7 +376,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -387,7 +387,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java index 8949335b280..b2814545e30 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java @@ -57,7 +57,7 @@ protected ClassModelMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "_class" ); - public static ClassModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ClassModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ClassModel1.getInstance().validate(arg, configuration); } @@ -214,19 +214,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -242,20 +242,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -274,7 +274,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -285,7 +285,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public ClassModelMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ClassModelMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java index 9cd4880d680..17a225b997a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java @@ -48,7 +48,7 @@ protected ClientMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "client" ); - public static ClientMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ClientMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Client1.getInstance().validate(arg, configuration); } @@ -143,7 +143,7 @@ public static Client1 getInstance() { return instance; } - public ClientMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ClientMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java index 0f5fe34f199..87165addfa8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java @@ -87,7 +87,7 @@ public static QuadrilateralType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,7 +98,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -137,7 +137,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "quadrilateralType" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } @@ -232,7 +232,7 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -402,19 +402,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -430,20 +430,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -462,7 +462,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -473,7 +473,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java index 688e2a66912..f76f2694df8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java @@ -262,7 +262,7 @@ public static Schema9 getInstance() { } @Override - public Schema9List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema9List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -281,7 +281,7 @@ public Schema9List getNewInstance(List arg, List pathToItem, PathToSc return new Schema9List(newInstanceItems); } - public Schema9List validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema9List validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -506,19 +506,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -534,20 +534,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -566,7 +566,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -577,7 +577,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java index 924341f499f..b3091ab2c0d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java @@ -144,7 +144,7 @@ public static ComposedArray1 getInstance() { } @Override - public ComposedArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ComposedArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -163,7 +163,7 @@ public ComposedArrayList getNewInstance(List arg, List pathToItem, Pa return new ComposedArrayList(newInstanceItems); } - public ComposedArrayList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedArrayList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java index ec600363510..cc8e0e369e9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java @@ -70,7 +70,7 @@ public static ComposedBool1 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java index bee61f4d10f..6661e3e3a65 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java @@ -70,7 +70,7 @@ public static ComposedNone1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java index 37c4b6c7c2c..55ea6dad77f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java @@ -75,7 +75,7 @@ public static ComposedNumber1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -85,19 +85,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java index 89afb88c828..d9740ec68fb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java @@ -75,7 +75,7 @@ public static ComposedObject1 getInstance() { return instance; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java index 100e117efda..124549aa527 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java @@ -91,7 +91,7 @@ public static Schema4 getInstance() { return instance; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -269,7 +269,7 @@ public static Schema5 getInstance() { } @Override - public Schema5List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema5List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -288,7 +288,7 @@ public Schema5List getNewInstance(List arg, List pathToItem, PathToSc return new Schema5List(newInstanceItems); } - public Schema5List validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema5List validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -361,7 +361,7 @@ public static Schema6 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -513,19 +513,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -541,20 +541,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -573,7 +573,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -584,7 +584,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java index d4dc9ec084f..d7b4bb881eb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java @@ -72,7 +72,7 @@ public static ComposedString1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java index cc540c8c2f9..f1f538e7408 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java @@ -77,7 +77,7 @@ public static Currency1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -88,7 +88,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringCurrencyEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringCurrencyEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java index 9b28b43a094..b0c60eff94d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java @@ -79,7 +79,7 @@ public static ClassName getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,7 +90,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -129,7 +129,7 @@ protected DanishPigMap(FrozenMap<@Nullable Object> m) { "className" ); public static final Set optionalKeys = Set.of(); - public static DanishPigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static DanishPigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return DanishPig1.getInstance().validate(arg, configuration); } @@ -241,7 +241,7 @@ public static DanishPig1 getInstance() { return instance; } - public DanishPigMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public DanishPigMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java index 5d34b2dc7b9..4e4f60df3b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java @@ -61,7 +61,7 @@ public static DateTimeTest1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -85,7 +85,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java index eadd8a76100..e8803ed07af 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java @@ -63,7 +63,7 @@ public static DateTimeWithValidations1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java index c30a44c17dd..d948b7f3044 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java @@ -63,7 +63,7 @@ public static DateWithValidations1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java index 4732a7167ce..89c74536238 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java @@ -57,7 +57,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "breed" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } @@ -146,7 +146,7 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -316,19 +316,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -344,20 +344,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -376,7 +376,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -387,7 +387,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java index 9af29e766a2..2fba007ab8a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java @@ -133,7 +133,7 @@ public static Shapes getInstance() { } @Override - public ShapesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ShapesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -155,7 +155,7 @@ public ShapesList getNewInstance(List arg, List pathToItem, PathToSch return new ShapesList(newInstanceItems); } - public ShapesList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ShapesList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +203,7 @@ protected DrawingMap(FrozenMap<@Nullable Object> m) { "nullableShape", "shapes" ); - public static DrawingMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static DrawingMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Drawing1.getInstance().validate(arg, configuration); } @@ -593,7 +593,7 @@ public static Drawing1 getInstance() { return instance; } - public DrawingMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public DrawingMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java index 1cb148337ee..3acfae4e910 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java @@ -83,7 +83,7 @@ public static JustSymbol getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -94,7 +94,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringJustSymbolEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringJustSymbolEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -174,7 +174,7 @@ public static Items getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,7 +185,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringItemsEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringItemsEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -284,7 +284,7 @@ public static ArrayEnum getInstance() { } @Override - public ArrayEnumList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayEnumList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -306,7 +306,7 @@ public ArrayEnumList getNewInstance(List arg, List pathToItem, PathTo return new ArrayEnumList(newInstanceItems); } - public ArrayEnumList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayEnumList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -352,7 +352,7 @@ protected EnumArraysMap(FrozenMap<@Nullable Object> m) { "just_symbol", "array_enum" ); - public static EnumArraysMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static EnumArraysMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return EnumArrays1.getInstance().validate(arg, configuration); } @@ -479,7 +479,7 @@ public static EnumArrays1 getInstance() { return instance; } - public EnumArraysMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public EnumArraysMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java index 2e135af5e31..5edb162d2cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java @@ -85,7 +85,7 @@ public static EnumClass1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -96,7 +96,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringEnumClassEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringEnumClassEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -114,7 +114,7 @@ public String validate(StringEnumClassEnums arg,SchemaConfiguration configuratio } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java index b0ab185439e..7aba6c9b3fd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java @@ -93,7 +93,7 @@ public static EnumString getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -104,7 +104,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringEnumStringEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringEnumStringEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -186,7 +186,7 @@ public static EnumStringRequired getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +197,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringEnumStringRequiredEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringEnumStringRequiredEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -320,7 +320,7 @@ public static EnumInteger getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -330,31 +330,31 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @Override - public int validate(IntegerEnumIntegerEnums arg,SchemaConfiguration configuration) throws ValidationException { + public int validate(IntegerEnumIntegerEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongEnumIntegerEnums arg,SchemaConfiguration configuration) throws ValidationException { + public long validate(LongEnumIntegerEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatEnumIntegerEnums arg,SchemaConfiguration configuration) throws ValidationException { + public float validate(FloatEnumIntegerEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleEnumIntegerEnums arg,SchemaConfiguration configuration) throws ValidationException { + public double validate(DoubleEnumIntegerEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } @@ -451,7 +451,7 @@ public static EnumNumber getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -460,17 +460,17 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public float validate(FloatEnumNumberEnums arg,SchemaConfiguration configuration) throws ValidationException { + public float validate(FloatEnumNumberEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleEnumNumberEnums arg,SchemaConfiguration configuration) throws ValidationException { + public double validate(DoubleEnumNumberEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } @@ -518,7 +518,7 @@ protected EnumTestMap(FrozenMap<@Nullable Object> m) { "IntegerEnumWithDefaultValue", "IntegerEnumOneValue" ); - public static EnumTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static EnumTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return EnumTest1.getInstance().validate(arg, configuration); } @@ -1054,7 +1054,7 @@ public static EnumTest1 getInstance() { return instance; } - public EnumTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public EnumTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java index 511d329cb47..9d01d888e51 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java @@ -87,7 +87,7 @@ public static TriangleType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,7 +98,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -137,7 +137,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "triangleType" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } @@ -232,7 +232,7 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -402,19 +402,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -430,20 +430,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -462,7 +462,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -473,7 +473,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java index 4b2eb51f91e..7bf54efa7a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java @@ -48,7 +48,7 @@ protected FileMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "sourceURI" ); - public static FileMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static FileMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return File1.getInstance().validate(arg, configuration); } @@ -145,7 +145,7 @@ public static File1 getInstance() { return instance; } - public FileMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FileMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java index cc4f912d614..cf190885eff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java @@ -93,7 +93,7 @@ public static Files getInstance() { } @Override - public FilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -115,7 +115,7 @@ public FilesList getNewInstance(List arg, List pathToItem, PathToSche return new FilesList(newInstanceItems); } - public FilesList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FilesList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -161,7 +161,7 @@ protected FileSchemaTestClassMap(FrozenMap<@Nullable Object> m) { "file", "files" ); - public static FileSchemaTestClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static FileSchemaTestClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return FileSchemaTestClass1.getInstance().validate(arg, configuration); } @@ -282,7 +282,7 @@ public static FileSchemaTestClass1 getInstance() { return instance; } - public FileSchemaTestClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FileSchemaTestClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java index a14f1cb5451..8e15e3b2cbf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java @@ -36,7 +36,7 @@ protected FooMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "bar" ); - public static FooMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static FooMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Foo1.getInstance().validate(arg, configuration); } @@ -131,7 +131,7 @@ public static Foo1 getInstance() { return instance; } - public FooMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FooMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java index ed61c57c7c5..ba654b9258d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java @@ -83,7 +83,7 @@ public static IntegerSchema getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -93,19 +93,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -185,7 +185,7 @@ public static Int32withValidations getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,11 +195,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @@ -279,7 +279,7 @@ public static NumberSchema getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -289,19 +289,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -370,7 +370,7 @@ public static FloatSchema getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +379,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @@ -459,7 +459,7 @@ public static DoubleSchema getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -468,7 +468,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -600,7 +600,7 @@ public static ArrayWithUniqueItems getInstance() { } @Override - public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -622,7 +622,7 @@ public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToI return new ArrayWithUniqueItemsList(newInstanceItems); } - public ArrayWithUniqueItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithUniqueItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -695,7 +695,7 @@ public static StringSchema getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -834,7 +834,7 @@ public static Password getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -906,7 +906,7 @@ public static PatternWithDigits getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -979,7 +979,7 @@ public static PatternWithDigitsAndDelimiter getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1056,7 +1056,7 @@ protected FormatTestMap(FrozenMap<@Nullable Object> m) { "pattern_with_digits_and_delimiter", "noneProp" ); - public static FormatTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static FormatTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return FormatTest1.getInstance().validate(arg, configuration); } @@ -1975,7 +1975,7 @@ public static FormatTest1 getInstance() { return instance; } - public FormatTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FormatTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java index 5692157bda6..2f509b0ae7c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java @@ -61,7 +61,7 @@ protected FromSchemaMap(FrozenMap<@Nullable Object> m) { "data", "id" ); - public static FromSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static FromSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return FromSchema1.getInstance().validate(arg, configuration); } @@ -200,7 +200,7 @@ public static FromSchema1 getInstance() { return instance; } - public FromSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FromSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java index 275d87f5474..bf6970b316f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java @@ -57,7 +57,7 @@ protected FruitMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "color" ); - public static FruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static FruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Fruit1.getInstance().validate(arg, configuration); } @@ -226,19 +226,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -254,20 +254,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -286,7 +286,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -297,7 +297,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FruitMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FruitMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java index e5d97263a06..cd38807b41f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java @@ -156,19 +156,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -184,20 +184,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java index cb3f4599c5b..242a1109d03 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java @@ -57,7 +57,7 @@ protected GmFruitMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "color" ); - public static GmFruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static GmFruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return GmFruit1.getInstance().validate(arg, configuration); } @@ -226,19 +226,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -254,20 +254,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -286,7 +286,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -297,7 +297,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java index 4734ddc65a3..c9de3385bff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java @@ -48,7 +48,7 @@ protected GrandparentAnimalMap(FrozenMap<@Nullable Object> m) { "pet_type" ); public static final Set optionalKeys = Set.of(); - public static GrandparentAnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static GrandparentAnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return GrandparentAnimal1.getInstance().validate(arg, configuration); } @@ -154,7 +154,7 @@ public static GrandparentAnimal1 getInstance() { return instance; } - public GrandparentAnimalMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public GrandparentAnimalMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java index 4687de450d9..b52cd608aea 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java @@ -60,7 +60,7 @@ protected HasOnlyReadOnlyMap(FrozenMap<@Nullable Object> m) { "bar", "foo" ); - public static HasOnlyReadOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static HasOnlyReadOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return HasOnlyReadOnly1.getInstance().validate(arg, configuration); } @@ -181,7 +181,7 @@ public static HasOnlyReadOnly1 getInstance() { return instance; } - public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java index a499676d162..c66528dfc0b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java @@ -70,7 +70,7 @@ public static NullableMessage getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -81,7 +81,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +137,7 @@ protected HealthCheckResultMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "NullableMessage" ); - public static HealthCheckResultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static HealthCheckResultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return HealthCheckResult1.getInstance().validate(arg, configuration); } @@ -240,7 +240,7 @@ public static HealthCheckResult1 getInstance() { return instance; } - public HealthCheckResultMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HealthCheckResultMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java index b20ad0b018a..0ae374d8218 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java @@ -132,7 +132,7 @@ public static IntegerEnum1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,39 +142,39 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerIntegerEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { + public int validate(IntegerIntegerEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongIntegerEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { + public long validate(LongIntegerEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatIntegerEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { + public float validate(FloatIntegerEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleIntegerEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { + public double validate(DoubleIntegerEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java index 74085a9268a..2c174fedbb0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java @@ -132,7 +132,7 @@ public static IntegerEnumBig1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,39 +142,39 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws ValidationException { + public int validate(IntegerIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws ValidationException { + public long validate(LongIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws ValidationException { + public float validate(FloatIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws ValidationException { + public double validate(DoubleIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java index 3157279dfbf..25c20c6f654 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java @@ -122,7 +122,7 @@ public static IntegerEnumOneValue1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,39 +132,39 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public int validate(IntegerIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public long validate(LongIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public float validate(FloatIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public double validate(DoubleIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java index a4afc589221..f20493461ee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java @@ -134,7 +134,7 @@ public static IntegerEnumWithDefaultValue1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,39 +144,39 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public int validate(IntegerIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public long validate(LongIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public float validate(FloatIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public double validate(DoubleIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java index aca58126d3d..8f8be8bd121 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java @@ -62,7 +62,7 @@ public static IntegerMax101 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -72,19 +72,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java index 40f8b80b761..ce505b70d45 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java @@ -62,7 +62,7 @@ public static IntegerMin151 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -72,19 +72,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java index 57a6f72619c..89605406315 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java @@ -87,7 +87,7 @@ public static TriangleType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,7 +98,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -137,7 +137,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "triangleType" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } @@ -232,7 +232,7 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -402,19 +402,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -430,20 +430,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -462,7 +462,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -473,7 +473,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java index 594b1fe65bc..66ee99d8efa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java @@ -107,7 +107,7 @@ public static Items1 getInstance() { } @Override - public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -129,7 +129,7 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche return new ItemsList(newInstanceItems); } - public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java index 6d33dabcc9a..fee4c4225d8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java @@ -138,19 +138,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -166,20 +166,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -198,7 +198,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -209,7 +209,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -433,7 +433,7 @@ public static JSONPatchRequest1 getInstance() { } @Override - public JSONPatchRequestList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public JSONPatchRequestList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -452,7 +452,7 @@ public JSONPatchRequestList getNewInstance(List arg, List pathToItem, return new JSONPatchRequestList(newInstanceItems); } - public JSONPatchRequestList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequestList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java index 208f6dbb772..8faa3939e14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java @@ -119,7 +119,7 @@ public static Op getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,7 +130,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -171,7 +171,7 @@ protected JSONPatchRequestAddReplaceTestMap(FrozenMap<@Nullable Object> m) { "value" ); public static final Set optionalKeys = Set.of(); - public static JSONPatchRequestAddReplaceTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static JSONPatchRequestAddReplaceTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return JSONPatchRequestAddReplaceTest1.getInstance().validate(arg, configuration); } @@ -192,7 +192,11 @@ public String path() { } public @Nullable Object value() { - return getOrThrow("value"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -453,7 +457,7 @@ public static JSONPatchRequestAddReplaceTest1 getInstance() { return instance; } - public JSONPatchRequestAddReplaceTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public JSONPatchRequestAddReplaceTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java index 756770311c5..d8ebd383d3d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java @@ -117,7 +117,7 @@ public static Op getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -128,7 +128,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -169,12 +169,16 @@ protected JSONPatchRequestMoveCopyMap(FrozenMap m) { "path" ); public static final Set optionalKeys = Set.of(); - public static JSONPatchRequestMoveCopyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static JSONPatchRequestMoveCopyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return JSONPatchRequestMoveCopy1.getInstance().validate(arg, configuration); } public String from() { - return getOrThrow("from"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public String op() { @@ -186,7 +190,11 @@ public String op() { } public String path() { - return getOrThrow("path"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -399,7 +407,7 @@ public static JSONPatchRequestMoveCopy1 getInstance() { return instance; } - public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java index e358e5e96d5..f19e7a0ff7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java @@ -104,7 +104,7 @@ public static Op getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -115,7 +115,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -155,7 +155,7 @@ protected JSONPatchRequestRemoveMap(FrozenMap m) { "path" ); public static final Set optionalKeys = Set.of(); - public static JSONPatchRequestRemoveMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static JSONPatchRequestRemoveMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return JSONPatchRequestRemove1.getInstance().validate(arg, configuration); } @@ -168,7 +168,11 @@ public String op() { } public String path() { - return getOrThrow("path"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -303,7 +307,7 @@ public static JSONPatchRequestRemove1 getInstance() { return instance; } - public JSONPatchRequestRemoveMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public JSONPatchRequestRemoveMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java index 4cd47033fbd..57cdf3efd48 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java @@ -144,19 +144,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -172,20 +172,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -204,7 +204,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java index b0e6e922553..46569893dae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java @@ -52,7 +52,7 @@ protected AdditionalPropertiesMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AdditionalProperties.getInstance().validate(arg, configuration); } @@ -124,7 +124,7 @@ public static AdditionalProperties getInstance() { return instance; } - public AdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public AdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -195,7 +195,7 @@ protected MapMapOfStringMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapMapOfStringMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + public static MapMapOfStringMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MapMapOfString.getInstance().validate(arg, configuration); } @@ -267,7 +267,7 @@ public static MapMapOfString getInstance() { return instance; } - public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -381,7 +381,7 @@ public static AdditionalProperties2 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -392,7 +392,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringAdditionalPropertiesEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringAdditionalPropertiesEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -429,7 +429,7 @@ protected MapOfEnumStringMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapOfEnumStringMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MapOfEnumStringMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MapOfEnumString.getInstance().validate(arg, configuration); } @@ -508,7 +508,7 @@ public static MapOfEnumString getInstance() { return instance; } - public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -590,7 +590,7 @@ protected DirectMapMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static DirectMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static DirectMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return DirectMap.getInstance().validate(arg, configuration); } @@ -667,7 +667,7 @@ public static DirectMap getInstance() { return instance; } - public DirectMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public DirectMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -743,7 +743,7 @@ protected MapTestMap(FrozenMap<@Nullable Object> m) { "direct_map", "indirect_map" ); - public static MapTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MapTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MapTest1.getInstance().validate(arg, configuration); } @@ -916,7 +916,7 @@ public static MapTest1 getInstance() { return instance; } - public MapTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java index 60737d39485..7256e5dc912 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java @@ -59,7 +59,7 @@ protected MapMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + public static MapMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MapSchema.getInstance().validate(arg, configuration); } @@ -131,7 +131,7 @@ public static MapSchema getInstance() { return instance; } - public MapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -206,7 +206,7 @@ protected MixedPropertiesAndAdditionalPropertiesClassMap(FrozenMap<@Nullable Obj "dateTime", "map" ); - public static MixedPropertiesAndAdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MixedPropertiesAndAdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MixedPropertiesAndAdditionalPropertiesClass1.getInstance().validate(arg, configuration); } @@ -333,7 +333,7 @@ public static MixedPropertiesAndAdditionalPropertiesClass1 getInstance() { return instance; } - public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java index 646f92ae740..5bf2549f63d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java @@ -62,7 +62,7 @@ protected MoneyMap(FrozenMap<@Nullable Object> m) { "currency" ); public static final Set optionalKeys = Set.of(); - public static MoneyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MoneyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Money1.getInstance().validate(arg, configuration); } @@ -214,7 +214,7 @@ public static Money1 getInstance() { return instance; } - public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java index b985e9350ac..67574dcfddb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java @@ -61,7 +61,7 @@ protected MyObjectDtoMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "id" ); - public static MyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MyObjectDto1.getInstance().validate(arg, configuration); } @@ -142,7 +142,7 @@ public static MyObjectDto1 getInstance() { return instance; } - public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java index 081f87d53d9..7b28900597e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java @@ -83,7 +83,7 @@ protected NameMap(FrozenMap<@Nullable Object> m) { "snake_case", "property" ); - public static NameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static NameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Name1.getInstance().validate(arg, configuration); } @@ -325,19 +325,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -353,20 +353,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -385,7 +385,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -396,7 +396,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public NameMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public NameMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java index dec315f92ed..14440cb76b8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java @@ -74,12 +74,16 @@ protected NoAdditionalPropertiesMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "petId" ); - public static NoAdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static NoAdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return NoAdditionalProperties1.getInstance().validate(arg, configuration); } public Number id() { - return getOrThrow("id"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public Number petId() throws UnsetPropertyException { @@ -224,7 +228,7 @@ public static NoAdditionalProperties1 getInstance() { return instance; } - public NoAdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public NoAdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java index d412dae60ee..58c2f8fda6d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java @@ -77,7 +77,7 @@ public static AdditionalProperties3 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -87,7 +87,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -203,7 +203,7 @@ public static IntegerProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,7 +214,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -224,19 +224,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -321,7 +321,7 @@ public static NumberProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -332,7 +332,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -342,19 +342,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -436,7 +436,7 @@ public static BooleanProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -447,7 +447,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -538,7 +538,7 @@ public static StringProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -549,7 +549,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -638,7 +638,7 @@ public static DateProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -649,7 +649,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -738,7 +738,7 @@ public static DatetimeProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -749,7 +749,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -881,7 +881,7 @@ public static ArrayNullableProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -892,7 +892,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public ArrayNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -914,7 +914,7 @@ public ArrayNullablePropList getNewInstance(List arg, List pathToItem return new ArrayNullablePropList(newInstanceItems); } - public ArrayNullablePropList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayNullablePropList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1001,7 +1001,7 @@ public static Items1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1011,7 +1011,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -1161,7 +1161,7 @@ public static ArrayAndItemsNullableProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1172,7 +1172,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public ArrayAndItemsNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayAndItemsNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable FrozenMap> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1194,7 +1194,7 @@ public ArrayAndItemsNullablePropList getNewInstance(List arg, List pa return new ArrayAndItemsNullablePropList(newInstanceItems); } - public ArrayAndItemsNullablePropList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayAndItemsNullablePropList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1281,7 +1281,7 @@ public static Items2 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1291,7 +1291,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -1431,7 +1431,7 @@ public static ArrayItemsNullable getInstance() { } @Override - public ArrayItemsNullableList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ArrayItemsNullableList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable FrozenMap> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1453,7 +1453,7 @@ public ArrayItemsNullableList getNewInstance(List arg, List pathToIte return new ArrayItemsNullableList(newInstanceItems); } - public ArrayItemsNullableList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayItemsNullableList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1507,7 +1507,7 @@ protected ObjectNullablePropMap(FrozenMap> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static ObjectNullablePropMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectNullablePropMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectNullableProp.getInstance().validate(arg, configuration); } @@ -1590,7 +1590,7 @@ public static ObjectNullableProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1600,7 +1600,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public ObjectNullablePropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectNullablePropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap> properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -1714,7 +1714,7 @@ public static AdditionalProperties1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1724,7 +1724,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -1802,7 +1802,7 @@ protected ObjectAndItemsNullablePropMap(FrozenMap<@Nullable FrozenMap> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static ObjectAndItemsNullablePropMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectAndItemsNullablePropMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectAndItemsNullableProp.getInstance().validate(arg, configuration); } @@ -1892,7 +1892,7 @@ public static ObjectAndItemsNullableProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1902,7 +1902,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap> properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -2016,7 +2016,7 @@ public static AdditionalProperties2 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2026,7 +2026,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -2104,7 +2104,7 @@ protected ObjectItemsNullableMap(FrozenMap<@Nullable FrozenMap> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static ObjectItemsNullableMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectItemsNullableMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectItemsNullable.getInstance().validate(arg, configuration); } @@ -2183,7 +2183,7 @@ public static ObjectItemsNullable getInstance() { return instance; } - public ObjectItemsNullableMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectItemsNullableMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap> properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -2267,7 +2267,7 @@ protected NullableClassMap(FrozenMap<@Nullable Object> m) { "object_and_items_nullable_prop", "object_items_nullable" ); - public static NullableClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static NullableClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return NullableClass1.getInstance().validate(arg, configuration); } @@ -2768,7 +2768,7 @@ public static NullableClass1 getInstance() { return instance; } - public NullableClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public NullableClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java index 4a127d0c38e..178ec5eb6e3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java @@ -158,19 +158,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -186,20 +186,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -229,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java index d52f8c2d9bb..e42d1731060 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java @@ -67,7 +67,7 @@ public static NullableString1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -78,7 +78,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java index 2aec9f86eb4..18d11edde13 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java @@ -48,7 +48,7 @@ protected NumberOnlyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "JustNumber" ); - public static NumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static NumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return NumberOnly1.getInstance().validate(arg, configuration); } @@ -161,7 +161,7 @@ public static NumberOnly1 getInstance() { return instance; } - public NumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public NumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java index d839b2752c8..4f199fc58a1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java @@ -62,7 +62,7 @@ public static NumberWithExclusiveMinMax1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -72,19 +72,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java index b859f61f42c..f24ef914410 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java @@ -62,7 +62,7 @@ public static NumberWithValidations1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -72,19 +72,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java index 7440322d228..f272fe16458 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java @@ -48,7 +48,7 @@ protected ObjWithRequiredPropsMap(FrozenMap<@Nullable Object> m) { "a" ); public static final Set optionalKeys = Set.of(); - public static ObjWithRequiredPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjWithRequiredPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjWithRequiredProps1.getInstance().validate(arg, configuration); } @@ -157,7 +157,7 @@ public static ObjWithRequiredProps1 getInstance() { return instance; } - public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java index 8d1712ddba9..1d390319151 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java @@ -48,7 +48,7 @@ protected ObjWithRequiredPropsBaseMap(FrozenMap<@Nullable Object> m) { "b" ); public static final Set optionalKeys = Set.of(); - public static ObjWithRequiredPropsBaseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjWithRequiredPropsBaseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjWithRequiredPropsBase1.getInstance().validate(arg, configuration); } @@ -154,7 +154,7 @@ public static ObjWithRequiredPropsBase1 getInstance() { return instance; } - public ObjWithRequiredPropsBaseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjWithRequiredPropsBaseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java index 2b92bc15f29..8c3c949c715 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java @@ -60,7 +60,7 @@ protected ObjectModelWithArgAndArgsPropertiesMap(FrozenMap<@Nullable Object> m) "args" ); public static final Set optionalKeys = Set.of(); - public static ObjectModelWithArgAndArgsPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectModelWithArgAndArgsPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectModelWithArgAndArgsProperties1.getInstance().validate(arg, configuration); } @@ -217,7 +217,7 @@ public static ObjectModelWithArgAndArgsProperties1 getInstance() { return instance; } - public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java index 46d4dd148c3..d523d776433 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java @@ -38,7 +38,7 @@ protected ObjectModelWithRefPropsMap(FrozenMap<@Nullable Object> m) { "myString", "myBoolean" ); - public static ObjectModelWithRefPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectModelWithRefPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectModelWithRefProps1.getInstance().validate(arg, configuration); } @@ -205,7 +205,7 @@ public static ObjectModelWithRefProps1 getInstance() { return instance; } - public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java index 83ae5af726f..53049449878 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java @@ -59,12 +59,16 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "name" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } public @Nullable Object test() { - return getOrThrow("test"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public String name() throws UnsetPropertyException { @@ -228,7 +232,7 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -398,19 +402,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -426,20 +430,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -458,7 +462,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -469,7 +473,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java index 0b16a14b9db..1867b87413a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java @@ -60,7 +60,7 @@ protected ObjectWithCollidingPropertiesMap(FrozenMap<@Nullable Object> m) { "someProp", "someprop" ); - public static ObjectWithCollidingPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectWithCollidingPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectWithCollidingProperties1.getInstance().validate(arg, configuration); } @@ -183,7 +183,7 @@ public static ObjectWithCollidingProperties1 getInstance() { return instance; } - public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java index fe684c55bfe..d2038142236 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java @@ -50,7 +50,7 @@ protected ObjectWithDecimalPropertiesMap(FrozenMap<@Nullable Object> m) { "width", "cost" ); - public static ObjectWithDecimalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectWithDecimalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectWithDecimalProperties1.getInstance().validate(arg, configuration); } @@ -197,7 +197,7 @@ public static ObjectWithDecimalProperties1 getInstance() { return instance; } - public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java index de3ef5c0fd5..e2b8355cced 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java @@ -75,7 +75,7 @@ protected ObjectWithDifficultlyNamedPropsMap(FrozenMap<@Nullable Object> m) { "$special[property.name]", "123Number" ); - public static ObjectWithDifficultlyNamedPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectWithDifficultlyNamedPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectWithDifficultlyNamedProps1.getInstance().validate(arg, configuration); } @@ -243,7 +243,7 @@ public static ObjectWithDifficultlyNamedProps1 getInstance() { return instance; } - public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java index e5dd13be7c0..be226020f8e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java @@ -70,7 +70,7 @@ public static Schema0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,19 +208,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -236,20 +236,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -268,7 +268,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -402,7 +402,7 @@ protected ObjectWithInlineCompositionPropertyMap(FrozenMap<@Nullable Object> m) public static final Set optionalKeys = Set.of( "someProp" ); - public static ObjectWithInlineCompositionPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectWithInlineCompositionPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectWithInlineCompositionProperty1.getInstance().validate(arg, configuration); } @@ -539,7 +539,7 @@ public static ObjectWithInlineCompositionProperty1 getInstance() { return instance; } - public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java index 6503902e3e9..573ef372044 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java @@ -37,7 +37,7 @@ protected ObjectWithInvalidNamedRefedPropertiesMap(FrozenMap<@Nullable Object> m "from" ); public static final Set optionalKeys = Set.of(); - public static ObjectWithInvalidNamedRefedPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectWithInvalidNamedRefedPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectWithInvalidNamedRefedProperties1.getInstance().validate(arg, configuration); } @@ -186,7 +186,7 @@ public static ObjectWithInvalidNamedRefedProperties1 getInstance() { return instance; } - public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java index c27d1e36619..e42a2c21c9d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java @@ -60,7 +60,7 @@ protected ObjectWithNonIntersectingValuesMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "a" ); - public static ObjectWithNonIntersectingValuesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectWithNonIntersectingValuesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectWithNonIntersectingValues1.getInstance().validate(arg, configuration); } @@ -190,7 +190,7 @@ public static ObjectWithNonIntersectingValues1 getInstance() { return instance; } - public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java index 5f76e1a3b33..78d3fba8eb5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java @@ -74,7 +74,7 @@ protected ObjectWithOnlyOptionalPropsMap(FrozenMap m) { "a", "b" ); - public static ObjectWithOnlyOptionalPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectWithOnlyOptionalPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectWithOnlyOptionalProps1.getInstance().validate(arg, configuration); } @@ -205,7 +205,7 @@ public static ObjectWithOnlyOptionalProps1 getInstance() { return instance; } - public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java index 224aad5414a..a4417d104e2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java @@ -48,7 +48,7 @@ protected ObjectWithOptionalTestPropMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "test" ); - public static ObjectWithOptionalTestPropMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectWithOptionalTestPropMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectWithOptionalTestProp1.getInstance().validate(arg, configuration); } @@ -143,7 +143,7 @@ public static ObjectWithOptionalTestProp1 getInstance() { return instance; } - public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java index 55808b655b4..d0aa9f71d8a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java @@ -61,7 +61,7 @@ public static ObjectWithValidations1 getInstance() { return instance; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java index de3df444595..99292febf43 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java @@ -131,7 +131,7 @@ public static Status getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,7 +142,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -197,7 +197,7 @@ protected OrderMap(FrozenMap<@Nullable Object> m) { "status", "complete" ); - public static OrderMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static OrderMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Order1.getInstance().validate(arg, configuration); } @@ -470,7 +470,7 @@ public static Order1 getInstance() { return instance; } - public OrderMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public OrderMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java index 7341ce01c3f..b1524679555 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java @@ -118,7 +118,7 @@ public static Results getInstance() { } @Override - public ResultsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ResultsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -140,7 +140,7 @@ public ResultsList getNewInstance(List arg, List pathToItem, PathToSc return new ResultsList(newInstanceItems); } - public ResultsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ResultsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -186,7 +186,7 @@ protected PaginatedResultMyObjectDtoMap(FrozenMap m) { "results" ); public static final Set optionalKeys = Set.of(); - public static PaginatedResultMyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PaginatedResultMyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PaginatedResultMyObjectDto1.getInstance().validate(arg, configuration); } @@ -350,7 +350,7 @@ public static PaginatedResultMyObjectDto1 getInstance() { return instance; } - public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java index d9acac7bd8a..8114db70884 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java @@ -63,7 +63,7 @@ public static ParentPet1 getInstance() { return instance; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java index 22e72fa1bb5..0fa02e8fd26 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java @@ -132,7 +132,7 @@ public static PhotoUrls getInstance() { } @Override - public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -154,7 +154,7 @@ public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathTo return new PhotoUrlsList(newInstanceItems); } - public PhotoUrlsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public PhotoUrlsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,7 +242,7 @@ public static Status getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -253,7 +253,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -347,7 +347,7 @@ public static Tags getInstance() { } @Override - public TagsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public TagsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -369,7 +369,7 @@ public TagsList getNewInstance(List arg, List pathToItem, PathToSchem return new TagsList(newInstanceItems); } - public TagsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public TagsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -420,7 +420,7 @@ protected PetMap(FrozenMap<@Nullable Object> m) { "tags", "status" ); - public static PetMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PetMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Pet1.getInstance().validate(arg, configuration); } @@ -707,7 +707,7 @@ public static Pet1 getInstance() { return instance; } - public PetMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PetMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java index 9a385a57d58..343e8ad49aa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java @@ -143,19 +143,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -171,20 +171,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -203,7 +203,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,7 +214,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java index e0555909702..67a28cefe23 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java @@ -49,7 +49,7 @@ protected PlayerMap(FrozenMap<@Nullable Object> m) { "name", "enemyPlayer" ); - public static PlayerMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PlayerMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Player1.getInstance().validate(arg, configuration); } @@ -172,7 +172,7 @@ public static Player1 getInstance() { return instance; } - public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java index 6e03a2081a6..c57b2630d5d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java @@ -48,7 +48,7 @@ protected PublicKeyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "key" ); - public static PublicKeyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PublicKeyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PublicKey1.getInstance().validate(arg, configuration); } @@ -145,7 +145,7 @@ public static PublicKey1 getInstance() { return instance; } - public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java index eb0913bb7b3..03a218aa723 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java @@ -143,19 +143,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -171,20 +171,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -203,7 +203,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,7 +214,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java index a78c73750d0..e11bafed08c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java @@ -88,7 +88,7 @@ public static ShapeType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -99,7 +99,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -150,7 +150,7 @@ protected QuadrilateralInterfaceMap(FrozenMap<@Nullable Object> m) { "shapeType" ); public static final Set optionalKeys = Set.of(); - public static QuadrilateralInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static QuadrilateralInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QuadrilateralInterface1.getInstance().validate(arg, configuration); } @@ -383,19 +383,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -411,20 +411,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -443,7 +443,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -454,7 +454,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public QuadrilateralInterfaceMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QuadrilateralInterfaceMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java index 68e6ae7401f..628396ada39 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java @@ -60,7 +60,7 @@ protected ReadOnlyFirstMap(FrozenMap<@Nullable Object> m) { "bar", "baz" ); - public static ReadOnlyFirstMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ReadOnlyFirstMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ReadOnlyFirst1.getInstance().validate(arg, configuration); } @@ -181,7 +181,7 @@ public static ReadOnlyFirst1 getInstance() { return instance; } - public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java index 81d5e0b308c..9cc070d0913 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java @@ -48,12 +48,16 @@ protected ReqPropsFromExplicitAddPropsMap(FrozenMap m) { "validName" ); public static final Set optionalKeys = Set.of(); - public static ReqPropsFromExplicitAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ReqPropsFromExplicitAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ReqPropsFromExplicitAddProps1.getInstance().validate(arg, configuration); } public String validName() { - return getOrThrow("validName"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public String getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -202,7 +206,7 @@ public static ReqPropsFromExplicitAddProps1 getInstance() { return instance; } - public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java index 403e71edb6c..19f0a4ebe2e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java @@ -48,12 +48,16 @@ protected ReqPropsFromTrueAddPropsMap(FrozenMap<@Nullable Object> m) { "validName" ); public static final Set optionalKeys = Set.of(); - public static ReqPropsFromTrueAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ReqPropsFromTrueAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ReqPropsFromTrueAddProps1.getInstance().validate(arg, configuration); } public @Nullable Object validName() { - return getOrThrow("validName"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -354,7 +358,7 @@ public static ReqPropsFromTrueAddProps1 getInstance() { return instance; } - public ReqPropsFromTrueAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ReqPropsFromTrueAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java index e35c0546b48..da77d50c61f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java @@ -36,12 +36,16 @@ protected ReqPropsFromUnsetAddPropsMap(FrozenMap<@Nullable Object> m) { "validName" ); public static final Set optionalKeys = Set.of(); - public static ReqPropsFromUnsetAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ReqPropsFromUnsetAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ReqPropsFromUnsetAddProps1.getInstance().validate(arg, configuration); } public @Nullable Object validName() { - return getOrThrow("validName"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -273,7 +277,7 @@ public static ReqPropsFromUnsetAddProps1 getInstance() { return instance; } - public ReqPropsFromUnsetAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ReqPropsFromUnsetAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java index cde9348b342..2a7b44c41cb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java @@ -57,7 +57,7 @@ protected ReturnMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "return" ); - public static ReturnMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ReturnMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ReturnSchema1.getInstance().validate(arg, configuration); } @@ -220,19 +220,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -248,20 +248,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -280,7 +280,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java index a3a51048188..db1a142b28d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java @@ -87,7 +87,7 @@ public static TriangleType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,7 +98,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -137,7 +137,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "triangleType" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } @@ -232,7 +232,7 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -402,19 +402,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -430,20 +430,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -462,7 +462,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -473,7 +473,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java index 4ef90595cef..9d8658b8404 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java @@ -70,7 +70,7 @@ protected Schema200ResponseMap(FrozenMap<@Nullable Object> m) { "name", "class" ); - public static Schema200ResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema200ResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema200Response1.getInstance().validate(arg, configuration); } @@ -259,19 +259,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -287,20 +287,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -319,7 +319,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -330,7 +330,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public Schema200ResponseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema200ResponseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java index 391c432945d..ecadb3c0884 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java @@ -92,7 +92,7 @@ public static SelfReferencingArrayModel1 getInstance() { } @Override - public SelfReferencingArrayModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SelfReferencingArrayModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -114,7 +114,7 @@ public SelfReferencingArrayModelList getNewInstance(List arg, List pa return new SelfReferencingArrayModelList(newInstanceItems); } - public SelfReferencingArrayModelList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public SelfReferencingArrayModelList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java index 06512cff6c2..6e58fffcf42 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java @@ -36,7 +36,7 @@ protected SelfReferencingObjectModelMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "selfRef" ); - public static SelfReferencingObjectModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static SelfReferencingObjectModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return SelfReferencingObjectModel1.getInstance().validate(arg, configuration); } @@ -148,7 +148,7 @@ public static SelfReferencingObjectModel1 getInstance() { return instance; } - public SelfReferencingObjectModelMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SelfReferencingObjectModelMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java index 42a01a295f5..8eb367499ec 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java @@ -143,19 +143,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -171,20 +171,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -203,7 +203,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,7 +214,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java index f2ee34e6eee..4448d1887ae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java @@ -158,19 +158,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -186,20 +186,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -229,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java index e003d011a1f..5e736c213e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java @@ -87,7 +87,7 @@ public static QuadrilateralType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,7 +98,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -137,7 +137,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "quadrilateralType" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } @@ -232,7 +232,7 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -402,19 +402,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -430,20 +430,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -462,7 +462,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -473,7 +473,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java index f2be945112a..ab31049b44b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java @@ -142,19 +142,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -170,20 +170,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -202,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -213,7 +213,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java index ded331f552f..a56e561d953 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java @@ -48,7 +48,7 @@ protected SpecialModelnameMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "a" ); - public static SpecialModelnameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static SpecialModelnameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return SpecialModelname1.getInstance().validate(arg, configuration); } @@ -145,7 +145,7 @@ public static SpecialModelname1 getInstance() { return instance; } - public SpecialModelnameMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SpecialModelnameMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java index a68c7c2ef85..5959bf3ea83 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java @@ -45,7 +45,7 @@ protected StringBooleanMapMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static StringBooleanMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static StringBooleanMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return StringBooleanMap1.getInstance().validate(arg, configuration); } @@ -128,7 +128,7 @@ public static StringBooleanMap1 getInstance() { return instance; } - public StringBooleanMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public StringBooleanMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java index 2be475bc0f4..4ba9ddfdb9f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java @@ -110,7 +110,7 @@ public static StringEnum1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,7 +121,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,12 +132,12 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public Void validate(NullStringEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { + public Void validate(NullStringEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @Override - public String validate(StringStringEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringStringEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java index ea6617a8b7a..d2f1b7bdf94 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java @@ -81,7 +81,7 @@ public static StringEnumWithDefaultValue1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -92,7 +92,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringStringEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringStringEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -110,7 +110,7 @@ public String validate(StringStringEnumWithDefaultValueEnums arg,SchemaConfigura } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java index c618fe0a225..3e87f7a721a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java @@ -58,7 +58,7 @@ public static StringWithValidation1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java index bb7cc4c9bf1..680ccc7b6c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java @@ -61,7 +61,7 @@ protected TagMap(FrozenMap<@Nullable Object> m) { "id", "name" ); - public static TagMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static TagMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Tag1.getInstance().validate(arg, configuration); } @@ -200,7 +200,7 @@ public static Tag1 getInstance() { return instance; } - public TagMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public TagMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java index 9a6a0546bd6..d11963015ad 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java @@ -144,19 +144,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -172,20 +172,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -204,7 +204,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java index 8e0505b9eb8..130fc6198c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java @@ -88,7 +88,7 @@ public static ShapeType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -99,7 +99,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -150,7 +150,7 @@ protected TriangleInterfaceMap(FrozenMap<@Nullable Object> m) { "triangleType" ); public static final Set optionalKeys = Set.of(); - public static TriangleInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static TriangleInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return TriangleInterface1.getInstance().validate(arg, configuration); } @@ -383,19 +383,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -411,20 +411,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -443,7 +443,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -454,7 +454,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public TriangleInterfaceMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public TriangleInterfaceMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java index 3f8a3975eb4..d2e584bb2e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java @@ -60,7 +60,7 @@ public static UUIDString1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java index feca1011e62..00514139eaf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java @@ -181,7 +181,7 @@ public static ObjectWithNoDeclaredPropsNullable getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,7 +191,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -384,19 +384,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -412,20 +412,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -444,7 +444,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -455,7 +455,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -601,7 +601,7 @@ protected UserMap(FrozenMap<@Nullable Object> m) { "anyTypeExceptNullProp", "anyTypePropNullable" ); - public static UserMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static UserMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return User1.getInstance().validate(arg, configuration); } @@ -1164,7 +1164,7 @@ public static User1 getInstance() { return instance; } - public UserMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public UserMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java index ae2e8a60d52..87ad2b937a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java @@ -102,7 +102,7 @@ public static ClassName getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -113,7 +113,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -155,7 +155,7 @@ protected WhaleMap(FrozenMap<@Nullable Object> m) { "hasBaleen", "hasTeeth" ); - public static WhaleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static WhaleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Whale1.getInstance().validate(arg, configuration); } @@ -319,7 +319,7 @@ public static Whale1 getInstance() { return instance; } - public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java index 168d9e099dd..656e49b28f7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java @@ -95,7 +95,7 @@ public static Type getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -106,7 +106,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -184,7 +184,7 @@ public static ClassName getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,7 +195,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -236,7 +236,7 @@ protected ZebraMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "type" ); - public static ZebraMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ZebraMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Zebra1.getInstance().validate(arg, configuration); } @@ -449,7 +449,7 @@ public static Zebra1 getInstance() { return instance; } - public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java index e8300624dfc..ab0a17c080c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java @@ -50,7 +50,7 @@ protected HeaderParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "someHeader" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -125,7 +125,7 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java index f7821fd56ce..fe5073c471f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "subDir" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public String subDir() { - return getOrThrow("subDir"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -141,7 +145,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java index 4f908c5276b..0b6396a06f7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java @@ -71,7 +71,7 @@ public static Schema11 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -82,7 +82,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java index 662156732d6..dac009a0806 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "subDir" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public String subDir() { - return getOrThrow("subDir"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -141,7 +145,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java index dac75cd1483..f69c62b3fe2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java @@ -50,7 +50,7 @@ protected QueryParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "searchStr" ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -125,7 +125,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java index d8f4f419e84..de8fc2b90b6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java @@ -71,7 +71,7 @@ public static RouteParamSchema01 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -82,7 +82,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringRouteParamSchemaEnums0 arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringRouteParamSchemaEnums0 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java index ceba836e2ef..a79332aaaf9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java @@ -50,7 +50,7 @@ protected HeaderParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "someHeader" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -125,7 +125,7 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java index a37a27cda32..8ad5f97481c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "subDir" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public String subDir() { - return getOrThrow("subDir"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -141,7 +145,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java index 1cd54a34b9b..1bd15b0bda7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java @@ -53,7 +53,7 @@ protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "boolean_group" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -183,7 +183,7 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java index 338a0580300..01553434c05 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java @@ -57,7 +57,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "int64_group", "string_group" ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -288,7 +288,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java index 0fc48284aa6..6b135ec1863 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java @@ -71,7 +71,7 @@ public static Schema11 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -82,7 +82,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java index 1bb4d6193c5..7fc0c44544e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java @@ -71,7 +71,7 @@ public static Schema41 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -82,7 +82,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringSchemaEnums4 arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringSchemaEnums4 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java index f58e04d481f..003c08d8920 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java @@ -52,7 +52,7 @@ protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { "enum_header_string", "enum_header_string_array" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -165,7 +165,7 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java index 9e6ff8205ec..50a02ffbe09 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java @@ -56,7 +56,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "enum_query_integer", "enum_query_string_array" ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -281,7 +281,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java index 8d4b0be69ff..b233b4ebb39 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java @@ -77,7 +77,7 @@ public static Items0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -88,7 +88,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -106,7 +106,7 @@ public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -193,7 +193,7 @@ public static Schema01 getInstance() { } @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -215,7 +215,7 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList0(newInstanceItems); } - public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java index d3e4cdf4429..119393f0c76 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java @@ -75,7 +75,7 @@ public static Schema11 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,7 +86,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -104,7 +104,7 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java index df2e535ac26..7c79f5d34f2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java @@ -77,7 +77,7 @@ public static Items2 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -88,7 +88,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringItemsEnums2 arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringItemsEnums2 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -106,7 +106,7 @@ public String validate(StringItemsEnums2 arg,SchemaConfiguration configuration) } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -193,7 +193,7 @@ public static Schema21 getInstance() { } @Override - public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -215,7 +215,7 @@ public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList2(newInstanceItems); } - public SchemaList2 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public SchemaList2 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java index cdf9d19c5f3..82197719bb8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java @@ -75,7 +75,7 @@ public static Schema31 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,7 +86,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringSchemaEnums3 arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringSchemaEnums3 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -104,7 +104,7 @@ public String validate(StringSchemaEnums3 arg,SchemaConfiguration configuration) } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java index 1e2d7c15b13..61c9eb31a20 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java @@ -121,7 +121,7 @@ public static Schema41 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,31 +131,31 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @Override - public int validate(IntegerSchemaEnums4 arg,SchemaConfiguration configuration) throws ValidationException { + public int validate(IntegerSchemaEnums4 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongSchemaEnums4 arg,SchemaConfiguration configuration) throws ValidationException { + public long validate(LongSchemaEnums4 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatSchemaEnums4 arg,SchemaConfiguration configuration) throws ValidationException { + public float validate(FloatSchemaEnums4 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleSchemaEnums4 arg,SchemaConfiguration configuration) throws ValidationException { + public double validate(DoubleSchemaEnums4 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java index d726146199c..3bf8e7f05dc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java @@ -91,7 +91,7 @@ public static Schema51 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -100,17 +100,17 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public float validate(FloatSchemaEnums5 arg,SchemaConfiguration configuration) throws ValidationException { + public float validate(FloatSchemaEnums5 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleSchemaEnums5 arg,SchemaConfiguration configuration) throws ValidationException { + public double validate(DoubleSchemaEnums5 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index bbe2de005a6..1ff3d67c384 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -85,7 +85,7 @@ public static ApplicationxwwwformurlencodedItems getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -96,7 +96,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringApplicationxwwwformurlencodedItemsEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringApplicationxwwwformurlencodedItemsEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -114,7 +114,7 @@ public String validate(StringApplicationxwwwformurlencodedItemsEnums arg,SchemaC } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -201,7 +201,7 @@ public static ApplicationxwwwformurlencodedEnumFormStringArray getInstance() { } @Override - public ApplicationxwwwformurlencodedEnumFormStringArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationxwwwformurlencodedEnumFormStringArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -223,7 +223,7 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList getNewInstance(List< return new ApplicationxwwwformurlencodedEnumFormStringArrayList(newInstanceItems); } - public ApplicationxwwwformurlencodedEnumFormStringArrayList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedEnumFormStringArrayList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -312,7 +312,7 @@ public static ApplicationxwwwformurlencodedEnumFormString getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -323,7 +323,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringApplicationxwwwformurlencodedEnumFormStringEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringApplicationxwwwformurlencodedEnumFormStringEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -341,7 +341,7 @@ public String validate(StringApplicationxwwwformurlencodedEnumFormStringEnums ar } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -369,7 +369,7 @@ protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) "enum_form_string_array", "enum_form_string" ); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); } @@ -490,7 +490,7 @@ public static ApplicationxwwwformurlencodedSchema1 getInstance() { return instance; } - public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 20f4442dd32..b61dbb661ba 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -74,7 +74,7 @@ public static ApplicationxwwwformurlencodedInteger getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -84,19 +84,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -165,7 +165,7 @@ public static ApplicationxwwwformurlencodedInt32 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -175,11 +175,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @@ -258,7 +258,7 @@ public static ApplicationxwwwformurlencodedNumber getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -268,19 +268,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -348,7 +348,7 @@ public static ApplicationxwwwformurlencodedFloat getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -357,7 +357,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @@ -426,7 +426,7 @@ public static ApplicationxwwwformurlencodedDouble getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -435,7 +435,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -502,7 +502,7 @@ public static ApplicationxwwwformurlencodedString getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -574,7 +574,7 @@ public static ApplicationxwwwformurlencodedPatternWithoutDelimiter getInstance() } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -679,7 +679,7 @@ public static ApplicationxwwwformurlencodedDateTime getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -703,7 +703,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -757,7 +757,7 @@ public static ApplicationxwwwformurlencodedPassword getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -827,7 +827,7 @@ protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) "password", "callback" ); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); } @@ -1528,7 +1528,7 @@ public static ApplicationxwwwformurlencodedSchema1 getInstance() { return instance; } - public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java index 24e01b5b448..b2b28b70d38 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java @@ -50,12 +50,16 @@ protected QueryParametersMap(FrozenMap m) { "query" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } public String query() { - return getOrThrow("query"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -135,7 +139,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java index 4b7ad8f27be..f0b692345f0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java @@ -54,7 +54,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "some_var" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -280,7 +280,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java index 086a2e9a146..1c0eda6e495 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "id" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public String id() { - return getOrThrow("id"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -135,7 +139,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 76ae9ff97d4..46aab8874df 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -45,7 +45,7 @@ protected ApplicationjsonSchemaMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } @@ -117,7 +117,7 @@ public static ApplicationjsonSchema1 getInstance() { return instance; } - public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java index e562508fcb9..51b9fd33709 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java @@ -52,7 +52,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "compositionAtRoot", "compositionInProperty" ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -207,7 +207,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java index ccc4f70f4e3..a48102a168b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java @@ -68,7 +68,7 @@ public static Schema00 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,19 +206,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -234,20 +234,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -266,7 +266,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -277,7 +277,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java index 53b54f01e86..33ed9d69ac0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java @@ -70,7 +70,7 @@ public static Schema01 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,19 +208,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -236,20 +236,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -268,7 +268,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -402,7 +402,7 @@ protected SchemaMap1(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "someProp" ); - public static SchemaMap1 of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static SchemaMap1 of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema11.getInstance().validate(arg, configuration); } @@ -533,7 +533,7 @@ public static Schema11 getInstance() { return instance; } - public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 2c96cc9523d..e978ccbf3ff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -68,7 +68,7 @@ public static Applicationjson0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,19 +206,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -234,20 +234,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -266,7 +266,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -277,7 +277,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 21b63d62157..b9b6b89693f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -70,7 +70,7 @@ public static Multipartformdata0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,19 +208,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -236,20 +236,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -268,7 +268,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -402,7 +402,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "someProp" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -533,7 +533,7 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java index 695b0da9c5b..be27f64ddfe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java @@ -68,7 +68,7 @@ public static Applicationjson0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,19 +206,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -234,20 +234,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -266,7 +266,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -277,7 +277,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java index 2a1e790f1a2..4a5cc0ede82 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java @@ -70,7 +70,7 @@ public static Multipartformdata0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,19 +208,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -236,20 +236,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -268,7 +268,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -402,7 +402,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "someProp" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -533,7 +533,7 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 6ecf0882708..a0e5518d942 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -60,7 +60,7 @@ protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) "param2" ); public static final Set optionalKeys = Set.of(); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); } @@ -211,7 +211,7 @@ public static ApplicationxwwwformurlencodedSchema1 getInstance() { return instance; } - public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 7abe38bfe8a..42bd356b5a0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -48,7 +48,7 @@ protected ApplicationjsonSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "a" ); - public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } @@ -137,7 +137,7 @@ public static ApplicationjsonSchema1 getInstance() { return instance; } - public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 79627668a08..69743204f09 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -48,7 +48,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "b" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -137,7 +137,7 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java index b5adb891967..0c5c39b4fd3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java @@ -50,7 +50,7 @@ protected QueryParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "mapBean" ); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -125,7 +125,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java index de7150e15d9..270e98fa7e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java @@ -48,7 +48,7 @@ protected SchemaMap0(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "keyword" ); - public static SchemaMap0 of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static SchemaMap0 of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema01.getInstance().validate(arg, configuration); } @@ -137,7 +137,7 @@ public static Schema01 getInstance() { return instance; } - public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java index aa7682206d1..7de3a0cc5d5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java @@ -58,7 +58,7 @@ protected CookieParametersMap(FrozenMap<@Nullable Object> m) { "A-B", "self" ); - public static CookieParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static CookieParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return CookieParameters1.getInstance().validate(arg, configuration); } @@ -223,7 +223,7 @@ public static CookieParameters1 getInstance() { return instance; } - public CookieParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public CookieParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java index 0e2a00abf38..dabb50a717b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java @@ -56,7 +56,7 @@ protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { "A-B", "self" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -195,7 +195,7 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java index f71498c6051..69edc4fb49a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java @@ -58,7 +58,7 @@ protected PathParametersMap(FrozenMap<@Nullable Object> m) { "self" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -756,7 +756,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java index c4613b418f0..d728a8e82fb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java @@ -58,7 +58,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "A-B", "self" ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -223,7 +223,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java index 136cee7d885..d83883f9f44 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "petId" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public Number petId() { - return getOrThrow("petId"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -153,7 +157,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index ff272e85252..425a1e8036d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -62,7 +62,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "additionalMetadata" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -188,7 +188,7 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java index 8cd9c1628ed..80a2d4a1d9e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java @@ -50,12 +50,16 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "someParam" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } public @Nullable Object someParam() { - return getOrThrow("someParam"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -183,7 +187,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java index b8e5f47e5e7..4f9e9dcdb6e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java @@ -50,7 +50,7 @@ protected QueryParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "mapBean" ); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -125,7 +125,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java index 8c8a5f005bf..3f4d0d323ed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java @@ -60,7 +60,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "url" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -1452,7 +1452,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java index 0c364247e83..4f6ce7a4b96 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java @@ -97,7 +97,7 @@ public static Schema01 getInstance() { } @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -119,7 +119,7 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList0(newInstanceItems); } - public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java index 53e9e106e7b..0afd56c1683 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java @@ -97,7 +97,7 @@ public static Schema11 getInstance() { } @Override - public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -119,7 +119,7 @@ public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList1(newInstanceItems); } - public SchemaList1 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public SchemaList1 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java index 8b001cea7dc..56a0563c5a9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java @@ -97,7 +97,7 @@ public static Schema21 getInstance() { } @Override - public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -119,7 +119,7 @@ public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList2(newInstanceItems); } - public SchemaList2 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public SchemaList2 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java index 6f94b32c521..9c60f95c11b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java @@ -97,7 +97,7 @@ public static Schema31 getInstance() { } @Override - public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -119,7 +119,7 @@ public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList3(newInstanceItems); } - public SchemaList3 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public SchemaList3 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java index 92352108c2d..3c74762a71f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java @@ -97,7 +97,7 @@ public static Schema41 getInstance() { } @Override - public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -119,7 +119,7 @@ public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList4(newInstanceItems); } - public SchemaList4 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public SchemaList4 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 36009ea124b..da5de691612 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -62,7 +62,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "additionalMetadata" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -188,7 +188,7 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 08b9aaee4b3..5bee7e4e21a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -106,7 +106,7 @@ public static MultipartformdataFiles getInstance() { } @Override - public MultipartformdataFilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MultipartformdataFilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -128,7 +128,7 @@ public MultipartformdataFilesList getNewInstance(List arg, List pathT return new MultipartformdataFilesList(newInstanceItems); } - public MultipartformdataFilesList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataFilesList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -173,7 +173,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "files" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -262,7 +262,7 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java index 8e89dece1b4..177e9768dda 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java @@ -37,7 +37,7 @@ protected ApplicationjsonSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "string" ); - public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } @@ -116,7 +116,7 @@ public static ApplicationjsonSchema1 getInstance() { return instance; } - public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java index 4c00686226e..b6996507cc9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.servers.ServerWithVariables; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.paths.foo.get.servers.server1.Variables; @@ -9,16 +11,23 @@ import java.util.AbstractMap; public class FooGetServer1 extends ServerWithVariables { - - public FooGetServer1() { - super( - "https://petstore.swagger.io/{version}", - Variables.Variables1.getInstance().validate( + private static Variables.VariablesMap getVariables() { + try { + return Variables.Variables1.getInstance().validate( MapUtils.makeMap( new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ) + ); + } catch (ValidationException | InvalidTypeException e) { + throw new RuntimeException(e); + } + } + + public FooGetServer1() { + super( + "https://petstore.swagger.io/{version}", + getVariables() ); } public FooGetServer1(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java index 58d5f36188c..a30a5663e29 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java @@ -96,7 +96,7 @@ public static Version getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -107,7 +107,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -125,7 +125,7 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -152,12 +152,16 @@ protected VariablesMap(FrozenMap m) { "version" ); public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Variables1.getInstance().validate(arg, configuration); } public String version() { - return getOrThrow("version"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -243,7 +247,7 @@ public static Variables1 getInstance() { return instance; } - public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java index 7ce798858e4..be90b02fb0a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java @@ -51,12 +51,16 @@ protected QueryParametersMap(FrozenMap m) { "status" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } public Schema0.SchemaList0 status() { - return getOrThrow("status"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -136,7 +140,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java index 5594071aee6..77ec99edc57 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java @@ -79,7 +79,7 @@ public static Items0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,7 +90,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -108,7 +108,7 @@ public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -195,7 +195,7 @@ public static Schema01 getInstance() { } @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -217,7 +217,7 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList0(newInstanceItems); } - public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java index 365a0597ded..5ab4ae0157e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.servers.ServerWithVariables; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.paths.petfindbystatus.servers.server1.Variables; @@ -9,16 +11,23 @@ import java.util.AbstractMap; public class PetfindbystatusServer1 extends ServerWithVariables { - - public PetfindbystatusServer1() { - super( - "https://petstore.swagger.io/{version}", - Variables.Variables1.getInstance().validate( + private static Variables.VariablesMap getVariables() { + try { + return Variables.Variables1.getInstance().validate( MapUtils.makeMap( new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ) + ); + } catch (ValidationException | InvalidTypeException e) { + throw new RuntimeException(e); + } + } + + public PetfindbystatusServer1() { + super( + "https://petstore.swagger.io/{version}", + getVariables() ); } public PetfindbystatusServer1(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java index e622b7ac02a..559108d075b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java @@ -96,7 +96,7 @@ public static Version getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -107,7 +107,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -125,7 +125,7 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -152,12 +152,16 @@ protected VariablesMap(FrozenMap m) { "version" ); public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Variables1.getInstance().validate(arg, configuration); } public String version() { - return getOrThrow("version"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -243,7 +247,7 @@ public static Variables1 getInstance() { return instance; } - public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java index c4ef93d3f01..faa04d0a390 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java @@ -51,12 +51,16 @@ protected QueryParametersMap(FrozenMap m) { "tags" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } public Schema0.SchemaList0 tags() { - return getOrThrow("tags"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -136,7 +140,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java index 1660a363a63..d0877fdafa0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java @@ -97,7 +97,7 @@ public static Schema01 getInstance() { } @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -119,7 +119,7 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList0(newInstanceItems); } - public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java index e35183de207..8f25fc6c813 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java @@ -50,7 +50,7 @@ protected HeaderParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "api_key" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -125,7 +125,7 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java index 59fe1814cc8..72534b1f2c9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "petId" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public Number petId() { - return getOrThrow("petId"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -153,7 +157,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java index d6dc72541d6..1f36d797c57 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "petId" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public Number petId() { - return getOrThrow("petId"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -153,7 +157,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java index 8b31aa07e75..d4497aa16c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "petId" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public Number petId() { - return getOrThrow("petId"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -153,7 +157,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 0d9bbc0816a..6787d9728eb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -60,7 +60,7 @@ protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) "name", "status" ); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); } @@ -175,7 +175,7 @@ public static ApplicationxwwwformurlencodedSchema1 getInstance() { return instance; } - public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java index 8621fb63da8..2642b75cf4c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "petId" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public Number petId() { - return getOrThrow("petId"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -153,7 +157,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index f809a516e10..48a59fcb8cc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -61,7 +61,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { "additionalMetadata", "file" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -176,7 +176,7 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java index 52aaca5fe26..89a021814a9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "order_id" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public String order_id() { - return getOrThrow("order_id"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -135,7 +139,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java index d52c74e5c24..98fbf638ab6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "order_id" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public Number order_id() { - return getOrThrow("order_id"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -153,7 +157,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java index 44fca5e5ac4..836d51db5a6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java @@ -57,7 +57,7 @@ public static Schema01 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -67,19 +67,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java index 8c5b619443c..f623eb648b8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java @@ -52,7 +52,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "username" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -192,7 +192,7 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java index 5d9afd9e8f9..1a37c189b6b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java @@ -59,7 +59,7 @@ protected Code200ResponseHeadersSchemaMap(FrozenMap<@Nullable Object> m) { "X-Expires-After", "numberHeader" ); - public static Code200ResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Code200ResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Code200ResponseHeadersSchema1.getInstance().validate(arg, configuration); } @@ -326,7 +326,7 @@ public static Code200ResponseHeadersSchema1 getInstance() { return instance; } - public Code200ResponseHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public Code200ResponseHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java index a8d9f3c2972..2044250089f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "username" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public String username() { - return getOrThrow("username"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -135,7 +139,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java index 084596e13a7..1ae45c9d19a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "username" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public String username() { - return getOrThrow("username"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -135,7 +139,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java index 96b11df0969..e19e97b5348 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java @@ -50,12 +50,16 @@ protected PathParametersMap(FrozenMap m) { "username" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PathParameters1.getInstance().validate(arg, configuration); } public String username() { - return getOrThrow("username"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -135,7 +139,7 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java index 43fe8423969..1a0611f1b8e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java @@ -1,5 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; + public interface DefaultValueMethod { - T defaultValue(); + T defaultValue() throws InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java index 6327eea827e..314d2c82bbe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.servers.server0.Variables; @@ -11,17 +13,24 @@ public class Server0 extends ServerWithVariables { /* petstore server */ - - public Server0() { - super( - "http://{server}.swagger.io:{port}/v2", - Variables.Variables1.getInstance().validate( + private static Variables.VariablesMap getVariables() { + try { + return Variables.Variables1.getInstance().validate( MapUtils.makeMap( new AbstractMap.SimpleEntry<>("port", Variables.Port.getInstance().defaultValue()), new AbstractMap.SimpleEntry<>("server", Variables.Server.getInstance().defaultValue()) ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ) + ); + } catch (ValidationException | InvalidTypeException e) { + throw new RuntimeException(e); + } + } + + public Server0() { + super( + "http://{server}.swagger.io:{port}/v2", + getVariables() ); } public Server0(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java index 12d78391b64..ca7947449b0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.servers.server1.Variables; @@ -11,16 +13,23 @@ public class Server1 extends ServerWithVariables { /* The local server */ - - public Server1() { - super( - "https://localhost:8080/{version}", - Variables.Variables1.getInstance().validate( + private static Variables.VariablesMap getVariables() { + try { + return Variables.Variables1.getInstance().validate( MapUtils.makeMap( new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ) + ); + } catch (ValidationException | InvalidTypeException e) { + throw new RuntimeException(e); + } + } + + public Server1() { + super( + "https://localhost:8080/{version}", + getVariables() ); } public Server1(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java index 12c3a68ffb0..82aecdd2773 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java @@ -98,7 +98,7 @@ public static Server getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -109,7 +109,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringServerEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringServerEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -127,7 +127,7 @@ public String validate(StringServerEnums arg,SchemaConfiguration configuration) } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -196,7 +196,7 @@ public static Port getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,7 +207,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringPortEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringPortEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -225,7 +225,7 @@ public String validate(StringPortEnums arg,SchemaConfiguration configuration) th } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -253,7 +253,7 @@ protected VariablesMap(FrozenMap m) { "server" ); public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Variables1.getInstance().validate(arg, configuration); } @@ -405,7 +405,7 @@ public static Variables1 getInstance() { return instance; } - public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java index 1ecc7a5cb8e..09b5f3bbd7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java @@ -96,7 +96,7 @@ public static Version getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -107,7 +107,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -125,7 +125,7 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -152,12 +152,16 @@ protected VariablesMap(FrozenMap m) { "version" ); public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Variables1.getInstance().validate(arg, configuration); } public String version() { - return getOrThrow("version"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -243,7 +247,7 @@ public static Variables1 getInstance() { return instance; } - public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs index 39836793fcf..f467e48f7f2 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs @@ -77,7 +77,7 @@ public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPi {{> src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor }} {{> src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} {{#if defaultValue}} - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index 834626dbd42..a89372b77a4 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -3,7 +3,7 @@ {{#eq this "null"}} @Override -public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { +public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -15,7 +15,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat {{/eq}} {{#eq this "object"}} -public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<@Nullable Object>{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { +public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<@Nullable Object>{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -67,7 +67,7 @@ public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}} {{#eq this "array"}} @Override -public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { +public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -101,7 +101,7 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCa {{/if}} } -public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} validate(List arg, SchemaConfiguration configuration) throws ValidationException { +public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -118,7 +118,7 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCa {{else}} @Override -public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { +public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +132,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val {{#eq this "integer"}} @Override -public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { +public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,20 +142,20 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } {{#neq ../format "int32"}} -public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { +public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } {{/neq}} @@ -163,7 +163,7 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val {{#eq this "number"}} @Override -public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { +public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -174,55 +174,55 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val } {{#eq ../format null}} -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } -public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { +public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } {{else}} {{#eq ../format "int32"}} -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } {{else}} {{#eq ../format "int64"}} -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } -public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { +public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } {{else}} {{#eq ../format "float"}} -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } {{else}} {{#eq ../format "double"}} -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } {{/eq}} @@ -234,7 +234,7 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val {{#eq this "boolean"}} @Override -public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { +public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -283,19 +283,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } -public int validate(int arg, SchemaConfiguration configuration) { +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } -public long validate(long arg, SchemaConfiguration configuration) { +public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } -public float validate(float arg, SchemaConfiguration configuration) { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } -public double validate(double arg, SchemaConfiguration configuration) { +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -311,20 +311,20 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } -public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { +public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } -public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { +public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } -public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { +public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @Override -public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { +public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { List<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -358,7 +358,7 @@ public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{ {{/if}} } -public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} validate(List arg, SchemaConfiguration configuration) throws ValidationException { +public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -369,7 +369,7 @@ public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{ } @Override -public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { +public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { LinkedHashMap src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); @@ -421,49 +421,49 @@ public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else {{#and enumInfo enumInfo.typeToValues.null}} @Override -public Void validate(Null{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { +public Void validate(Null{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.boolean}} @Override -public boolean validate(Boolean{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { +public boolean validate(Boolean{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.string}} @Override -public String validate(String{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { +public String validate(String{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.Integer}} @Override -public int validate(Integer{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { +public int validate(Integer{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (int) validate((Number) arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.Long}} @Override -public long validate(Long{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { +public long validate(Long{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (long) validate((Number) arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.Float}} @Override -public float validate(Float{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { +public float validate(Float{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.Double}} @Override -public double validate(Double{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { +public double validate(Double{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } {{/and}} diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputGetProperty.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputGetProperty.hbs index b6ad1c0bb3a..01f6c68d593 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputGetProperty.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputGetProperty.hbs @@ -3,7 +3,11 @@ {{#contains ../../mapValueSchema "null"}} return get("{{{@key.original}}}"); {{else}} -return getOrThrow("{{{@key.original}}}"); +try { + return getOrThrow("version"); +} catch (UnsetPropertyException e) { + throw new RuntimeException(e); +} {{/contains}} {{else}} {{#with ../../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type fullRefModule="" }}{{/with}} value = get("{{{@key.original}}}"); diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputType.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputType.hbs index 3bd3071359b..a9d22ab6c1e 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputType.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputType.hbs @@ -39,11 +39,11 @@ public static class {{mapOutputJsonPathPiece.pascalCase}} extends FrozenMap<@Nul {{/eq}} {{/eq}} {{#if mapValueSchema}} - public static {{mapOutputJsonPathPiece.pascalCase}} of(Map src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException { + public static {{mapOutputJsonPathPiece.pascalCase}} of(Map src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration); } {{else}} - public static {{mapOutputJsonPathPiece.pascalCase}} of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static {{mapOutputJsonPathPiece.pascalCase}} of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration); } {{/if}} diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/DefaultValueMethod.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/DefaultValueMethod.hbs index 3f920e4042c..c19a5ba9d51 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/DefaultValueMethod.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/DefaultValueMethod.hbs @@ -1,5 +1,7 @@ package {{{packageName}}}.schemas.validation; +import {{{packageName}}}.exceptions.InvalidTypeException; + public interface DefaultValueMethod { - T defaultValue(); + T defaultValue() throws InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/servers/ServerN.hbs b/src/main/resources/java/src/main/java/packagename/servers/ServerN.hbs index 931bccba6b9..be9db5b7969 100644 --- a/src/main/resources/java/src/main/java/packagename/servers/ServerN.hbs +++ b/src/main/resources/java/src/main/java/packagename/servers/ServerN.hbs @@ -4,6 +4,8 @@ package {{{packageName}}}.{{subpackage}}; {{#with variables}} import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.ValidationException; {{#neq ../subpackage "servers"}} import {{{packageName}}}.servers.ServerWithVariables; {{/neq}} @@ -18,18 +20,25 @@ public class {{../jsonPathPiece.pascalCase}} extends ServerWithVariables<{{conta {{../description.original}} */ {{/if}} - - public {{../jsonPathPiece.pascalCase}}() { - super( - "{{../url}}", - {{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance().validate( + 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(JsonSchemaKeywordFlags.ofNone()) - ) + ); + } catch (ValidationException | InvalidTypeException e) { + throw new RuntimeException(e); + } + } + + public {{../jsonPathPiece.pascalCase}}() { + super( + "{{../url}}", + getVariables() ); } public {{../jsonPathPiece.pascalCase}}({{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}} variables) { @@ -37,7 +46,9 @@ public class {{../jsonPathPiece.pascalCase}} extends ServerWithVariables<{{conta } } {{else}} + {{#neq ../subpackage "servers"}} import {{{packageName}}}.servers.ServerWithoutVariables; + {{/neq}} public class {{jsonPathPiece.pascalCase}} extends ServerWithoutVariables { {{#if ../description}} From c351cc238d29d1cc335ee5d3b894fa6c2556598e Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 1 Apr 2024 16:53:03 -0700 Subject: [PATCH 22/53] Uses RuntimeExceptions when checking types of properties because the exceptions will never be thrown --- ...ccessWithJsonApiResponseHeadersSchema.java | 6 ++-- .../schemas/AbstractStepMessage.java | 2 +- .../schemas/AdditionalPropertiesClass.java | 14 +++++----- .../client/components/schemas/Animal.java | 4 +-- .../components/schemas/ApiResponseSchema.java | 6 ++-- .../client/components/schemas/Apple.java | 4 +-- .../client/components/schemas/AppleReq.java | 4 +-- .../schemas/ArrayOfArrayOfNumberOnly.java | 2 +- .../components/schemas/ArrayOfNumberOnly.java | 2 +- .../client/components/schemas/ArrayTest.java | 6 ++-- .../client/components/schemas/Banana.java | 2 +- .../client/components/schemas/BananaReq.java | 4 +-- .../client/components/schemas/BasquePig.java | 2 +- .../components/schemas/Capitalization.java | 12 ++++---- .../client/components/schemas/Cat.java | 2 +- .../client/components/schemas/Category.java | 4 +-- .../client/components/schemas/ChildCat.java | 2 +- .../client/components/schemas/Client.java | 2 +- .../schemas/ComplexQuadrilateral.java | 2 +- .../client/components/schemas/DanishPig.java | 2 +- .../client/components/schemas/Dog.java | 2 +- .../client/components/schemas/Drawing.java | 8 +++--- .../client/components/schemas/EnumArrays.java | 4 +-- .../client/components/schemas/EnumTest.java | 18 ++++++------ .../schemas/EquilateralTriangle.java | 2 +- .../client/components/schemas/File.java | 2 +- .../schemas/FileSchemaTestClass.java | 4 +-- .../client/components/schemas/Foo.java | 2 +- .../client/components/schemas/FormatTest.java | 28 +++++++++---------- .../client/components/schemas/FromSchema.java | 4 +-- .../client/components/schemas/Fruit.java | 2 +- .../client/components/schemas/GmFruit.java | 2 +- .../components/schemas/GrandparentAnimal.java | 2 +- .../components/schemas/HasOnlyReadOnly.java | 4 +-- .../components/schemas/HealthCheckResult.java | 2 +- .../components/schemas/IsoscelesTriangle.java | 2 +- .../JSONPatchRequestAddReplaceTest.java | 4 +-- .../schemas/JSONPatchRequestMoveCopy.java | 2 +- .../schemas/JSONPatchRequestRemove.java | 2 +- .../client/components/schemas/MapTest.java | 8 +++--- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../client/components/schemas/Money.java | 4 +-- .../client/components/schemas/Name.java | 6 ++-- .../components/schemas/NullableClass.java | 24 ++++++++-------- .../client/components/schemas/NumberOnly.java | 2 +- .../schemas/ObjWithRequiredProps.java | 2 +- .../schemas/ObjWithRequiredPropsBase.java | 2 +- .../ObjectModelWithArgAndArgsProperties.java | 4 +-- .../schemas/ObjectModelWithRefProps.java | 6 ++-- ...hAllOfWithReqTestPropFromUnsetAddProp.java | 2 +- .../ObjectWithCollidingProperties.java | 4 +-- .../schemas/ObjectWithDecimalProperties.java | 6 ++-- ...ObjectWithInvalidNamedRefedProperties.java | 2 +- .../ObjectWithNonIntersectingValues.java | 2 +- .../schemas/ObjectWithOnlyOptionalProps.java | 4 +-- .../schemas/ObjectWithOptionalTestProp.java | 2 +- .../client/components/schemas/Order.java | 12 ++++---- .../schemas/PaginatedResultMyObjectDto.java | 4 +-- .../client/components/schemas/Pet.java | 12 ++++---- .../client/components/schemas/Player.java | 4 +-- .../client/components/schemas/PublicKey.java | 2 +- .../schemas/QuadrilateralInterface.java | 4 +-- .../components/schemas/ReadOnlyFirst.java | 4 +-- .../components/schemas/ScaleneTriangle.java | 2 +- .../components/schemas/Schema200Response.java | 2 +- .../schemas/SelfReferencingObjectModel.java | 2 +- .../schemas/SimpleQuadrilateral.java | 2 +- .../components/schemas/SpecialModelname.java | 2 +- .../client/components/schemas/Tag.java | 4 +-- .../components/schemas/TriangleInterface.java | 4 +-- .../client/components/schemas/User.java | 20 ++++++------- .../client/components/schemas/Whale.java | 6 ++-- .../client/components/schemas/Zebra.java | 4 +-- .../paths/fake/delete/HeaderParameters.java | 4 +-- .../paths/fake/delete/QueryParameters.java | 8 +++--- .../paths/fake/get/HeaderParameters.java | 4 +-- .../paths/fake/get/QueryParameters.java | 8 +++--- .../ApplicationxwwwformurlencodedSchema.java | 4 +-- .../ApplicationxwwwformurlencodedSchema.java | 16 +++++------ .../put/QueryParameters.java | 6 ++-- .../post/QueryParameters.java | 4 +-- .../ApplicationxwwwformurlencodedSchema.java | 4 +-- .../ApplicationjsonSchema.java | 2 +- .../MultipartformdataSchema.java | 2 +- .../get/parameters/parameter0/Schema0.java | 2 +- .../post/CookieParameters.java | 6 ++-- .../post/HeaderParameters.java | 4 +-- .../post/PathParameters.java | 6 ++-- .../post/QueryParameters.java | 6 ++-- .../MultipartformdataSchema.java | 4 +-- .../put/QueryParameters.java | 12 ++++---- .../MultipartformdataSchema.java | 4 +-- .../MultipartformdataSchema.java | 2 +- .../ApplicationxwwwformurlencodedSchema.java | 4 +-- .../MultipartformdataSchema.java | 4 +-- .../paths/userlogin/get/QueryParameters.java | 4 +-- .../Code200ResponseHeadersSchema.java | 4 +-- .../client/servers/server0/Variables.java | 4 +-- .../schemas/_objectOutputGetProperty.hbs | 4 +-- 99 files changed, 242 insertions(+), 242 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java index bc2b97562e7..c64577d9eb9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java @@ -65,7 +65,7 @@ public static SuccessWithJsonApiResponseHeadersSchemaMap of(Map public String discriminator() { @Nullable Object value = get("discriminator"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for discriminator"); + throw new RuntimeException("Invalid value stored for discriminator"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java index 4c6b51e5cc7..48a4882d406 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java @@ -1032,7 +1032,7 @@ public MapPropertyMap map_property() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapPropertyMap)) { - throw new InvalidTypeException("Invalid value stored for map_property"); + throw new RuntimeException("Invalid value stored for map_property"); } return (MapPropertyMap) value; } @@ -1042,7 +1042,7 @@ public MapOfMapPropertyMap map_of_map_property() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapOfMapPropertyMap)) { - throw new InvalidTypeException("Invalid value stored for map_of_map_property"); + throw new RuntimeException("Invalid value stored for map_of_map_property"); } return (MapOfMapPropertyMap) value; } @@ -1056,7 +1056,7 @@ public FrozenMap map_with_undeclared_properties_anytype_1() throws UnsetPrope throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_anytype_1"); + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_1"); } return (FrozenMap) value; } @@ -1066,7 +1066,7 @@ public FrozenMap map_with_undeclared_properties_anytype_2() throws UnsetPrope throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_anytype_2"); + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_2"); } return (FrozenMap) value; } @@ -1076,7 +1076,7 @@ public MapWithUndeclaredPropertiesAnytype3Map map_with_undeclared_properties_any throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapWithUndeclaredPropertiesAnytype3Map)) { - throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_anytype_3"); + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_3"); } return (MapWithUndeclaredPropertiesAnytype3Map) value; } @@ -1086,7 +1086,7 @@ public EmptyMapMap empty_map() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof EmptyMapMap)) { - throw new InvalidTypeException("Invalid value stored for empty_map"); + throw new RuntimeException("Invalid value stored for empty_map"); } return (EmptyMapMap) value; } @@ -1096,7 +1096,7 @@ public MapWithUndeclaredPropertiesStringMap map_with_undeclared_properties_strin throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapWithUndeclaredPropertiesStringMap)) { - throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_string"); + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_string"); } return (MapWithUndeclaredPropertiesStringMap) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java index 8be00307078..f896958da11 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java @@ -135,7 +135,7 @@ public static AnimalMap of(Map arg, SchemaCo public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for className"); + throw new RuntimeException("Invalid value stored for className"); } return (String) value; } @@ -145,7 +145,7 @@ public String color() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for color"); + throw new RuntimeException("Invalid value stored for color"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java index 3f18d529be3..98ec34d9e0d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java @@ -82,7 +82,7 @@ public Number code() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for code"); + throw new RuntimeException("Invalid value stored for code"); } return (Number) value; } @@ -92,7 +92,7 @@ public String type() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for type"); + throw new RuntimeException("Invalid value stored for type"); } return (String) value; } @@ -102,7 +102,7 @@ public String message() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for message"); + throw new RuntimeException("Invalid value stored for message"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java index 5451924a185..aafebda922b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java @@ -193,7 +193,7 @@ public static AppleMap of(Map arg, SchemaCon public String cultivar() { @Nullable Object value = get("cultivar"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for cultivar"); + throw new RuntimeException("Invalid value stored for cultivar"); } return (String) value; } @@ -203,7 +203,7 @@ public String origin() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for origin"); + throw new RuntimeException("Invalid value stored for origin"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java index c2dcd371375..b6ea075aef9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java @@ -82,7 +82,7 @@ public static AppleReqMap of(Map arg, SchemaConfiguration config public String cultivar() { Object value = get("cultivar"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for cultivar"); + throw new RuntimeException("Invalid value stored for cultivar"); } return (String) value; } @@ -92,7 +92,7 @@ public boolean mealy() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for mealy"); + throw new RuntimeException("Invalid value stored for mealy"); } return (boolean) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java index 762d382590d..20111d0e0d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java @@ -318,7 +318,7 @@ public ArrayArrayNumberList ArrayArrayNumber() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayArrayNumberList)) { - throw new InvalidTypeException("Invalid value stored for ArrayArrayNumber"); + throw new RuntimeException("Invalid value stored for ArrayArrayNumber"); } return (ArrayArrayNumberList) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java index a70e4a17ed4..b2f095956fa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java @@ -196,7 +196,7 @@ public ArrayNumberList ArrayNumber() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayNumberList)) { - throw new InvalidTypeException("Invalid value stored for ArrayNumber"); + throw new RuntimeException("Invalid value stored for ArrayNumber"); } return (ArrayNumberList) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java index e7cabccb619..44c68441187 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java @@ -698,7 +698,7 @@ public ArrayOfStringList array_of_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayOfStringList)) { - throw new InvalidTypeException("Invalid value stored for array_of_string"); + throw new RuntimeException("Invalid value stored for array_of_string"); } return (ArrayOfStringList) value; } @@ -708,7 +708,7 @@ public ArrayArrayOfIntegerList array_array_of_integer() throws UnsetPropertyExce throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayArrayOfIntegerList)) { - throw new InvalidTypeException("Invalid value stored for array_array_of_integer"); + throw new RuntimeException("Invalid value stored for array_array_of_integer"); } return (ArrayArrayOfIntegerList) value; } @@ -718,7 +718,7 @@ public ArrayArrayOfModelList array_array_of_model() throws UnsetPropertyExceptio throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayArrayOfModelList)) { - throw new InvalidTypeException("Invalid value stored for array_array_of_model"); + throw new RuntimeException("Invalid value stored for array_array_of_model"); } return (ArrayArrayOfModelList) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java index 1737b8a9ff7..fba7acdce5b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java @@ -55,7 +55,7 @@ public static BananaMap of(Map arg, SchemaCo public Number lengthCm() { @Nullable Object value = get("lengthCm"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for lengthCm"); + throw new RuntimeException("Invalid value stored for lengthCm"); } return (Number) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java index 659b52e8645..8f864d58efa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java @@ -82,7 +82,7 @@ public static BananaReqMap of(Map arg, SchemaConfiguration confi public Number lengthCm() { Object value = get("lengthCm"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for lengthCm"); + throw new RuntimeException("Invalid value stored for lengthCm"); } return (Number) value; } @@ -92,7 +92,7 @@ public boolean sweet() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for sweet"); + throw new RuntimeException("Invalid value stored for sweet"); } return (boolean) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java index bcf56696004..5f9712c7bd3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java @@ -136,7 +136,7 @@ public static BasquePigMap of(Map arg, Schem public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for className"); + throw new RuntimeException("Invalid value stored for className"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java index 395c2dfbe01..3aa36cb5fc4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java @@ -117,7 +117,7 @@ public String smallCamel() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for smallCamel"); + throw new RuntimeException("Invalid value stored for smallCamel"); } return (String) value; } @@ -127,7 +127,7 @@ public String CapitalCamel() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for CapitalCamel"); + throw new RuntimeException("Invalid value stored for CapitalCamel"); } return (String) value; } @@ -137,7 +137,7 @@ public String small_Snake() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for small_Snake"); + throw new RuntimeException("Invalid value stored for small_Snake"); } return (String) value; } @@ -147,7 +147,7 @@ public String Capital_Snake() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for Capital_Snake"); + throw new RuntimeException("Invalid value stored for Capital_Snake"); } return (String) value; } @@ -157,7 +157,7 @@ public String SCA_ETH_Flow_Points() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for SCA_ETH_Flow_Points"); + throw new RuntimeException("Invalid value stored for SCA_ETH_Flow_Points"); } return (String) value; } @@ -167,7 +167,7 @@ public String ATT_NAME() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for ATT_NAME"); + throw new RuntimeException("Invalid value stored for ATT_NAME"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java index c8d73ddd815..075caf00f66 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java @@ -66,7 +66,7 @@ public boolean declawed() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for declawed"); + throw new RuntimeException("Invalid value stored for declawed"); } return (boolean) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java index 69587740b50..c4f7236198e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java @@ -135,7 +135,7 @@ public static CategoryMap of(Map arg, Schema public String name() { @Nullable Object value = get("name"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (String) value; } @@ -145,7 +145,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for id"); + throw new RuntimeException("Invalid value stored for id"); } return (Number) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java index b509a1e3c06..9e87287b9f1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java @@ -66,7 +66,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java index 17a225b997a..92cd2facd88 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java @@ -57,7 +57,7 @@ public String client() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for client"); + throw new RuntimeException("Invalid value stored for client"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java index 87165addfa8..38aef21aa62 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java @@ -146,7 +146,7 @@ public String quadrilateralType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for quadrilateralType"); + throw new RuntimeException("Invalid value stored for quadrilateralType"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java index b0c60eff94d..410caa5986c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java @@ -136,7 +136,7 @@ public static DanishPigMap of(Map arg, Schem public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for className"); + throw new RuntimeException("Invalid value stored for className"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java index 89c74536238..1ad3b89b132 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java @@ -66,7 +66,7 @@ public String breed() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for breed"); + throw new RuntimeException("Invalid value stored for breed"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java index 2fba007ab8a..e56499dc8db 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java @@ -212,7 +212,7 @@ public static DrawingMap of(Map arg, SchemaC throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for mainShape"); + throw new RuntimeException("Invalid value stored for mainShape"); } return (@Nullable Object) value; } @@ -222,7 +222,7 @@ public static DrawingMap of(Map arg, SchemaC throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for shapeOrNull"); + throw new RuntimeException("Invalid value stored for shapeOrNull"); } return (@Nullable Object) value; } @@ -232,7 +232,7 @@ public static DrawingMap of(Map arg, SchemaC throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for nullableShape"); + throw new RuntimeException("Invalid value stored for nullableShape"); } return (@Nullable Object) value; } @@ -242,7 +242,7 @@ public ShapesList shapes() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ShapesList)) { - throw new InvalidTypeException("Invalid value stored for shapes"); + throw new RuntimeException("Invalid value stored for shapes"); } return (ShapesList) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java index 3acfae4e910..1bfedfc3593 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java @@ -361,7 +361,7 @@ public String just_symbol() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for just_symbol"); + throw new RuntimeException("Invalid value stored for just_symbol"); } return (String) value; } @@ -371,7 +371,7 @@ public ArrayEnumList array_enum() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayEnumList)) { - throw new InvalidTypeException("Invalid value stored for array_enum"); + throw new RuntimeException("Invalid value stored for array_enum"); } return (ArrayEnumList) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java index 7aba6c9b3fd..670eff44ebc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java @@ -525,7 +525,7 @@ public static EnumTestMap of(Map arg, Schema public String enum_string_required() { @Nullable Object value = get("enum_string_required"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for enum_string_required"); + throw new RuntimeException("Invalid value stored for enum_string_required"); } return (String) value; } @@ -535,7 +535,7 @@ public String enum_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for enum_string"); + throw new RuntimeException("Invalid value stored for enum_string"); } return (String) value; } @@ -545,7 +545,7 @@ public Number enum_integer() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for enum_integer"); + throw new RuntimeException("Invalid value stored for enum_integer"); } return (Number) value; } @@ -555,7 +555,7 @@ public Number enum_number() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for enum_number"); + throw new RuntimeException("Invalid value stored for enum_number"); } return (Number) value; } @@ -565,7 +565,7 @@ public Number enum_number() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for stringEnum"); + throw new RuntimeException("Invalid value stored for stringEnum"); } return (@Nullable String) value; } @@ -575,7 +575,7 @@ public Number IntegerEnum() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for IntegerEnum"); + throw new RuntimeException("Invalid value stored for IntegerEnum"); } return (Number) value; } @@ -585,7 +585,7 @@ public String StringEnumWithDefaultValue() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for StringEnumWithDefaultValue"); + throw new RuntimeException("Invalid value stored for StringEnumWithDefaultValue"); } return (String) value; } @@ -595,7 +595,7 @@ public Number IntegerEnumWithDefaultValue() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for IntegerEnumWithDefaultValue"); + throw new RuntimeException("Invalid value stored for IntegerEnumWithDefaultValue"); } return (Number) value; } @@ -605,7 +605,7 @@ public Number IntegerEnumOneValue() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for IntegerEnumOneValue"); + throw new RuntimeException("Invalid value stored for IntegerEnumOneValue"); } return (Number) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java index 9d01d888e51..e438176362c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java @@ -146,7 +146,7 @@ public String triangleType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for triangleType"); + throw new RuntimeException("Invalid value stored for triangleType"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java index 7bf54efa7a7..6581f02a84b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java @@ -57,7 +57,7 @@ public String sourceURI() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for sourceURI"); + throw new RuntimeException("Invalid value stored for sourceURI"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java index cf190885eff..d9c7fef6e76 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java @@ -170,7 +170,7 @@ public File.FileMap file() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof File.FileMap)) { - throw new InvalidTypeException("Invalid value stored for file"); + throw new RuntimeException("Invalid value stored for file"); } return (File.FileMap) value; } @@ -180,7 +180,7 @@ public FilesList files() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FilesList)) { - throw new InvalidTypeException("Invalid value stored for files"); + throw new RuntimeException("Invalid value stored for files"); } return (FilesList) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java index 8e15e3b2cbf..1013e5cbc55 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java @@ -45,7 +45,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java index ba654b9258d..46a0f8ba403 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java @@ -1063,7 +1063,7 @@ public static FormatTestMap of(Map arg, Sche public String date() { @Nullable Object value = get("date"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for date"); + throw new RuntimeException("Invalid value stored for date"); } return (String) value; } @@ -1071,7 +1071,7 @@ public String date() { public String password() { @Nullable Object value = get("password"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for password"); + throw new RuntimeException("Invalid value stored for password"); } return (String) value; } @@ -1081,7 +1081,7 @@ public Number int32() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for int32"); + throw new RuntimeException("Invalid value stored for int32"); } return (Number) value; } @@ -1091,7 +1091,7 @@ public Number int32withValidations() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for int32withValidations"); + throw new RuntimeException("Invalid value stored for int32withValidations"); } return (Number) value; } @@ -1101,7 +1101,7 @@ public Number int64() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for int64"); + throw new RuntimeException("Invalid value stored for int64"); } return (Number) value; } @@ -1111,7 +1111,7 @@ public Number float32() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for float32"); + throw new RuntimeException("Invalid value stored for float32"); } return (Number) value; } @@ -1121,7 +1121,7 @@ public Number float64() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for float64"); + throw new RuntimeException("Invalid value stored for float64"); } return (Number) value; } @@ -1131,7 +1131,7 @@ public ArrayWithUniqueItemsList arrayWithUniqueItems() throws UnsetPropertyExcep throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayWithUniqueItemsList)) { - throw new InvalidTypeException("Invalid value stored for arrayWithUniqueItems"); + throw new RuntimeException("Invalid value stored for arrayWithUniqueItems"); } return (ArrayWithUniqueItemsList) value; } @@ -1141,7 +1141,7 @@ public String binary() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for binary"); + throw new RuntimeException("Invalid value stored for binary"); } return (String) value; } @@ -1151,7 +1151,7 @@ public String dateTime() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for dateTime"); + throw new RuntimeException("Invalid value stored for dateTime"); } return (String) value; } @@ -1161,7 +1161,7 @@ public String uuidNoExample() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for uuidNoExample"); + throw new RuntimeException("Invalid value stored for uuidNoExample"); } return (String) value; } @@ -1171,7 +1171,7 @@ public String pattern_with_digits() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for pattern_with_digits"); + throw new RuntimeException("Invalid value stored for pattern_with_digits"); } return (String) value; } @@ -1181,7 +1181,7 @@ public String pattern_with_digits_and_delimiter() throws UnsetPropertyException throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for pattern_with_digits_and_delimiter"); + throw new RuntimeException("Invalid value stored for pattern_with_digits_and_delimiter"); } return (String) value; } @@ -1191,7 +1191,7 @@ public Void noneProp() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Void)) { - throw new InvalidTypeException("Invalid value stored for noneProp"); + throw new RuntimeException("Invalid value stored for noneProp"); } return (Void) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java index 2f509b0ae7c..328c8efd202 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java @@ -70,7 +70,7 @@ public String data() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for data"); + throw new RuntimeException("Invalid value stored for data"); } return (String) value; } @@ -80,7 +80,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for id"); + throw new RuntimeException("Invalid value stored for id"); } return (Number) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java index bf6970b316f..3366288e7af 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java @@ -66,7 +66,7 @@ public String color() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for color"); + throw new RuntimeException("Invalid value stored for color"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java index 242a1109d03..233888ee187 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java @@ -66,7 +66,7 @@ public String color() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for color"); + throw new RuntimeException("Invalid value stored for color"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java index c9de3385bff..6291e129f53 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java @@ -55,7 +55,7 @@ public static GrandparentAnimalMap of(Map ar public String pet_type() { @Nullable Object value = get("pet_type"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for pet_type"); + throw new RuntimeException("Invalid value stored for pet_type"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java index b52cd608aea..2b28850201e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java @@ -69,7 +69,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -79,7 +79,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java index c66528dfc0b..707d44abf15 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java @@ -146,7 +146,7 @@ public static HealthCheckResultMap of(Map ar throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for NullableMessage"); + throw new RuntimeException("Invalid value stored for NullableMessage"); } return (@Nullable String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java index 89605406315..2166d96de66 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java @@ -146,7 +146,7 @@ public String triangleType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for triangleType"); + throw new RuntimeException("Invalid value stored for triangleType"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java index 8faa3939e14..fff86cceaae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java @@ -178,7 +178,7 @@ public static JSONPatchRequestAddReplaceTestMap of(Map arg, SchemaConfig public String op() { String value = get("op"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for op"); + throw new RuntimeException("Invalid value stored for op"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java index 46569893dae..eee3e9f5d3b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java @@ -752,7 +752,7 @@ public MapMapOfStringMap map_map_of_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapMapOfStringMap)) { - throw new InvalidTypeException("Invalid value stored for map_map_of_string"); + throw new RuntimeException("Invalid value stored for map_map_of_string"); } return (MapMapOfStringMap) value; } @@ -762,7 +762,7 @@ public MapOfEnumStringMap map_of_enum_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapOfEnumStringMap)) { - throw new InvalidTypeException("Invalid value stored for map_of_enum_string"); + throw new RuntimeException("Invalid value stored for map_of_enum_string"); } return (MapOfEnumStringMap) value; } @@ -772,7 +772,7 @@ public DirectMapMap direct_map() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof DirectMapMap)) { - throw new InvalidTypeException("Invalid value stored for direct_map"); + throw new RuntimeException("Invalid value stored for direct_map"); } return (DirectMapMap) value; } @@ -782,7 +782,7 @@ public StringBooleanMap.StringBooleanMapMap indirect_map() throws UnsetPropertyE throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof StringBooleanMap.StringBooleanMapMap)) { - throw new InvalidTypeException("Invalid value stored for indirect_map"); + throw new RuntimeException("Invalid value stored for indirect_map"); } return (StringBooleanMap.StringBooleanMapMap) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java index 7256e5dc912..e8e63fdf231 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java @@ -215,7 +215,7 @@ public String dateTime() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for dateTime"); + throw new RuntimeException("Invalid value stored for dateTime"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java index 5bf2549f63d..dec0cec54ee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java @@ -69,7 +69,7 @@ public static MoneyMap of(Map arg, SchemaCon public String amount() { @Nullable Object value = get("amount"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for amount"); + throw new RuntimeException("Invalid value stored for amount"); } return (String) value; } @@ -77,7 +77,7 @@ public String amount() { public String currency() { @Nullable Object value = get("currency"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for currency"); + throw new RuntimeException("Invalid value stored for currency"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java index 7b28900597e..58f5c4a31b2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java @@ -90,7 +90,7 @@ public static NameMap of(Map arg, SchemaConf public Number name() { @Nullable Object value = get("name"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (Number) value; } @@ -100,7 +100,7 @@ public Number snake_case() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for snake_case"); + throw new RuntimeException("Invalid value stored for snake_case"); } return (Number) value; } @@ -110,7 +110,7 @@ public String property() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for property"); + throw new RuntimeException("Invalid value stored for property"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java index 58c2f8fda6d..aeb70c411e1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java @@ -2276,7 +2276,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for integer_prop"); + throw new RuntimeException("Invalid value stored for integer_prop"); } return (@Nullable Number) value; } @@ -2286,7 +2286,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for number_prop"); + throw new RuntimeException("Invalid value stored for number_prop"); } return (@Nullable Number) value; } @@ -2296,7 +2296,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for boolean_prop"); + throw new RuntimeException("Invalid value stored for boolean_prop"); } return (@Nullable Boolean) value; } @@ -2306,7 +2306,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for string_prop"); + throw new RuntimeException("Invalid value stored for string_prop"); } return (@Nullable String) value; } @@ -2316,7 +2316,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for date_prop"); + throw new RuntimeException("Invalid value stored for date_prop"); } return (@Nullable String) value; } @@ -2326,7 +2326,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for datetime_prop"); + throw new RuntimeException("Invalid value stored for datetime_prop"); } return (@Nullable String) value; } @@ -2336,7 +2336,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ArrayNullablePropList)) { - throw new InvalidTypeException("Invalid value stored for array_nullable_prop"); + throw new RuntimeException("Invalid value stored for array_nullable_prop"); } return (@Nullable ArrayNullablePropList) value; } @@ -2346,7 +2346,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ArrayAndItemsNullablePropList)) { - throw new InvalidTypeException("Invalid value stored for array_and_items_nullable_prop"); + throw new RuntimeException("Invalid value stored for array_and_items_nullable_prop"); } return (@Nullable ArrayAndItemsNullablePropList) value; } @@ -2356,7 +2356,7 @@ public ArrayItemsNullableList array_items_nullable() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayItemsNullableList)) { - throw new InvalidTypeException("Invalid value stored for array_items_nullable"); + throw new RuntimeException("Invalid value stored for array_items_nullable"); } return (ArrayItemsNullableList) value; } @@ -2366,7 +2366,7 @@ public ArrayItemsNullableList array_items_nullable() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ObjectNullablePropMap)) { - throw new InvalidTypeException("Invalid value stored for object_nullable_prop"); + throw new RuntimeException("Invalid value stored for object_nullable_prop"); } return (@Nullable ObjectNullablePropMap) value; } @@ -2376,7 +2376,7 @@ public ArrayItemsNullableList array_items_nullable() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ObjectAndItemsNullablePropMap)) { - throw new InvalidTypeException("Invalid value stored for object_and_items_nullable_prop"); + throw new RuntimeException("Invalid value stored for object_and_items_nullable_prop"); } return (@Nullable ObjectAndItemsNullablePropMap) value; } @@ -2386,7 +2386,7 @@ public ObjectItemsNullableMap object_items_nullable() throws UnsetPropertyExcept throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ObjectItemsNullableMap)) { - throw new InvalidTypeException("Invalid value stored for object_items_nullable"); + throw new RuntimeException("Invalid value stored for object_items_nullable"); } return (ObjectItemsNullableMap) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java index 18d11edde13..852d158f3ea 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java @@ -57,7 +57,7 @@ public Number JustNumber() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for JustNumber"); + throw new RuntimeException("Invalid value stored for JustNumber"); } return (Number) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java index f272fe16458..6bedbb1c726 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java @@ -55,7 +55,7 @@ public static ObjWithRequiredPropsMap of(Map public String a() { @Nullable Object value = get("a"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for a"); + throw new RuntimeException("Invalid value stored for a"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java index 1d390319151..256429d4d32 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java @@ -55,7 +55,7 @@ public static ObjWithRequiredPropsBaseMap of(Map someProp() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for someProp"); + throw new RuntimeException("Invalid value stored for someProp"); } return (FrozenMap) value; } @@ -79,7 +79,7 @@ public FrozenMap someprop() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for someprop"); + throw new RuntimeException("Invalid value stored for someprop"); } return (FrozenMap) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java index d2038142236..b1f22f6a0b6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java @@ -59,7 +59,7 @@ public String length() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for length"); + throw new RuntimeException("Invalid value stored for length"); } return (String) value; } @@ -69,7 +69,7 @@ public String width() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for width"); + throw new RuntimeException("Invalid value stored for width"); } return (String) value; } @@ -79,7 +79,7 @@ public Money.MoneyMap cost() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Money.MoneyMap)) { - throw new InvalidTypeException("Invalid value stored for cost"); + throw new RuntimeException("Invalid value stored for cost"); } return (Money.MoneyMap) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java index 573ef372044..203881b3dca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java @@ -44,7 +44,7 @@ public static ObjectWithInvalidNamedRefedPropertiesMap of(Map arg, SchemaCo public Number count() { Object value = get("count"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for count"); + throw new RuntimeException("Invalid value stored for count"); } return (Number) value; } @@ -201,7 +201,7 @@ public Number count() { public ResultsList results() { Object value = get("results"); if (!(value instanceof ResultsList)) { - throw new InvalidTypeException("Invalid value stored for results"); + throw new RuntimeException("Invalid value stored for results"); } return (ResultsList) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java index 0fa02e8fd26..527fc2a5f37 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java @@ -427,7 +427,7 @@ public static PetMap of(Map arg, SchemaConfi public String name() { @Nullable Object value = get("name"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (String) value; } @@ -435,7 +435,7 @@ public String name() { public PhotoUrlsList photoUrls() { @Nullable Object value = get("photoUrls"); if (!(value instanceof PhotoUrlsList)) { - throw new InvalidTypeException("Invalid value stored for photoUrls"); + throw new RuntimeException("Invalid value stored for photoUrls"); } return (PhotoUrlsList) value; } @@ -445,7 +445,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for id"); + throw new RuntimeException("Invalid value stored for id"); } return (Number) value; } @@ -455,7 +455,7 @@ public Category.CategoryMap category() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Category.CategoryMap)) { - throw new InvalidTypeException("Invalid value stored for category"); + throw new RuntimeException("Invalid value stored for category"); } return (Category.CategoryMap) value; } @@ -465,7 +465,7 @@ public TagsList tags() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof TagsList)) { - throw new InvalidTypeException("Invalid value stored for tags"); + throw new RuntimeException("Invalid value stored for tags"); } return (TagsList) value; } @@ -475,7 +475,7 @@ public String status() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for status"); + throw new RuntimeException("Invalid value stored for status"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java index 67a28cefe23..97db74cae6b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java @@ -58,7 +58,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (String) value; } @@ -68,7 +68,7 @@ public PlayerMap enemyPlayer() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof PlayerMap)) { - throw new InvalidTypeException("Invalid value stored for enemyPlayer"); + throw new RuntimeException("Invalid value stored for enemyPlayer"); } return (PlayerMap) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java index c57b2630d5d..d041df32906 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java @@ -57,7 +57,7 @@ public String key() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for key"); + throw new RuntimeException("Invalid value stored for key"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java index e11bafed08c..835ecb35680 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java @@ -157,7 +157,7 @@ public static QuadrilateralInterfaceMap of(Map ar public String shapeType() { @Nullable Object value = get("shapeType"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for shapeType"); + throw new RuntimeException("Invalid value stored for shapeType"); } return (String) value; } @@ -165,7 +165,7 @@ public String shapeType() { public String triangleType() { @Nullable Object value = get("triangleType"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for triangleType"); + throw new RuntimeException("Invalid value stored for triangleType"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java index 00514139eaf..cafdf7f607a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java @@ -610,7 +610,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for id"); + throw new RuntimeException("Invalid value stored for id"); } return (Number) value; } @@ -620,7 +620,7 @@ public String username() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for username"); + throw new RuntimeException("Invalid value stored for username"); } return (String) value; } @@ -630,7 +630,7 @@ public String firstName() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for firstName"); + throw new RuntimeException("Invalid value stored for firstName"); } return (String) value; } @@ -640,7 +640,7 @@ public String lastName() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for lastName"); + throw new RuntimeException("Invalid value stored for lastName"); } return (String) value; } @@ -650,7 +650,7 @@ public String email() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for email"); + throw new RuntimeException("Invalid value stored for email"); } return (String) value; } @@ -660,7 +660,7 @@ public String password() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for password"); + throw new RuntimeException("Invalid value stored for password"); } return (String) value; } @@ -670,7 +670,7 @@ public String phone() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for phone"); + throw new RuntimeException("Invalid value stored for phone"); } return (String) value; } @@ -680,7 +680,7 @@ public Number userStatus() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for userStatus"); + throw new RuntimeException("Invalid value stored for userStatus"); } return (Number) value; } @@ -690,7 +690,7 @@ public FrozenMap objectWithNoDeclaredProps() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for objectWithNoDeclaredProps"); + throw new RuntimeException("Invalid value stored for objectWithNoDeclaredProps"); } return (FrozenMap) value; } @@ -700,7 +700,7 @@ public FrozenMap objectWithNoDeclaredProps() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for objectWithNoDeclaredPropsNullable"); + throw new RuntimeException("Invalid value stored for objectWithNoDeclaredPropsNullable"); } return (@Nullable FrozenMap) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java index 87ad2b937a7..644000077c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java @@ -162,7 +162,7 @@ public static WhaleMap of(Map arg, SchemaCon public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for className"); + throw new RuntimeException("Invalid value stored for className"); } return (String) value; } @@ -172,7 +172,7 @@ public boolean hasBaleen() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for hasBaleen"); + throw new RuntimeException("Invalid value stored for hasBaleen"); } return (boolean) value; } @@ -182,7 +182,7 @@ public boolean hasTeeth() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for hasTeeth"); + throw new RuntimeException("Invalid value stored for hasTeeth"); } return (boolean) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java index 656e49b28f7..29971debaf0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java @@ -243,7 +243,7 @@ public static ZebraMap of(Map arg, SchemaCon public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for className"); + throw new RuntimeException("Invalid value stored for className"); } return (String) value; } @@ -253,7 +253,7 @@ public String type() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for type"); + throw new RuntimeException("Invalid value stored for type"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java index 1bd15b0bda7..ee70bd6aec3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java @@ -60,7 +60,7 @@ public static HeaderParametersMap of(Map arg public String required_boolean_group() { @Nullable Object value = get("required_boolean_group"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for required_boolean_group"); + throw new RuntimeException("Invalid value stored for required_boolean_group"); } return (String) value; } @@ -70,7 +70,7 @@ public String boolean_group() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for boolean_group"); + throw new RuntimeException("Invalid value stored for boolean_group"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java index 01553434c05..0f27ade6250 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java @@ -64,7 +64,7 @@ public static QueryParametersMap of(Map arg, public Number required_int64_group() { @Nullable Object value = get("required_int64_group"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for required_int64_group"); + throw new RuntimeException("Invalid value stored for required_int64_group"); } return (Number) value; } @@ -72,7 +72,7 @@ public Number required_int64_group() { public String required_string_group() { @Nullable Object value = get("required_string_group"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for required_string_group"); + throw new RuntimeException("Invalid value stored for required_string_group"); } return (String) value; } @@ -82,7 +82,7 @@ public Number int64_group() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for int64_group"); + throw new RuntimeException("Invalid value stored for int64_group"); } return (Number) value; } @@ -92,7 +92,7 @@ public String string_group() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for string_group"); + throw new RuntimeException("Invalid value stored for string_group"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java index 003c08d8920..ef0cb9a208a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java @@ -61,7 +61,7 @@ public String enum_header_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for enum_header_string"); + throw new RuntimeException("Invalid value stored for enum_header_string"); } return (String) value; } @@ -71,7 +71,7 @@ public Schema0.SchemaList0 enum_header_string_array() throws UnsetPropertyExcept throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Schema0.SchemaList0)) { - throw new InvalidTypeException("Invalid value stored for enum_header_string_array"); + throw new RuntimeException("Invalid value stored for enum_header_string_array"); } return (Schema0.SchemaList0) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java index 50a02ffbe09..34c29309fb1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java @@ -65,7 +65,7 @@ public Number enum_query_double() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for enum_query_double"); + throw new RuntimeException("Invalid value stored for enum_query_double"); } return (Number) value; } @@ -75,7 +75,7 @@ public String enum_query_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for enum_query_string"); + throw new RuntimeException("Invalid value stored for enum_query_string"); } return (String) value; } @@ -85,7 +85,7 @@ public Number enum_query_integer() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for enum_query_integer"); + throw new RuntimeException("Invalid value stored for enum_query_integer"); } return (Number) value; } @@ -95,7 +95,7 @@ public Schema2.SchemaList2 enum_query_string_array() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Schema2.SchemaList2)) { - throw new InvalidTypeException("Invalid value stored for enum_query_string_array"); + throw new RuntimeException("Invalid value stored for enum_query_string_array"); } return (Schema2.SchemaList2) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 1ff3d67c384..7ea760bab88 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -378,7 +378,7 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList enum_form_string_arr throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ApplicationxwwwformurlencodedEnumFormStringArrayList)) { - throw new InvalidTypeException("Invalid value stored for enum_form_string_array"); + throw new RuntimeException("Invalid value stored for enum_form_string_array"); } return (ApplicationxwwwformurlencodedEnumFormStringArrayList) value; } @@ -388,7 +388,7 @@ public String enum_form_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for enum_form_string"); + throw new RuntimeException("Invalid value stored for enum_form_string"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index b61dbb661ba..f3b533299f1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -834,7 +834,7 @@ public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, public String SomeVar() { @Nullable Object value = get("SomeVar"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for SomeVar"); + throw new RuntimeException("Invalid value stored for SomeVar"); } return (String) value; } @@ -69,7 +69,7 @@ public String SomeVar() { public String someVar() { @Nullable Object value = get("someVar"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for someVar"); + throw new RuntimeException("Invalid value stored for someVar"); } return (String) value; } @@ -77,7 +77,7 @@ public String someVar() { public String some_var() { @Nullable Object value = get("some_var"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for some_var"); + throw new RuntimeException("Invalid value stored for some_var"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java index 51b9fd33709..ea9b8960d9d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java @@ -61,7 +61,7 @@ public static QueryParametersMap of(Map arg, throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for compositionAtRoot"); + throw new RuntimeException("Invalid value stored for compositionAtRoot"); } return (@Nullable Object) value; } @@ -71,7 +71,7 @@ public Schema1.SchemaMap1 compositionInProperty() throws UnsetPropertyException throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Schema1.SchemaMap1)) { - throw new InvalidTypeException("Invalid value stored for compositionInProperty"); + throw new RuntimeException("Invalid value stored for compositionInProperty"); } return (Schema1.SchemaMap1) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index a0e5518d942..fe741053964 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -67,7 +67,7 @@ public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, public String Ab() { @Nullable Object value = get("Ab"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for Ab"); + throw new RuntimeException("Invalid value stored for Ab"); } return (String) value; } @@ -73,7 +73,7 @@ public String Ab() { public String aB() { @Nullable Object value = get("aB"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for aB"); + throw new RuntimeException("Invalid value stored for aB"); } return (String) value; } @@ -81,7 +81,7 @@ public String aB() { public String self() { @Nullable Object value = get("self"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for self"); + throw new RuntimeException("Invalid value stored for self"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java index d728a8e82fb..77b7396eaa8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java @@ -67,7 +67,7 @@ public String aB() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for aB"); + throw new RuntimeException("Invalid value stored for aB"); } return (String) value; } @@ -77,7 +77,7 @@ public String Ab() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for Ab"); + throw new RuntimeException("Invalid value stored for Ab"); } return (String) value; } @@ -87,7 +87,7 @@ public String self() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for self"); + throw new RuntimeException("Invalid value stored for self"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 425a1e8036d..923f865e375 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -69,7 +69,7 @@ public static MultipartformdataSchemaMap of(Map arg, public Schema4.SchemaList4 context() { @Nullable Object value = get("context"); if (!(value instanceof Schema4.SchemaList4)) { - throw new InvalidTypeException("Invalid value stored for context"); + throw new RuntimeException("Invalid value stored for context"); } return (Schema4.SchemaList4) value; } @@ -75,7 +75,7 @@ public Schema4.SchemaList4 context() { public Schema2.SchemaList2 http() { @Nullable Object value = get("http"); if (!(value instanceof Schema2.SchemaList2)) { - throw new InvalidTypeException("Invalid value stored for http"); + throw new RuntimeException("Invalid value stored for http"); } return (Schema2.SchemaList2) value; } @@ -83,7 +83,7 @@ public Schema2.SchemaList2 http() { public Schema1.SchemaList1 ioutil() { @Nullable Object value = get("ioutil"); if (!(value instanceof Schema1.SchemaList1)) { - throw new InvalidTypeException("Invalid value stored for ioutil"); + throw new RuntimeException("Invalid value stored for ioutil"); } return (Schema1.SchemaList1) value; } @@ -91,7 +91,7 @@ public Schema1.SchemaList1 ioutil() { public Schema0.SchemaList0 pipe() { @Nullable Object value = get("pipe"); if (!(value instanceof Schema0.SchemaList0)) { - throw new InvalidTypeException("Invalid value stored for pipe"); + throw new RuntimeException("Invalid value stored for pipe"); } return (Schema0.SchemaList0) value; } @@ -99,7 +99,7 @@ public Schema0.SchemaList0 pipe() { public String refParam() { @Nullable Object value = get("refParam"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for refParam"); + throw new RuntimeException("Invalid value stored for refParam"); } return (String) value; } @@ -107,7 +107,7 @@ public String refParam() { public Schema3.SchemaList3 url() { @Nullable Object value = get("url"); if (!(value instanceof Schema3.SchemaList3)) { - throw new InvalidTypeException("Invalid value stored for url"); + throw new RuntimeException("Invalid value stored for url"); } return (Schema3.SchemaList3) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index da5de691612..00f58bea03b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -69,7 +69,7 @@ public static MultipartformdataSchemaMap of(Map arg, public String password() { @Nullable Object value = get("password"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for password"); + throw new RuntimeException("Invalid value stored for password"); } return (String) value; } @@ -67,7 +67,7 @@ public String password() { public String username() { @Nullable Object value = get("username"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for username"); + throw new RuntimeException("Invalid value stored for username"); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java index 1a37c189b6b..43728e2c52f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java @@ -66,7 +66,7 @@ public static Code200ResponseHeadersSchemaMap of(Map arg, SchemaConfiguration confi public String port() { String value = get("port"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for port"); + throw new RuntimeException("Invalid value stored for port"); } return (String) value; } @@ -268,7 +268,7 @@ public String port() { public String server() { String value = get("server"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for server"); + throw new RuntimeException("Invalid value stored for server"); } return (String) value; } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputGetProperty.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputGetProperty.hbs index 01f6c68d593..885134bfffa 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputGetProperty.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputGetProperty.hbs @@ -12,7 +12,7 @@ try { {{else}} {{#with ../../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type fullRefModule="" }}{{/with}} value = get("{{{@key.original}}}"); if (!({{#contains types "null" }}value == null || {{/contains}}value instanceof {{> src/main/java/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { - throw new InvalidTypeException("Invalid value stored for {{{@key.original}}}"); + throw new RuntimeException("Invalid value stored for {{{@key.original}}}"); } return ({{> src/main/java/packagename/components/schemas/types/schema_output_type fullRefModule="" }}) value; {{/and}} @@ -24,7 +24,7 @@ String key = "{{{@key.original}}}"; throwIfKeyNotPresent(key); {{#with ../../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type fullRefModule="" }}{{/with}} value = get(key); if (!({{#contains types "null" }}value == null || {{/contains}}value instanceof {{> src/main/java/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { - throw new InvalidTypeException("Invalid value stored for {{{@key.original}}}"); + throw new RuntimeException("Invalid value stored for {{{@key.original}}}"); } return ({{> src/main/java/packagename/components/schemas/types/schema_output_type fullRefModule="" }}) value; {{/and}} From c7cec9bed48784c4c9ac58e6172ddef97a6c7204 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Mon, 1 Apr 2024 17:01:31 -0700 Subject: [PATCH 23/53] Adds more needed excption signatures --- .../openapijsonschematools/client/parameter/Parameter.java | 3 ++- .../client/response/HeadersDeserializer.java | 4 +++- .../java/packagename/contenttype/ContentTypeDeserializer.hbs | 2 +- .../java/src/main/java/packagename/parameter/Parameter.hbs | 5 +++-- .../main/java/packagename/response/HeadersDeserializer.hbs | 4 +++- .../schemas/validation/UnevaluatedItemsValidator.hbs | 2 +- .../schemas/validation/UnevaluatedPropertiesValidator.hbs | 2 +- .../java/packagename/schemas/validation/ValidationData.hbs | 2 +- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java index adf3896d557..2d9c85b603d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java @@ -2,9 +2,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java index bbd744abebc..8c5375d9284 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java @@ -2,6 +2,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.header.Header; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; @@ -18,7 +20,7 @@ public HeadersDeserializer(Map headers, MapSchemaValidator headersToValidate = new HashMap<>(); for (Map.Entry> entry: responseHeaders.map().entrySet()) { String headerName = entry.getKey(); diff --git a/src/main/resources/java/src/main/java/packagename/contenttype/ContentTypeDeserializer.hbs b/src/main/resources/java/src/main/java/packagename/contenttype/ContentTypeDeserializer.hbs index f9ef315ea84..e5b81809466 100644 --- a/src/main/resources/java/src/main/java/packagename/contenttype/ContentTypeDeserializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/contenttype/ContentTypeDeserializer.hbs @@ -1,4 +1,4 @@ -package org.openapijsonschematools.client.contenttype; +package {{{packageName}}}.contenttype; import com.google.gson.Gson; import com.google.gson.GsonBuilder; diff --git a/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs b/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs index b612b6a159a..ec03fa82044 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs @@ -1,10 +1,11 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.OpenapiDocumentException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs b/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs index 94094d69974..56f3607a49a 100644 --- a/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs @@ -2,6 +2,8 @@ package {{{packageName}}}.response; import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.header.Header; import {{{packageName}}}.schemas.validation.MapSchemaValidator; @@ -18,7 +20,7 @@ public abstract class HeadersDeserializer { this.headersSchema = headersSchema; } - public OutType deserialize(HttpHeaders responseHeaders, SchemaConfiguration configuration) { + public OutType deserialize(HttpHeaders responseHeaders, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Map headersToValidate = new HashMap<>(); for (Map.Entry> entry: responseHeaders.map().entrySet()) { String headerName = entry.getKey(); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedItemsValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedItemsValidator.hbs index 7ff51ef0682..f22ca53b47e 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedItemsValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedItemsValidator.hbs @@ -1,7 +1,7 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs index 0dbf00afb1f..9539d7d73b0 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs @@ -1,7 +1,7 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ValidationData.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ValidationData.hbs index 1563757d83a..b269cda57ef 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ValidationData.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ValidationData.hbs @@ -1,4 +1,4 @@ -package org.openapijsonschematools.client.schemas.validation; +package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; From dc8d345be1efeb5b4f2034871e108b313806cb04 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 12:26:47 -0700 Subject: [PATCH 24/53] Adds many more exceptions to method signatures --- .../components/requestbodies/Client.java | 3 +- .../client/components/requestbodies/Pet.java | 3 +- .../components/requestbodies/UserArray.java | 3 +- .../ApplicationjsonSchema.java | 2 +- .../responses/HeadersWithNoBody.java | 5 +- .../responses/SuccessDescriptionOnly.java | 3 + .../SuccessInlineContentAndHeader.java | 7 +- .../responses/SuccessWithJsonApiResponse.java | 7 +- .../SuccessfulXmlAndJsonArrayOfPet.java | 5 +- .../ApplicationjsonSchema.java | 2 +- .../applicationxml/ApplicationxmlSchema.java | 2 +- .../AdditionalPropertiesWithArrayOfEnums.java | 4 +- .../client/components/schemas/AnimalFarm.java | 2 +- .../schemas/ArrayHoldingAnyType.java | 2 +- .../schemas/ArrayOfArrayOfNumberOnly.java | 4 +- .../components/schemas/ArrayOfEnums.java | 2 +- .../components/schemas/ArrayOfNumberOnly.java | 2 +- .../client/components/schemas/ArrayTest.java | 10 +-- .../schemas/ArrayWithValidationsInItems.java | 2 +- ...posedAnyOfDifferentTypesNoValidations.java | 2 +- .../components/schemas/ComposedArray.java | 2 +- .../schemas/ComposedOneOfDifferentTypes.java | 2 +- .../client/components/schemas/Drawing.java | 4 +- .../client/components/schemas/EnumArrays.java | 2 +- .../schemas/FileSchemaTestClass.java | 2 +- .../client/components/schemas/FormatTest.java | 2 +- .../client/components/schemas/Items.java | 2 +- .../components/schemas/JSONPatchRequest.java | 2 +- .../client/components/schemas/MapTest.java | 2 +- .../components/schemas/NullableClass.java | 8 +- .../ObjectWithNonIntersectingValues.java | 2 +- .../schemas/PaginatedResultMyObjectDto.java | 2 +- .../client/components/schemas/Pet.java | 4 +- .../schemas/SelfReferencingArrayModel.java | 2 +- .../schemas/SelfReferencingObjectModel.java | 2 +- .../components/schemas/StringBooleanMap.java | 2 +- .../configurations/ApiConfiguration.java | 74 +++++++++---------- .../client/header/ContentHeader.java | 11 +-- .../client/header/Header.java | 7 +- .../client/header/Rfc6570Serializer.java | 40 +++++----- .../client/header/SchemaHeader.java | 6 +- .../client/parameter/CookieSerializer.java | 4 +- .../client/parameter/HeadersSerializer.java | 4 +- .../client/parameter/PathSerializer.java | 4 +- .../client/parameter/QuerySerializer.java | 4 +- .../client/paths/anotherfakedummy/Patch.java | 11 ++- .../anotherfakedummy/patch/Responses.java | 6 +- .../patch/responses/Code200Response.java | 5 +- .../paths/commonparamsubdir/Delete.java | 11 ++- .../client/paths/commonparamsubdir/Get.java | 11 ++- .../client/paths/commonparamsubdir/Post.java | 11 ++- .../commonparamsubdir/delete/Responses.java | 6 +- .../commonparamsubdir/get/Responses.java | 6 +- .../commonparamsubdir/post/Responses.java | 6 +- .../client/paths/fake/Delete.java | 11 ++- .../client/paths/fake/Get.java | 11 ++- .../client/paths/fake/Patch.java | 11 ++- .../client/paths/fake/Post.java | 11 ++- .../client/paths/fake/delete/Responses.java | 6 +- .../client/paths/fake/get/RequestBody.java | 3 +- .../client/paths/fake/get/Responses.java | 6 +- .../get/parameters/parameter0/Schema0.java | 2 +- .../get/parameters/parameter2/Schema2.java | 2 +- .../ApplicationxwwwformurlencodedSchema.java | 2 +- .../fake/get/responses/Code404Response.java | 5 +- .../client/paths/fake/patch/Responses.java | 6 +- .../fake/patch/responses/Code200Response.java | 5 +- .../client/paths/fake/post/RequestBody.java | 3 +- .../client/paths/fake/post/Responses.java | 6 +- .../fake/post/responses/Code404Response.java | 3 + .../Get.java | 11 ++- .../get/RequestBody.java | 3 +- .../get/Responses.java | 6 +- .../get/responses/Code200Response.java | 5 +- .../paths/fakebodywithfileschema/Put.java | 11 ++- .../put/RequestBody.java | 3 +- .../fakebodywithfileschema/put/Responses.java | 6 +- .../paths/fakebodywithqueryparams/Put.java | 11 ++- .../put/RequestBody.java | 3 +- .../put/Responses.java | 6 +- .../paths/fakecasesensitiveparams/Put.java | 11 ++- .../put/Responses.java | 6 +- .../client/paths/fakeclassnametest/Patch.java | 11 ++- .../fakeclassnametest/patch/Responses.java | 6 +- .../patch/responses/Code200Response.java | 5 +- .../paths/fakedeletecoffeeid/Delete.java | 11 ++- .../fakedeletecoffeeid/delete/Responses.java | 6 +- .../delete/responses/CodedefaultResponse.java | 3 + .../client/paths/fakehealth/Get.java | 11 ++- .../paths/fakehealth/get/Responses.java | 6 +- .../get/responses/Code200Response.java | 5 +- .../fakeinlineadditionalproperties/Post.java | 11 ++- .../post/RequestBody.java | 3 +- .../post/Responses.java | 6 +- .../paths/fakeinlinecomposition/Post.java | 11 ++- .../post/RequestBody.java | 3 +- .../fakeinlinecomposition/post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../client/paths/fakejsonformdata/Get.java | 11 ++- .../fakejsonformdata/get/RequestBody.java | 3 +- .../paths/fakejsonformdata/get/Responses.java | 6 +- .../client/paths/fakejsonpatch/Patch.java | 11 ++- .../fakejsonpatch/patch/RequestBody.java | 3 +- .../paths/fakejsonpatch/patch/Responses.java | 6 +- .../paths/fakejsonwithcharset/Post.java | 11 ++- .../fakejsonwithcharset/post/RequestBody.java | 3 +- .../fakejsonwithcharset/post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../Post.java | 11 ++- .../post/RequestBody.java | 3 +- .../post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../paths/fakemultipleresponsebodies/Get.java | 11 ++- .../get/Responses.java | 6 +- .../get/responses/Code200Response.java | 5 +- .../get/responses/Code202Response.java | 5 +- .../paths/fakemultiplesecurities/Get.java | 11 ++- .../fakemultiplesecurities/get/Responses.java | 6 +- .../get/responses/Code200Response.java | 5 +- .../client/paths/fakeobjinquery/Get.java | 11 ++- .../paths/fakeobjinquery/get/Responses.java | 6 +- .../Post.java | 11 ++- .../post/RequestBody.java | 3 +- .../post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../client/paths/fakepemcontenttype/Get.java | 11 ++- .../fakepemcontenttype/get/RequestBody.java | 3 +- .../fakepemcontenttype/get/Responses.java | 6 +- .../get/responses/Code200Response.java | 5 +- .../Post.java | 11 ++- .../post/RequestBody.java | 3 +- .../post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../Get.java | 11 ++- .../get/Responses.java | 6 +- .../get/responses/Code200Response.java | 5 +- .../client/paths/fakeredirection/Get.java | 11 ++- .../paths/fakeredirection/get/Responses.java | 6 +- .../get/responses/Code303Response.java | 3 + .../get/responses/Code3XXResponse.java | 3 + .../client/paths/fakerefobjinquery/Get.java | 11 ++- .../fakerefobjinquery/get/Responses.java | 6 +- .../client/paths/fakerefsarraymodel/Post.java | 11 ++- .../fakerefsarraymodel/post/RequestBody.java | 3 +- .../fakerefsarraymodel/post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../paths/fakerefsarrayofenums/Post.java | 11 ++- .../post/RequestBody.java | 3 +- .../fakerefsarrayofenums/post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../client/paths/fakerefsboolean/Post.java | 11 ++- .../fakerefsboolean/post/RequestBody.java | 3 +- .../paths/fakerefsboolean/post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../Post.java | 11 ++- .../post/RequestBody.java | 3 +- .../post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../client/paths/fakerefsenum/Post.java | 11 ++- .../paths/fakerefsenum/post/RequestBody.java | 3 +- .../paths/fakerefsenum/post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../client/paths/fakerefsmammal/Post.java | 11 ++- .../fakerefsmammal/post/RequestBody.java | 3 +- .../paths/fakerefsmammal/post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../client/paths/fakerefsnumber/Post.java | 11 ++- .../fakerefsnumber/post/RequestBody.java | 3 +- .../paths/fakerefsnumber/post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../fakerefsobjectmodelwithrefprops/Post.java | 11 ++- .../post/RequestBody.java | 3 +- .../post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../client/paths/fakerefsstring/Post.java | 11 ++- .../fakerefsstring/post/RequestBody.java | 3 +- .../paths/fakerefsstring/post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../paths/fakeresponsewithoutschema/Get.java | 11 ++- .../get/Responses.java | 6 +- .../get/responses/Code200Response.java | 3 + .../paths/faketestqueryparamters/Put.java | 11 ++- .../faketestqueryparamters/put/Responses.java | 6 +- .../put/parameters/parameter0/Schema0.java | 2 +- .../put/parameters/parameter1/Schema1.java | 2 +- .../put/parameters/parameter2/Schema2.java | 2 +- .../put/parameters/parameter3/Schema3.java | 2 +- .../put/parameters/parameter4/Schema4.java | 2 +- .../paths/fakeuploaddownloadfile/Post.java | 11 ++- .../post/RequestBody.java | 3 +- .../post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../client/paths/fakeuploadfile/Post.java | 11 ++- .../fakeuploadfile/post/RequestBody.java | 3 +- .../paths/fakeuploadfile/post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../client/paths/fakeuploadfiles/Post.java | 11 ++- .../fakeuploadfiles/post/RequestBody.java | 3 +- .../paths/fakeuploadfiles/post/Responses.java | 6 +- .../MultipartformdataSchema.java | 2 +- .../post/responses/Code200Response.java | 5 +- .../paths/fakewildcardresponses/Get.java | 11 ++- .../fakewildcardresponses/get/Responses.java | 6 +- .../get/responses/Code1XXResponse.java | 5 +- .../get/responses/Code200Response.java | 5 +- .../get/responses/Code2XXResponse.java | 5 +- .../get/responses/Code3XXResponse.java | 5 +- .../get/responses/Code4XXResponse.java | 5 +- .../get/responses/Code5XXResponse.java | 5 +- .../client/paths/foo/Get.java | 11 ++- .../client/paths/foo/get/Responses.java | 6 +- .../get/responses/CodedefaultResponse.java | 5 +- .../client/paths/pet/Post.java | 11 ++- .../client/paths/pet/Put.java | 11 ++- .../client/paths/pet/post/Responses.java | 6 +- .../pet/post/responses/Code405Response.java | 3 + .../client/paths/pet/put/Responses.java | 6 +- .../pet/put/responses/Code400Response.java | 3 + .../pet/put/responses/Code404Response.java | 3 + .../pet/put/responses/Code405Response.java | 3 + .../client/paths/petfindbystatus/Get.java | 11 ++- .../paths/petfindbystatus/get/Responses.java | 6 +- .../get/parameters/parameter0/Schema0.java | 2 +- .../get/responses/Code400Response.java | 3 + .../client/paths/petfindbytags/Get.java | 11 ++- .../paths/petfindbytags/get/Responses.java | 6 +- .../get/parameters/parameter0/Schema0.java | 2 +- .../get/responses/Code400Response.java | 3 + .../client/paths/petpetid/Delete.java | 11 ++- .../client/paths/petpetid/Get.java | 11 ++- .../client/paths/petpetid/Post.java | 11 ++- .../paths/petpetid/delete/Responses.java | 6 +- .../delete/responses/Code400Response.java | 3 + .../client/paths/petpetid/get/Responses.java | 6 +- .../get/responses/Code200Response.java | 5 +- .../get/responses/Code400Response.java | 3 + .../get/responses/Code404Response.java | 3 + .../paths/petpetid/post/RequestBody.java | 3 +- .../client/paths/petpetid/post/Responses.java | 6 +- .../post/responses/Code405Response.java | 3 + .../paths/petpetiduploadimage/Post.java | 11 ++- .../petpetiduploadimage/post/RequestBody.java | 3 +- .../petpetiduploadimage/post/Responses.java | 6 +- .../client/paths/solidus/Get.java | 11 ++- .../client/paths/solidus/get/Responses.java | 6 +- .../client/paths/storeinventory/Get.java | 11 ++- .../paths/storeinventory/get/Responses.java | 6 +- .../client/paths/storeorder/Post.java | 11 ++- .../paths/storeorder/post/RequestBody.java | 3 +- .../paths/storeorder/post/Responses.java | 6 +- .../post/responses/Code200Response.java | 5 +- .../post/responses/Code400Response.java | 3 + .../paths/storeorderorderid/Delete.java | 11 ++- .../client/paths/storeorderorderid/Get.java | 11 ++- .../storeorderorderid/delete/Responses.java | 6 +- .../delete/responses/Code400Response.java | 3 + .../delete/responses/Code404Response.java | 3 + .../storeorderorderid/get/Responses.java | 6 +- .../get/responses/Code200Response.java | 5 +- .../get/responses/Code400Response.java | 3 + .../get/responses/Code404Response.java | 3 + .../client/paths/user/Post.java | 11 ++- .../client/paths/user/post/RequestBody.java | 3 +- .../client/paths/user/post/Responses.java | 6 +- .../post/responses/CodedefaultResponse.java | 3 + .../paths/usercreatewitharray/Post.java | 11 ++- .../usercreatewitharray/post/Responses.java | 6 +- .../post/responses/CodedefaultResponse.java | 3 + .../client/paths/usercreatewithlist/Post.java | 11 ++- .../usercreatewithlist/post/Responses.java | 6 +- .../post/responses/CodedefaultResponse.java | 3 + .../client/paths/userlogin/Get.java | 11 ++- .../client/paths/userlogin/get/Responses.java | 6 +- .../get/responses/Code200Response.java | 7 +- .../get/responses/Code400Response.java | 3 + .../client/paths/userlogout/Get.java | 11 ++- .../paths/userlogout/get/Responses.java | 6 +- .../client/paths/userusername/Delete.java | 11 ++- .../client/paths/userusername/Get.java | 11 ++- .../client/paths/userusername/Put.java | 11 ++- .../paths/userusername/delete/Responses.java | 6 +- .../delete/responses/Code404Response.java | 3 + .../paths/userusername/get/Responses.java | 6 +- .../get/responses/Code200Response.java | 5 +- .../get/responses/Code400Response.java | 3 + .../get/responses/Code404Response.java | 3 + .../paths/userusername/put/RequestBody.java | 3 +- .../paths/userusername/put/Responses.java | 6 +- .../put/responses/Code400Response.java | 3 + .../put/responses/Code404Response.java | 3 + .../requestbody/RequestBodySerializer.java | 2 +- .../client/response/HeadersDeserializer.java | 3 +- .../client/response/ResponseDeserializer.java | 13 +--- .../response/ResponsesDeserializer.java | 7 +- .../components/requestbodies/RequestBody.hbs | 3 +- .../components/responses/Response.hbs | 7 +- .../components/schemas/_arrayOutputType.hbs | 2 +- .../schemas/_objectOutputProperties.hbs | 4 +- .../configurations/ApiConfiguration.hbs | 14 ++-- .../java/packagename/header/ContentHeader.hbs | 11 +-- .../main/java/packagename/header/Header.hbs | 7 +- .../packagename/header/Rfc6570Serializer.hbs | 40 +++++----- .../java/packagename/header/SchemaHeader.hbs | 6 +- .../parameter/CookieSerializer.hbs | 4 +- .../parameter/HeadersSerializer.hbs | 4 +- .../packagename/parameter/PathSerializer.hbs | 4 +- .../packagename/parameter/QuerySerializer.hbs | 4 +- .../packagename/paths/path/verb/Operation.hbs | 11 ++- .../packagename/paths/path/verb/Responses.hbs | 6 +- .../requestbody/RequestBodySerializer.hbs | 2 +- .../response/HeadersDeserializer.hbs | 3 +- .../response/ResponseDeserializer.hbs | 13 +--- .../response/ResponsesDeserializer.hbs | 7 +- 313 files changed, 1449 insertions(+), 539 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java index 4c4ca5901c7..fdf11d477dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.components.requestbodies; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public Client1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java index 8a7f7c6e732..74110c3f0fc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.components.requestbodies; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -48,7 +49,7 @@ public Pet1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java index f94e5690f59..5b0a97f4d57 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.components.requestbodies; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public UserArray1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java index 848f62880ce..1d777ff12d5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java @@ -29,7 +29,7 @@ public static class ApplicationjsonSchemaList extends FrozenList { protected ApplicationjsonSchemaList(FrozenList m) { super(m); } - public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java index 668c6dae840..627877c03a1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.components.responses.headerswithnobody.HeadersWithNoBodyHeadersSchema; @@ -29,7 +32,7 @@ protected Void getBody(String contentType, byte[] body, SchemaConfiguration conf } @Override - protected HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + protected HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java index afda75639cd..10ef764abd8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java index 941550f2d00..243f228c124 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.content.applicationjson.ApplicationjsonSchema; @@ -40,7 +43,7 @@ public SuccessInlineContentAndHeader1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); @@ -53,7 +56,7 @@ protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConf } @Override - protected SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + protected SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java index bf767b15165..74a9998500a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.content.applicationjson.ApplicationjsonSchema; @@ -40,7 +43,7 @@ public SuccessWithJsonApiResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); @@ -53,7 +56,7 @@ protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConf } @Override - protected SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + protected SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java index 4a0a5d6cea6..6e0731f41da 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationxml.ApplicationxmlSchema; @@ -51,7 +54,7 @@ public SuccessfulXmlAndJsonArrayOfPet1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java index bf81e47d7d7..fda81b9ddc6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java @@ -30,7 +30,7 @@ public static class ApplicationjsonSchemaList extends FrozenList { protected ApplicationjsonSchemaList(FrozenList m) { super(m); } - public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java index 04014f3cd5d..311e0766658 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java @@ -29,7 +29,7 @@ public static class ApplicationxmlSchemaList extends FrozenList { protected ApplicationxmlSchemaList(FrozenList m) { super(m); } - public static ApplicationxmlSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationxmlSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationxmlSchema1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java index 5c67bda20df..ffc2624941d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java @@ -33,7 +33,7 @@ public static class AdditionalPropertiesList extends FrozenList { protected AdditionalPropertiesList(FrozenList m) { super(m); } - public static AdditionalPropertiesList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static AdditionalPropertiesList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AdditionalProperties.getInstance().validate(arg, configuration); } } @@ -169,7 +169,7 @@ public static AdditionalPropertiesWithArrayOfEnumsMap of(Map { protected AnimalFarmList(FrozenList m) { super(m); } - public static AnimalFarmList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static AnimalFarmList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AnimalFarm1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java index 736ead4f3f3..b2bdd251a67 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java @@ -39,7 +39,7 @@ public static class ArrayHoldingAnyTypeList extends FrozenList<@Nullable Object> protected ArrayHoldingAnyTypeList(FrozenList<@Nullable Object> m) { super(m); } - public static ArrayHoldingAnyTypeList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayHoldingAnyTypeList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayHoldingAnyType1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java index 20111d0e0d7..89b42c8a7c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java @@ -46,7 +46,7 @@ public static class ItemsList extends FrozenList { protected ItemsList(FrozenList m) { super(m); } - public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Items.getInstance().validate(arg, configuration); } } @@ -183,7 +183,7 @@ public static class ArrayArrayNumberList extends FrozenList { protected ArrayArrayNumberList(FrozenList m) { super(m); } - public static ArrayArrayNumberList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayArrayNumberList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayArrayNumber.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java index aa2603a5f5d..075fa21242e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java @@ -26,7 +26,7 @@ public static class ArrayOfEnumsList extends FrozenList<@Nullable String> { protected ArrayOfEnumsList(FrozenList<@Nullable String> m) { super(m); } - public static ArrayOfEnumsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayOfEnumsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayOfEnums1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java index b2f095956fa..edff10895ce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java @@ -46,7 +46,7 @@ public static class ArrayNumberList extends FrozenList { protected ArrayNumberList(FrozenList m) { super(m); } - public static ArrayNumberList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayNumberList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayNumber.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java index 44c68441187..693dab7063c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java @@ -47,7 +47,7 @@ public static class ArrayOfStringList extends FrozenList { protected ArrayOfStringList(FrozenList m) { super(m); } - public static ArrayOfStringList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayOfStringList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayOfString.getInstance().validate(arg, configuration); } } @@ -180,7 +180,7 @@ public static class ItemsList extends FrozenList { protected ItemsList(FrozenList m) { super(m); } - public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Items1.getInstance().validate(arg, configuration); } } @@ -317,7 +317,7 @@ public static class ArrayArrayOfIntegerList extends FrozenList { protected ArrayArrayOfIntegerList(FrozenList m) { super(m); } - public static ArrayArrayOfIntegerList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayArrayOfIntegerList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayArrayOfInteger.getInstance().validate(arg, configuration); } } @@ -439,7 +439,7 @@ public static class ItemsList1 extends FrozenList m) { super(m); } - public static ItemsList1 of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ItemsList1 of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Items3.getInstance().validate(arg, configuration); } } @@ -561,7 +561,7 @@ public static class ArrayArrayOfModelList extends FrozenList { protected ArrayArrayOfModelList(FrozenList m) { super(m); } - public static ArrayArrayOfModelList of(List>> arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayArrayOfModelList of(List>> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayArrayOfModel.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java index 85bafd5af53..6050e5769c4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java @@ -117,7 +117,7 @@ public static class ArrayWithValidationsInItemsList extends FrozenList { protected ArrayWithValidationsInItemsList(FrozenList m) { super(m); } - public static ArrayWithValidationsInItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayWithValidationsInItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayWithValidationsInItems1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java index f76f2694df8..7691df34de1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java @@ -163,7 +163,7 @@ public static class Schema9List extends FrozenList<@Nullable Object> { protected Schema9List(FrozenList<@Nullable Object> m) { super(m); } - public static Schema9List of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema9List of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema9.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java index b3091ab2c0d..b8014ee96c1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java @@ -39,7 +39,7 @@ public static class ComposedArrayList extends FrozenList<@Nullable Object> { protected ComposedArrayList(FrozenList<@Nullable Object> m) { super(m); } - public static ComposedArrayList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ComposedArrayList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ComposedArray1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java index 124549aa527..722bf7714e2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java @@ -168,7 +168,7 @@ public static class Schema5List extends FrozenList<@Nullable Object> { protected Schema5List(FrozenList<@Nullable Object> m) { super(m); } - public static Schema5List of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema5List of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema5.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java index e56499dc8db..021e4bc7f39 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java @@ -34,7 +34,7 @@ public static class ShapesList extends FrozenList<@Nullable Object> { protected ShapesList(FrozenList<@Nullable Object> m) { super(m); } - public static ShapesList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ShapesList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Shapes.getInstance().validate(arg, configuration); } } @@ -251,7 +251,7 @@ public ShapesList shapes() throws UnsetPropertyException { throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (@Nullable Object) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java index 1bfedfc3593..882a03cb729 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java @@ -220,7 +220,7 @@ public static class ArrayEnumList extends FrozenList { protected ArrayEnumList(FrozenList m) { super(m); } - public static ArrayEnumList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayEnumList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayEnum.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java index d9c7fef6e76..cb909af4f07 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java @@ -34,7 +34,7 @@ public static class FilesList extends FrozenList { protected FilesList(FrozenList m) { super(m); } - public static FilesList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static FilesList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Files.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java index 46a0f8ba403..bcd62d370c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java @@ -525,7 +525,7 @@ public static class ArrayWithUniqueItemsList extends FrozenList { protected ArrayWithUniqueItemsList(FrozenList m) { super(m); } - public static ArrayWithUniqueItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayWithUniqueItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayWithUniqueItems.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java index 66ee99d8efa..f2c7b521a2c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java @@ -40,7 +40,7 @@ public static class ItemsList extends FrozenList> { protected ItemsList(FrozenList> m) { super(m); } - public static ItemsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ItemsList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Items1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java index fee4c4225d8..7469d292e6c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java @@ -328,7 +328,7 @@ public static class JSONPatchRequestList extends FrozenList<@Nullable Object> { protected JSONPatchRequestList(FrozenList<@Nullable Object> m) { super(m); } - public static JSONPatchRequestList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static JSONPatchRequestList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return JSONPatchRequest1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java index eee3e9f5d3b..7cdf663dfd1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java @@ -598,7 +598,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new InvalidTypeException("Value may not be null"); + throw new RuntimeException("Value may not be null"); } return (boolean) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java index aeb70c411e1..7a773c9f6db 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java @@ -812,7 +812,7 @@ public static class ArrayNullablePropList extends FrozenList> { protected ArrayNullablePropList(FrozenList> m) { super(m); } - public static ArrayNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayNullableProp.getInstance().validate(arg, configuration); } } @@ -1087,7 +1087,7 @@ public static class ArrayAndItemsNullablePropList extends FrozenList<@Nullable F protected ArrayAndItemsNullablePropList(FrozenList<@Nullable FrozenMap> m) { super(m); } - public static ArrayAndItemsNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayAndItemsNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayAndItemsNullableProp.getInstance().validate(arg, configuration); } } @@ -1367,7 +1367,7 @@ public static class ArrayItemsNullableList extends FrozenList<@Nullable FrozenMa protected ArrayItemsNullableList(FrozenList<@Nullable FrozenMap> m) { super(m); } - public static ArrayItemsNullableList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayItemsNullableList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayItemsNullable.getInstance().validate(arg, configuration); } } @@ -2395,7 +2395,7 @@ public ObjectItemsNullableMap object_items_nullable() throws UnsetPropertyExcept throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value == null || value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (@Nullable FrozenMap) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java index fff516fbcdd..8d5653ec412 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java @@ -78,7 +78,7 @@ public String getAdditionalProperty(String name) throws UnsetPropertyException, throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (String) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java index 3dde0cca309..20f6c839f5f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java @@ -59,7 +59,7 @@ public static class ResultsList extends FrozenList { protected ResultsList(FrozenList m) { super(m); } - public static ResultsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ResultsList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Results.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java index 527fc2a5f37..b177ceca11c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java @@ -73,7 +73,7 @@ public static class PhotoUrlsList extends FrozenList { protected PhotoUrlsList(FrozenList m) { super(m); } - public static PhotoUrlsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static PhotoUrlsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PhotoUrls.getInstance().validate(arg, configuration); } } @@ -288,7 +288,7 @@ public static class TagsList extends FrozenList { protected TagsList(FrozenList m) { super(m); } - public static TagsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static TagsList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Tags.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java index ecadb3c0884..a435e54b997 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java @@ -27,7 +27,7 @@ public static class SelfReferencingArrayModelList extends FrozenList m) { super(m); } - public static SelfReferencingArrayModelList of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static SelfReferencingArrayModelList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return SelfReferencingArrayModel1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java index 9762f526a45..662e69677f5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java @@ -54,7 +54,7 @@ public SelfReferencingObjectModelMap getAdditionalProperty(String name) throws U throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof SelfReferencingObjectModelMap)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (SelfReferencingObjectModelMap) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java index 5959bf3ea83..5ef216f647b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java @@ -53,7 +53,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new InvalidTypeException("Value may not be null"); + throw new RuntimeException("Value may not be null"); } return (boolean) value; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index 86aab8c71d6..3413af1911e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -103,36 +103,36 @@ public ServerIndexInfo petfindbystatusServerInfoServerIndex(PetfindbystatusServe } } - public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) throws UnsetPropertyException { + public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { var serverProvider = serverInfo.rootServerInfo; if (serverIndex == null) { RootServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.rootServerInfoServerIndex; if (configServerIndex == null) { - throw new UnsetPropertyException("rootServerInfoServerIndex is unset"); + throw new RuntimeException("rootServerInfoServerIndex is unset"); } return serverProvider.getServer(configServerIndex); } return serverProvider.getServer(serverIndex); } - public Server getServer(FooGetServerInfo. @Nullable ServerIndex serverIndex) throws UnsetPropertyException { + public Server getServer(FooGetServerInfo. @Nullable ServerIndex serverIndex) { var serverProvider = serverInfo.fooGetServerInfo; if (serverIndex == null) { FooGetServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.fooGetServerInfoServerIndex; if (configServerIndex == null) { - throw new UnsetPropertyException("fooGetServerInfoServerIndex is unset"); + throw new RuntimeException("fooGetServerInfoServerIndex is unset"); } return serverProvider.getServer(configServerIndex); } return serverProvider.getServer(serverIndex); } - public Server getServer(PetfindbystatusServerInfo. @Nullable ServerIndex serverIndex) throws UnsetPropertyException { + public Server getServer(PetfindbystatusServerInfo. @Nullable ServerIndex serverIndex) { var serverProvider = serverInfo.petfindbystatusServerInfo; if (serverIndex == null) { PetfindbystatusServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.petfindbystatusServerInfoServerIndex; if (configServerIndex == null) { - throw new UnsetPropertyException("petfindbystatusServerInfoServerIndex is unset"); + throw new RuntimeException("petfindbystatusServerInfoServerIndex is unset"); } return serverProvider.getServer(configServerIndex); } @@ -262,165 +262,165 @@ public SecurityIndexInfo storeinventoryGetSecurityInfoSecurityIndex(Storeinvento } } - public SecurityRequirementObject getSecurityRequirementObject(FakeDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(FakeDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.fakeDeleteSecurityInfo; if (securityIndex == null) { FakeDeleteSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakeDeleteSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("fakeDeleteSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("fakeDeleteSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakePostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(FakePostSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.fakePostSecurityInfo; if (securityIndex == null) { FakePostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakePostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("fakePostSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("fakePostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.fakemultiplesecuritiesGetSecurityInfo; if (securityIndex == null) { FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakemultiplesecuritiesGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("fakemultiplesecuritiesGetSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("fakemultiplesecuritiesGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.fakepetiduploadimagewithrequiredfilePostSecurityInfo; if (securityIndex == null) { FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.fakeclassnametestPatchSecurityInfo; if (securityIndex == null) { FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakeclassnametestPatchSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("fakeclassnametestPatchSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("fakeclassnametestPatchSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetPostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetPostSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petPostSecurityInfo; if (securityIndex == null) { PetPostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petPostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petPostSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petPostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetPutSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetPutSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petPutSecurityInfo; if (securityIndex == null) { PetPutSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petPutSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petPutSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petPutSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petfindbystatusGetSecurityInfo; if (securityIndex == null) { PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petfindbystatusGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petfindbystatusGetSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petfindbystatusGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petfindbytagsGetSecurityInfo; if (securityIndex == null) { PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petfindbytagsGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petfindbytagsGetSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petfindbytagsGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetpetidDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petpetidDeleteSecurityInfo; if (securityIndex == null) { PetpetidDeleteSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetidDeleteSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petpetidDeleteSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petpetidDeleteSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetpetidGetSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petpetidGetSecurityInfo; if (securityIndex == null) { PetpetidGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetidGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petpetidGetSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petpetidGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidPostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetpetidPostSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petpetidPostSecurityInfo; if (securityIndex == null) { PetpetidPostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetidPostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petpetidPostSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petpetidPostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petpetiduploadimagePostSecurityInfo; if (securityIndex == null) { PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetiduploadimagePostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petpetiduploadimagePostSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petpetiduploadimagePostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(StoreinventoryGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(StoreinventoryGetSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.storeinventoryGetSecurityInfo; if (securityIndex == null) { StoreinventoryGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.storeinventoryGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("storeinventoryGetSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("storeinventoryGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityScheme getSecurityScheme(Class securitySchemeClass) throws UnsetPropertyException { + public SecurityScheme getSecurityScheme(Class securitySchemeClass) { @Nullable SecurityScheme securityScheme = securitySchemeInfo.get(securitySchemeClass); if (securityScheme == null) { - throw new UnsetPropertyException("SecurityScheme of class " + securitySchemeClass + "cannot be returned because it is unset. Pass in an instance of it in securitySchemes when instantiating ApiConfiguration."); + 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; } @@ -429,7 +429,7 @@ public Map> getDefaultHeaders() { return new HashMap<>(); } - public@Nullable Duration getTimeout() { + public @Nullable Duration getTimeout() { return timeout; } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java index 48fb3731235..13c8f50bcc9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -6,7 +6,8 @@ import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.parameter.ParameterStyle; @@ -30,7 +31,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, OpenapiDocumentException { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { for (Map.Entry> entry: content.entrySet()) { var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; String contentType = entry.getKey(); @@ -41,11 +42,11 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); } } - throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, OpenapiDocumentException { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { String inDataJoined = String.join(",", inData); // unsure if this is needed @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); if (validate) { @@ -57,7 +58,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); } } - throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } return deserializedJson; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java index ac9f6274b0d..89728acfb77 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java @@ -2,11 +2,14 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import java.net.http.HttpHeaders; import java.util.List; public interface Header { - HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration); - @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration); + HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException; + @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java index 82974738b1f..79220e47cbf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java @@ -1,22 +1,17 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.AbstractMap; -import java.util.LinkedHashMap; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; -import static java.util.stream.Collectors.toList; -import static java.util.stream.Collectors.toMap; - public class Rfc6570Serializer { private static final String ENCODING = "UTF-8"; private static final Set namedParameterSeparators = Set.of("&", ";"); @@ -32,7 +27,7 @@ private static String percentEncode(String s) throws NotImplementedException { .replace("%7E", "~"); // This could be done faster with more hand-crafted code. } catch (UnsupportedEncodingException wow) { - throw new NotImplementedException(wow.getMessage(), wow); + throw new NotImplementedException(wow.getMessage()); } } @@ -89,10 +84,14 @@ private static String rfc6570ListExpansion( String varNamePiece, boolean namedParameterExpansion ) throws NotImplementedException { - var itemValues = inData.stream() - .map(v -> rfc6570ItemValue(v, percentEncode)) - .filter(Objects::nonNull) - .collect(toList()); + 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 ""; @@ -118,11 +117,18 @@ private static String rfc6570MapExpansion( String varNamePiece, boolean namedParameterExpansion ) throws NotImplementedException { - var inDataMap = inData.entrySet().stream() - .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), rfc6570ItemValue(entry.getValue(), percentEncode))) - .filter(entry -> entry.getValue() != null) - .collect(toMap(Map.Entry::getKey, Map.Entry::getValue, (x, y) -> y, LinkedHashMap::new)); - + Map inDataMap = new HashMap<>(); + 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 ""; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java index 914a50d7d1f..4215029bf3b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.parameter.ParameterStyle; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; @@ -31,7 +33,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { var castInData = validate ? schema.validate(inData, configuration) : inData; boolean usedExplode = explode != null && explode; var value = StyleSerializer.serializeSimple(castInData, name, usedExplode, false); @@ -86,7 +88,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { @Nullable Object castInData = getCastInData(schema, inData); if (validate) { return schema.validate(castInData, configuration); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java index b04b2ca1754..4b8ff010aed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java @@ -1,6 +1,8 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -13,7 +15,7 @@ protected CookieSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData) { + public String serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { String result = ""; Map sortedData = new TreeMap<>(inData); for (Map.Entry entry: sortedData.entrySet()) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java index b4a23229944..b9d6fb008bb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java @@ -1,6 +1,8 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.LinkedHashMap; @@ -14,7 +16,7 @@ protected HeadersSerializer(Map parameters) { this.parameters = parameters; } - public Map> serialize(Map inData) { + public Map> serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { Map> results = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java index 5864f89c901..4e1858f88f8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java @@ -1,6 +1,8 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -12,7 +14,7 @@ protected PathSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData, String pathWithPlaceholders) { + public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException, OpenapiDocumentException { String result = pathWithPlaceholders; for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java index 91ea0b041bb..c5f39d81aff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java @@ -1,6 +1,8 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.HashMap; @@ -14,7 +16,7 @@ protected QuerySerializer(Map parameters) { this.parameters = parameters; } - public Map getQueryMap(Map inData) { + public Map getQueryMap(Map inData) throws NotImplementedException, OpenapiDocumentException { Map results = new HashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java index 185309045a1..fa595ce5f0c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.RequestBody; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Anotherfakedummy; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +64,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java index e7c62840101..11b1cd3ef4b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java index 056f15d6bf6..87b69013da2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java index ca28ef6c947..b04b10cab42 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java @@ -6,10 +6,15 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.delete.PathParameters; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.Parameters; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; import java.io.IOException; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -62,7 +67,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java index 596022972c9..f3d0c2e297b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java @@ -6,10 +6,15 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.get.PathParameters; import org.openapijsonschematools.client.paths.commonparamsubdir.get.Parameters; import org.openapijsonschematools.client.paths.commonparamsubdir.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; import java.io.IOException; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -63,7 +68,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java index 8abf71cc65e..8cb71a257b2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java @@ -6,10 +6,15 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.post.PathParameters; import org.openapijsonschematools.client.paths.commonparamsubdir.post.Parameters; import org.openapijsonschematools.client.paths.commonparamsubdir.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; import java.io.IOException; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -62,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java index ac61599b023..bd962c80e48 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java index 2e9856cd26e..309976d0f1a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java index 3ac09dfbbb6..9488c04f64e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java index 06270fdd0cc..a0c7d279720 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java @@ -7,10 +7,15 @@ import org.openapijsonschematools.client.paths.fake.delete.QueryParameters; import org.openapijsonschematools.client.paths.fake.delete.Parameters; import org.openapijsonschematools.client.paths.fake.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fake; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -31,7 +36,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -74,7 +79,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java index f31068710a5..88eb21c43ee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java @@ -7,10 +7,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.get.Parameters; import org.openapijsonschematools.client.paths.fake.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fake; @@ -31,7 +36,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -79,7 +84,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java index 0bc3c524f25..1ee826cef96 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.patch.RequestBody; import org.openapijsonschematools.client.paths.fake.patch.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fake; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +64,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java index 5a370e1d851..ca74851bc52 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; import org.openapijsonschematools.client.paths.fake.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fake; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -31,7 +36,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -76,7 +81,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java index 5e220e5decd..161f8f97b0c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fake.delete.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java index c14807b0629..3f8f13a779a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fake.get; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java index 4216c774363..c3c8d1c2911 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.fake.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fake.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +42,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java index b233b4ebb39..7a815af8548 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java @@ -129,7 +129,7 @@ public static class SchemaList0 extends FrozenList { protected SchemaList0(FrozenList m) { super(m); } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema01.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java index 7c79f5d34f2..db6a76de965 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java @@ -129,7 +129,7 @@ public static class SchemaList2 extends FrozenList { protected SchemaList2(FrozenList m) { super(m); } - public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema21.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 7ea760bab88..dc6ec8a6768 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -137,7 +137,7 @@ public static class ApplicationxwwwformurlencodedEnumFormStringArrayList extends protected ApplicationxwwwformurlencodedEnumFormStringArrayList(FrozenList m) { super(m); } - public static ApplicationxwwwformurlencodedEnumFormStringArrayList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ApplicationxwwwformurlencodedEnumFormStringArrayList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ApplicationxwwwformurlencodedEnumFormStringArray.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java index 3529cf03198..cf1c4c0a8ad 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fake.get.responses.code404response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code404Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java index 903ab9cd2b1..7d9e028de8e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fake.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java index 8039dbe0b25..fba72bfa412 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fake.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java index 818941bb213..f1df9eb31ed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fake.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java index 0347ac523e0..93082530aeb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.fake.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fake.post.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +42,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java index d8110d89ad9..1704da10f83 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java index 51b9bccff48..958f0d225a0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeadditionalpropertieswitharrayofenums; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java index c1f5f3adacd..b58e901cf8c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java index fd1ec82a26a..94ce1d4e48c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java index c8224c9af44..27ffd230815 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java index 24fc177d34a..3397d455538 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.RequestBody; import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakebodywithfileschema; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +64,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java index 3ce0af9cb18..a46287e74b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakebodywithfileschema.put; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java index cc35746e142..8585100f835 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java index 6a6f5e33381..26e67157ca5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java @@ -6,10 +6,15 @@ import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.QueryParameters; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.Parameters; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakebodywithqueryparams; @@ -30,7 +35,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -65,7 +70,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java index ec82360b6dd..8d9663e8ef7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java index cd75c88f985..acebb6831c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java index 5629b6ac700..350f248f67e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.QueryParameters; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.Parameters; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakecasesensitiveparams; import java.io.IOException; @@ -27,7 +32,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -56,7 +61,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java index a82cea7d6d7..3fa734ac3af 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java index f718be09069..eca529b843e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.RequestBody; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeclassnametest; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -31,7 +36,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -72,7 +77,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java index 20b70774ed5..5a774e0ae86 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java index a1e2e365273..046f8316375 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java index d63e6878058..49df8ea08a6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.PathParameters; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.Parameters; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakedeletecoffeeid; import java.io.IOException; @@ -27,7 +32,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -55,7 +60,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java index 4707c2d13b3..6df2c1517f0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.Code200Response; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -44,7 +48,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java index fdef16fe8ad..c6d646b785b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java index ae08b521620..f70415e9a57 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java @@ -3,10 +3,15 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakehealth.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakehealth; import java.io.IOException; @@ -25,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +55,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java index 06d52e39237..13910952871 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakehealth.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java index 9a10c168c6c..0cb22d4aebe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakehealth.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java index 7e6343f7f04..33049224e3a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.RequestBody; import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeinlineadditionalproperties; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +64,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java index 628b1efee55..85529afa41c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java index 37c62eb8e53..ceac702edf7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java index 58b236864ec..1585a0bca86 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java @@ -6,10 +6,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.Parameters; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeinlinecomposition; @@ -30,7 +35,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -72,7 +77,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java index 062e79c82e3..0264be90b7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeinlinecomposition.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -48,7 +49,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java index eca3f947dfa..ccfeec4aa9f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java index e2f7034a0c6..655c528658e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -51,7 +54,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java index 9f77930f8c5..b912128ecc4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakejsonformdata.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakejsonformdata.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakejsonformdata; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java index d7fbbcbadcb..50a121737b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakejsonformdata.get; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java index c33a942e753..ed2d2b2799f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java index 3fab6a5ef14..5216b18abc9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakejsonpatch.patch.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakejsonpatch.patch.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakejsonpatch; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java index 468041f351a..f9b1f076f6b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakejsonpatch.patch; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonpatchjsonRequestBody requestBody0 = (ApplicationjsonpatchjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java index d2adc74ceed..50083b56307 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java index 15f87d7ccda..138c018480d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakejsonwithcharset; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java index 5ae2a3289b0..6843dc22e74 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakejsonwithcharset.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { Applicationjsoncharsetutf8RequestBody requestBody0 = (Applicationjsoncharsetutf8RequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java index 2c6b3699664..dabd059a41e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java index dad71472f80..c59e409cd48 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.code200response.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java index ffa442b65ff..14bab549e5c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakemultiplerequestbodycontenttypes; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java index bfc18b8c3f8..0566e226c14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -48,7 +49,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java index a9d9f512c9a..db0083a37eb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java index 89548108ae7..aa08f387330 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java index 803c41e74f4..83dc48706f6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java @@ -3,10 +3,15 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakemultipleresponsebodies; import java.io.IOException; @@ -25,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +55,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java index 1a783d3ac7b..96b3fd0521b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.Code202Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -45,7 +49,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java index d10acdde19e..b94bf11bf4b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java index c3c41f9310d..f027383e13d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code202response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code202Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java index b8228e447f7..2024bfa4761 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakemultiplesecurities; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -63,7 +68,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java index ce504a325bf..2babf85d987 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java index f67ff2f3bf2..75fd6e4cfce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java index 45ba37fafc8..f4adefc073a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeobjinquery.get.Parameters; import org.openapijsonschematools.client.paths.fakeobjinquery.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakeobjinquery; import java.io.IOException; @@ -27,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +64,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java index e17ef11e287..1c2e2b77971 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java index 81a3f7cf9c1..fa872dffd7f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java @@ -9,10 +9,15 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.PathParameters; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Parameters; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeparametercollisions1ababselfab; @@ -33,7 +38,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -91,7 +96,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java index 61c0cb2c691..a51c3ec8a0d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java index 6f9f5877987..8abb1aec4f2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java index 9a6323102b8..4554077d2d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java index cdf5aef2647..d45cf3996e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakepemcontenttype.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakepemcontenttype.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakepemcontenttype; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java index ff68a6c95d5..1f480bb4f6c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakepemcontenttype.get; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationxpemfileRequestBody requestBody0 = (ApplicationxpemfileRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java index 617d012d016..1f59baa33e7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java index 1e6f3cf2906..b6132066731 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.code200response.content.applicationxpemfile.ApplicationxpemfileSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java index 9b74bbfdf80..6b7e2f16837 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java @@ -7,10 +7,15 @@ import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.PathParameters; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.Parameters; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakepetiduploadimagewithrequiredfile; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -33,7 +38,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -81,7 +86,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java index 3fc03d40157..0788c7362cb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java index 10353a08dc3..c468353ae78 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java index f74b1521612..cd637f27504 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java index 265b436de28..56de93ce963 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.QueryParameters; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.Parameters; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakequeryparamwithjsoncontenttype; import java.io.IOException; @@ -27,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -56,7 +61,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java index dc6b9ebe721..5e4e840eafd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java index 0de083d95f0..437d457c9fb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java index 63643897a3f..8b92c70f23e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java @@ -3,10 +3,15 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeredirection.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakeredirection; import java.io.IOException; @@ -25,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +55,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java index 1678ade8102..7c9e7ed78ce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.fakeredirection.get.responses.Code303Response; import org.openapijsonschematools.client.paths.fakeredirection.get.responses.Code3XXResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -50,7 +54,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java index 3d812da9d2c..aab99099649 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java index 6bed92fa9f4..24bfa9b52e0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java index 34eafefc4d0..cf165202d3d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefobjinquery.get.Parameters; import org.openapijsonschematools.client.paths.fakerefobjinquery.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakerefobjinquery; import java.io.IOException; @@ -27,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +64,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java index 1a8dca8dcdd..1019f08f017 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java index 5d30e214a16..8a6de0be95a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsarraymodel; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java index 331c85336ed..cd7db4c428b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsarraymodel.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java index da739f84545..659650a21cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java index dcb539f70de..6f5a77c39f9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java index a9b53d07eb6..c2fde1446c0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsarrayofenums; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java index 614bd30d021..b9c573e092d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsarrayofenums.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java index 3c02dbbae03..b6d3bfa2680 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java index 8859efafeb4..9005bb2ff7d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java index 0176df73b8d..b42758aaabc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakerefsboolean.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsboolean.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsboolean; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java index 892772867fc..7d6c5aea5e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsboolean.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java index ef2da8a829a..fc4fe65bc8a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java index 093976f6854..465c04ce56b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java index a5b8064bca9..5eda1bae7e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefscomposedoneofnumberwithvalidations; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java index 705f750a6d0..9c7d24a6e84 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java index bffd6a98a2a..0cc76733324 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java index 88aab07efef..b240fa7b152 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java index 59028a026b9..31982e5c338 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakerefsenum.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsenum.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsenum; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java index f149f2bc22f..4166ca11c2b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsenum.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java index c2b067d4643..a1c29d1d38c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java index 15854803e7e..4c5a01f045d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java index 7b153f79789..4f00c55e695 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsmammal.post.RequestBody; import org.openapijsonschematools.client.paths.fakerefsmammal.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsmammal; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +64,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java index c5b28579c34..7fba66cb6d8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsmammal.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java index de909f096bc..23048783a6a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java index 337194bcca7..2198324418d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java index aa78925f60b..cf1b8564b3d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakerefsnumber.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsnumber.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsnumber; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java index dd306ec59bd..8494dd01aaa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsnumber.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java index 622310c701c..03d11419797 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java index b7e5cdc80ad..b97e97c057e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java index 5d619094fd5..1901daedca9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsobjectmodelwithrefprops; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java index c00f02f2221..36aacc1eb10 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java index 838601e6f24..368baedff08 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java index c7943bcba31..da2929fe0aa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java index 764b6e55111..66eb0110fa2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakerefsstring.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsstring.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsstring; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java index ba47936d312..8cbfffaff80 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsstring.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java index 331a3bc8816..f5a4b5e50a5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java index eaba13c2ffd..60b10445f57 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java index 87003260f1b..370e6f83a23 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java @@ -3,10 +3,15 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakeresponsewithoutschema; import java.io.IOException; @@ -25,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +55,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java index 0c0edb117cd..cfb98029a5d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java index 3c369189086..639e613c2e9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java index c93f7b5e452..67c8ac34840 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.faketestqueryparamters.put.QueryParameters; import org.openapijsonschematools.client.paths.faketestqueryparamters.put.Parameters; import org.openapijsonschematools.client.paths.faketestqueryparamters.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Faketestqueryparamters; import java.io.IOException; @@ -27,7 +32,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -56,7 +61,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java index 68868dd0442..1a34e2be8c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java index 4f6ce7a4b96..60cd2bbf362 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java @@ -38,7 +38,7 @@ public static class SchemaList0 extends FrozenList { protected SchemaList0(FrozenList m) { super(m); } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema01.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java index 0afd56c1683..b479849b2a5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java @@ -38,7 +38,7 @@ public static class SchemaList1 extends FrozenList { protected SchemaList1(FrozenList m) { super(m); } - public static SchemaList1 of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static SchemaList1 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema11.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java index 56a0563c5a9..790a4dca1ab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java @@ -38,7 +38,7 @@ public static class SchemaList2 extends FrozenList { protected SchemaList2(FrozenList m) { super(m); } - public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema21.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java index 9c60f95c11b..dd6756603ef 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java @@ -38,7 +38,7 @@ public static class SchemaList3 extends FrozenList { protected SchemaList3(FrozenList m) { super(m); } - public static SchemaList3 of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static SchemaList3 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema31.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java index 3c74762a71f..8d76c891243 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java @@ -38,7 +38,7 @@ public static class SchemaList4 extends FrozenList { protected SchemaList4(FrozenList m) { super(m); } - public static SchemaList4 of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static SchemaList4 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema41.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java index 2af6f43a3cf..c75a2256ce4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.RequestBody; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeuploaddownloadfile; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +64,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java index 0dbaf136d1e..480f5c0801a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationoctetstreamRequestBody requestBody0 = (ApplicationoctetstreamRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java index f7be0054859..9cbc8eab195 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java index ce3f6db3bc5..d728392ae0b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.code200response.content.applicationoctetstream.ApplicationoctetstreamSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java index 15587ef4551..a6443ffbf7a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakeuploadfile.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeuploadfile.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeuploadfile; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java index 972187e5cca..c9165873f80 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeuploadfile.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java index 033ad2c8f72..b88f2d0ce02 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java index 0e63a6dd0b8..609c7e34de3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java index d5ebe401be7..7061d029997 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.paths.fakeuploadfiles.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeuploadfiles.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeuploadfiles; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +68,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java index 221c62968d4..418dbfd9b9a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeuploadfiles.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java index 1fa96a8e7e1..331cc4d351b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 089868247cc..874a22b3304 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -47,7 +47,7 @@ public static class MultipartformdataFilesList extends FrozenList { protected MultipartformdataFilesList(FrozenList m) { super(m); } - public static MultipartformdataFilesList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static MultipartformdataFilesList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return MultipartformdataFiles.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java index 0b22d9a395e..47da82b38a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java index 05d40d58ab6..6153b15d0a3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java @@ -3,10 +3,15 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakewildcardresponses; import java.io.IOException; @@ -25,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +55,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java index 2070a4ae1db..02fc753b272 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java @@ -7,6 +7,10 @@ import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code4XXResponse; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code5XXResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -80,7 +84,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java index 2acfd0211cb..ef26145bfc0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code1xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code1XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java index d68283badb1..7e764120108 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java index 6a0dc760f46..6286b242a77 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code2xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code2XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java index 639e8181015..45f9a55d442 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code3xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code3XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java index 29484e94819..639aa5d76dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code4xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code4XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java index 0f90b52c550..6a39809e89e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code5xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public Code5XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java index bcb2ea6f22e..d49f9a8f558 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java @@ -3,10 +3,15 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; import org.openapijsonschematools.client.paths.foo.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Foo; import java.io.IOException; @@ -25,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +55,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java index 21bffb7e427..b18746e1213 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.foo.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -27,7 +31,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java index 9d30ccd06e1..d8b09eea4f6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.foo.get.responses.codedefaultresponse.content.applicationjson.ApplicationjsonSchema; @@ -38,7 +41,7 @@ public CodedefaultResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java index 4f3edb0706a..e459c0f28be 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; import org.openapijsonschematools.client.paths.pet.post.RequestBody; import org.openapijsonschematools.client.paths.pet.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Pet; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -31,7 +36,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -72,7 +77,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java index 60f2021f717..6c3a11a8f23 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.pet.put.PetPutSecurityInfo; import org.openapijsonschematools.client.paths.pet.put.RequestBody; import org.openapijsonschematools.client.paths.pet.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Pet; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -31,7 +36,7 @@ public static Void put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -72,7 +77,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void put(PutRequest request) throws IOException, InterruptedException { + default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java index db2e91906cc..1a088bc9cec 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.pet.post.responses.Code200Response; import org.openapijsonschematools.client.paths.pet.post.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +42,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java index a7baa5bdeff..76d076c684c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java index 73c9bfd8cd1..f207b7e4f76 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java @@ -4,6 +4,10 @@ import org.openapijsonschematools.client.paths.pet.put.responses.Code404Response; import org.openapijsonschematools.client.paths.pet.put.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -33,7 +37,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java index 13316edda8b..a209dd91ef0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java index 41448e477ca..c57bce97020 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java index fb14c4ae021..99e0f2ccaf2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java index 50f9742a8b3..01b6ea926f4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java @@ -6,10 +6,15 @@ import org.openapijsonschematools.client.paths.petfindbystatus.get.QueryParameters; import org.openapijsonschematools.client.paths.petfindbystatus.get.Parameters; import org.openapijsonschematools.client.paths.petfindbystatus.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petfindbystatus; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -30,7 +35,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -69,7 +74,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java index bb6a09ea78c..6f130a2316d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.Code200Response; import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +42,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java index 77ec99edc57..e58039f9a33 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java @@ -131,7 +131,7 @@ public static class SchemaList0 extends FrozenList { protected SchemaList0(FrozenList m) { super(m); } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema01.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java index 703a195d0d1..aa652f743aa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java index 0ce665bc5e0..935fa5b01dc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java @@ -6,10 +6,15 @@ import org.openapijsonschematools.client.paths.petfindbytags.get.QueryParameters; import org.openapijsonschematools.client.paths.petfindbytags.get.Parameters; import org.openapijsonschematools.client.paths.petfindbytags.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petfindbytags; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -30,7 +35,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -69,7 +74,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java index 82003a8b683..a44c8e36c8b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.petfindbytags.get.responses.Code200Response; import org.openapijsonschematools.client.paths.petfindbytags.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +42,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java index d0877fdafa0..853c76678b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java @@ -38,7 +38,7 @@ public static class SchemaList0 extends FrozenList { protected SchemaList0(FrozenList m) { super(m); } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema01.getInstance().validate(arg, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java index 151dfd16669..bfbb2cec968 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java index 4d3f69226eb..2c4371e278e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java @@ -7,10 +7,15 @@ import org.openapijsonschematools.client.paths.petpetid.delete.PathParameters; import org.openapijsonschematools.client.paths.petpetid.delete.Parameters; import org.openapijsonschematools.client.paths.petpetid.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petpetid; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -31,7 +36,7 @@ public static Void delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -75,7 +80,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void delete(DeleteRequest request) throws IOException, InterruptedException { + default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java index f3dc2ac9e94..67ba39f8633 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java @@ -6,10 +6,15 @@ import org.openapijsonschematools.client.paths.petpetid.get.PathParameters; import org.openapijsonschematools.client.paths.petpetid.get.Parameters; import org.openapijsonschematools.client.paths.petpetid.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petpetid; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -30,7 +35,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -68,7 +73,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java index 0d1433ab2ae..fe9309edebd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java @@ -7,10 +7,15 @@ import org.openapijsonschematools.client.paths.petpetid.post.PathParameters; import org.openapijsonschematools.client.paths.petpetid.post.Parameters; import org.openapijsonschematools.client.paths.petpetid.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Petpetid; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -33,7 +38,7 @@ public static Void post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -81,7 +86,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void post(PostRequest request) throws IOException, InterruptedException { + default Void post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java index 5211c9c2cd3..226b54a700e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.petpetid.delete.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -25,7 +29,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java index 405f3e16a44..07abfcf7327 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java index 9717fcb81d3..c4b4695f3f7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java @@ -4,6 +4,10 @@ import org.openapijsonschematools.client.paths.petpetid.get.responses.Code400Response; import org.openapijsonschematools.client.paths.petpetid.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -42,7 +46,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java index a22fd6a07b1..6291c822bd8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; @@ -51,7 +54,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java index 21a73ecef8d..e86d9681af5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java index ebae5c97585..a7f1f99fa40 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java index bcfe59527bb..00ba6ed79f2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.petpetid.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java index b0e7a2d9012..dd24a00cdcf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.petpetid.post.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -25,7 +29,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java index ff393dda042..69c58e5c20f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java index f628d4069c0..0a2d4e20eed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java @@ -7,10 +7,15 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PathParameters; import org.openapijsonschematools.client.paths.petpetiduploadimage.post.Parameters; import org.openapijsonschematools.client.paths.petpetiduploadimage.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Petpetiduploadimage; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -33,7 +38,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -81,7 +86,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java index 8fd7c0f6302..81fe04dc837 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.petpetiduploadimage.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java index 2510fe73af5..66437d62436 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.Code200Response; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -35,7 +39,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java index 6670ce4e8dd..e05d3d1eeb7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java @@ -3,10 +3,15 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.solidus.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Solidus; import java.io.IOException; @@ -25,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +55,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java index 8f8f1f3fc78..20265bce469 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.solidus.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java index d6aefad8f01..276946aed60 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; import org.openapijsonschematools.client.paths.storeinventory.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Storeinventory; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -63,7 +68,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java index ce5360d0cdb..69da9e199ce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.storeinventory.get.responses.Code200Response; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -35,7 +39,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java index b357d8afaf0..549869042f5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.storeorder.post.RequestBody; import org.openapijsonschematools.client.paths.storeorder.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Storeorder; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +64,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java index fa09117b1c6..917836e859f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.storeorder.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java index 22f2bd6a7f1..a1d5acc6e3c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.storeorder.post.responses.Code200Response; import org.openapijsonschematools.client.paths.storeorder.post.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +42,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java index 6366cc09898..77c4d74c6c6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationxml.ApplicationxmlSchema; @@ -51,7 +54,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java index 3a8fe613194..b552d927076 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java index d3afe2ab708..a2e71466728 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.storeorderorderid.delete.PathParameters; import org.openapijsonschematools.client.paths.storeorderorderid.delete.Parameters; import org.openapijsonschematools.client.paths.storeorderorderid.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Storeorderorderid; import java.io.IOException; @@ -27,7 +32,7 @@ public static Void delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -55,7 +60,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void delete(DeleteRequest request) throws IOException, InterruptedException { + default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java index 67fd560dc7c..9b3ab245e88 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.storeorderorderid.get.PathParameters; import org.openapijsonschematools.client.paths.storeorderorderid.get.Parameters; import org.openapijsonschematools.client.paths.storeorderorderid.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Storeorderorderid; import java.io.IOException; @@ -27,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -55,7 +60,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java index f811aab1d28..8da935c8aa0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code400Response; import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -29,7 +33,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java index 1660246acfd..cff0f34e78e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java index b975b72c699..536bc0eea73 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java index 9aa9e0eb735..154fd8f52fa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java @@ -4,6 +4,10 @@ import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code400Response; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -42,7 +46,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java index 54af7ec1753..9ad13287f16 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; @@ -51,7 +54,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java index 7bba68ec0a5..15c5366170d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java index 3279aa5e422..5670fc3eea5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java index 596a04b8a31..8d38fe6b95f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.user.post.RequestBody; import org.openapijsonschematools.client.paths.user.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.User; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +64,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java index 9db899fe59e..52a467ba8dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.user.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java index cd6bedeaa49..66d84ae53de 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.user.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -27,7 +31,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java index d2e7f5b7279..14c5ef9c248 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java index b227be4320d..c5682a94fd1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.usercreatewitharray.post.RequestBody; import org.openapijsonschematools.client.paths.usercreatewitharray.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Usercreatewitharray; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +64,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java index 90079ade7ee..11a54b0d107 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -27,7 +31,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java index deab4ccba65..ab94c4b0dd3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java index 664e4d200f5..04d12cb2cb7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java @@ -4,10 +4,15 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.usercreatewithlist.post.RequestBody; import org.openapijsonschematools.client.paths.usercreatewithlist.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Usercreatewithlist; @@ -28,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +64,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java index 4d37cf3af39..545775f23de 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -27,7 +31,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java index cf9857bbb90..03540f9a4fb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java index 97207e125a0..5645f9d9bf6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.userlogin.get.QueryParameters; import org.openapijsonschematools.client.paths.userlogin.get.Parameters; import org.openapijsonschematools.client.paths.userlogin.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userlogin; import java.io.IOException; @@ -27,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -56,7 +61,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java index f31d4fdabf4..2cf0634d92f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java @@ -4,6 +4,10 @@ import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.Code200ResponseHeadersSchema; import org.openapijsonschematools.client.paths.userlogin.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -39,7 +43,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java index 9cb43cc74a9..6c1e7c38b27 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; @@ -53,7 +56,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); @@ -69,7 +72,7 @@ protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConf } @Override - protected Code200ResponseHeadersSchema.Code200ResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + protected Code200ResponseHeadersSchema.Code200ResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java index 4afc7473bd5..bcd151def0e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java index d11d947f0b9..6485a3f0dad 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java @@ -3,10 +3,15 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.userlogout.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userlogout; import java.io.IOException; @@ -25,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +55,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java index 9bf34248b51..05f8f6d1898 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java @@ -2,6 +2,10 @@ import org.openapijsonschematools.client.paths.userlogout.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -27,7 +31,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java index 0b3743c7e0a..2343e93a002 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.userusername.delete.PathParameters; import org.openapijsonschematools.client.paths.userusername.delete.Parameters; import org.openapijsonschematools.client.paths.userusername.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userusername; import java.io.IOException; @@ -27,7 +32,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -55,7 +60,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java index 759d511e42a..8037416e271 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java @@ -5,10 +5,15 @@ import org.openapijsonschematools.client.paths.userusername.get.PathParameters; import org.openapijsonschematools.client.paths.userusername.get.Parameters; import org.openapijsonschematools.client.paths.userusername.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userusername; import java.io.IOException; @@ -27,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -55,7 +60,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java index 81a5f385aab..73715adbc04 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java @@ -6,10 +6,15 @@ import org.openapijsonschematools.client.paths.userusername.put.PathParameters; import org.openapijsonschematools.client.paths.userusername.put.Parameters; import org.openapijsonschematools.client.paths.userusername.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Userusername; @@ -30,7 +35,7 @@ public static Void put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +69,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void put(PutRequest request) throws IOException, InterruptedException { + default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java index 5effba4ddc7..d6740bbea1e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.userusername.delete.responses.Code200Response; import org.openapijsonschematools.client.paths.userusername.delete.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +42,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java index 153c9c0c118..e7e3f346f1b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java index 7be14427d06..79876c30d6c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java @@ -4,6 +4,10 @@ import org.openapijsonschematools.client.paths.userusername.get.responses.Code400Response; import org.openapijsonschematools.client.paths.userusername.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -42,7 +46,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java index 1564a290264..cbb3458c896 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; @@ -51,7 +54,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java index 80b2aa13ca9..ab72dcaf396 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java index 4ad8dbb5634..e0ff71588ba 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java index 22d0e1f9007..5efb70e1d9b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.userusername.put; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java index 996c3423963..f730c6bf297 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java @@ -3,6 +3,10 @@ import org.openapijsonschematools.client.paths.userusername.put.responses.Code400Response; import org.openapijsonschematools.client.paths.userusername.put.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -29,7 +33,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java index e65d8c25ebd..ecc049b512f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java index 7815f74140d..1c89fe1f4e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java index c18134a4086..6be6cbffd80 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java @@ -43,5 +43,5 @@ protected SerializedRequestBody serialize(String contentType, @Nullable Object b 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); + public abstract SerializedRequestBody serialize(T requestBody) throws NotImplementedException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java index 8c5375d9284..d0eeaaa566d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java @@ -4,6 +4,7 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.header.Header; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; @@ -20,7 +21,7 @@ public HeadersDeserializer(Map headers, MapSchemaValidator headersToValidate = new HashMap<>(); for (Map.Entry> entry: responseHeaders.map().entrySet()) { String headerName = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java index 0ab4d4ce702..17b0895e57c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java @@ -7,9 +7,6 @@ import java.util.Optional; import org.checkerframework.checker.nullness.qual.Nullable; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.ToNumberPolicy; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -24,18 +21,14 @@ public abstract class ResponseDeserializer { public final Map content; public final @Nullable Map headers; - private static final Gson gson = new GsonBuilder() - .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .create(); public ResponseDeserializer(Map content) { this.content = content; this.headers = null; } - protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration); - protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration); + protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException; + protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException; protected @Nullable Object deserializeJson(byte[] body) { String bodyStr = new String(body, StandardCharsets.UTF_8); @@ -57,7 +50,7 @@ protected T deserializeBody(String contentType, byte[] body, JsonSchema s throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); } - public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { throw new OpenapiDocumentException("Invalid response returned, Content-Type header is missing and it must be included"); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java index 20b56db17da..26204003e31 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java @@ -2,7 +2,12 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import java.net.http.HttpResponse; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration); + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBody.hbs b/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBody.hbs index 0dfe0ab8cbf..cbb8f3b903a 100644 --- a/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBody.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/requestbodies/RequestBody.hbs @@ -12,6 +12,7 @@ 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; @@ -54,7 +55,7 @@ public class {{jsonPathPiece.pascalCase}} { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { {{#eq content.size 1}} {{#each content}} {{@key.pascalCase}}RequestBody requestBody{{@index}} = ({{@key.pascalCase}}RequestBody) requestBody; diff --git a/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs b/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs index 49245cd4507..e77fd8f4551 100644 --- a/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs @@ -14,6 +14,9 @@ import {{packageName}}.configurations.SchemaConfiguration; import {{packageName}}.response.ResponseDeserializer; import {{packageName}}.response.DeserializedHttpResponse; import {{packageName}}.exceptions.ApiException; +import {{packageName}}.exceptions.InvalidTypeException; +import {{packageName}}.exceptions.ValidationException; +import {{packageName}}.exceptions.NotImplementedException; import {{packageName}}.exceptions.OpenapiDocumentException; {{#if hasContentSchema}} import {{packageName}}.mediatype.MediaType; @@ -81,7 +84,7 @@ public class {{jsonPathPiece.pascalCase}} { {{#if hasContentSchema}} @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); @@ -106,7 +109,7 @@ public class {{jsonPathPiece.pascalCase}} { {{/if}} @Override - protected {{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Void{{/with}} getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + protected {{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Void{{/with}} getHeaders(HttpHeaders headers, SchemaConfiguration configuration){{#if headers}} throws ValidationException, InvalidTypeException, NotImplementedException{{/if}} { {{#if headers}} return new {{headers.jsonPathPiece.pascalCase}}().deserialize(headers, configuration); {{else}} diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/_arrayOutputType.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/_arrayOutputType.hbs index 157d668d23d..40ec25fcd44 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/_arrayOutputType.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/_arrayOutputType.hbs @@ -4,7 +4,7 @@ public static class {{arrayOutputJsonPathPiece.pascalCase}} extends FrozenList<{ protected {{arrayOutputJsonPathPiece.pascalCase}}(FrozenList<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true }}{{/with}}> m) { super(m); } - public static {{arrayOutputJsonPathPiece.pascalCase}} of(List<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException { + public static {{arrayOutputJsonPathPiece.pascalCase}} of(List<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration); } } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputProperties.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputProperties.hbs index f4f9cceab5b..b10eb17fc6a 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputProperties.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputProperties.hbs @@ -59,7 +59,7 @@ public {{> src/main/java/packagename/components/schemas/types/schema_output_type throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new InvalidTypeException("Value may not be null"); + throw new RuntimeException("Value may not be null"); } return (boolean) value; {{else}} @@ -68,7 +68,7 @@ public {{> src/main/java/packagename/components/schemas/types/schema_output_type {{else}} var value = getOrThrow(name); if (!({{#contains types "null" }}value == null || {{/contains}}value instanceof {{> src/main/java/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return ({{> src/main/java/packagename/components/schemas/types/schema_output_type fullRefModule="" }}) value; {{/and}} diff --git a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs index ce1d506339c..e1e0e38be0d 100644 --- a/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs +++ b/src/main/resources/java/src/main/java/packagename/configurations/ApiConfiguration.hbs @@ -109,12 +109,12 @@ public class ApiConfiguration { } {{#each allServers}} - public Server getServer({{jsonPathPiece.pascalCase}}. @Nullable ServerIndex serverIndex) throws UnsetPropertyException { + public Server getServer({{jsonPathPiece.pascalCase}}. @Nullable ServerIndex serverIndex) { var serverProvider = serverInfo.{{jsonPathPiece.camelCase}}; if (serverIndex == null) { {{jsonPathPiece.pascalCase}}. @Nullable ServerIndex configServerIndex = serverIndexInfo.{{jsonPathPiece.camelCase}}ServerIndex; if (configServerIndex == null) { - throw new UnsetPropertyException("{{jsonPathPiece.camelCase}}ServerIndex is unset"); + throw new RuntimeException("{{jsonPathPiece.camelCase}}ServerIndex is unset"); } return serverProvider.getServer(configServerIndex); } @@ -151,12 +151,12 @@ public class ApiConfiguration { } {{#each allSecurity}} - public SecurityRequirementObject getSecurityRequirementObject({{jsonPathPiece.pascalCase}}. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject({{jsonPathPiece.pascalCase}}. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.{{jsonPathPiece.camelCase}}; if (securityIndex == null) { {{jsonPathPiece.pascalCase}}. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.{{jsonPathPiece.camelCase}}SecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("{{jsonPathPiece.camelCase}}SecurityIndex is unset"); + throw new RuntimeException("{{jsonPathPiece.camelCase}}SecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } @@ -166,10 +166,10 @@ public class ApiConfiguration { {{/gt}} {{#if securitySchemes}} - public SecurityScheme getSecurityScheme(Class securitySchemeClass) throws UnsetPropertyException { + public SecurityScheme getSecurityScheme(Class securitySchemeClass) { @Nullable SecurityScheme securityScheme = securitySchemeInfo.get(securitySchemeClass); if (securityScheme == null) { - throw new UnsetPropertyException("SecurityScheme of class " + securitySchemeClass + "cannot be returned because it is unset. Pass in an instance of it in securitySchemes when instantiating ApiConfiguration."); + 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; } @@ -179,7 +179,7 @@ public class ApiConfiguration { return new HashMap<>(); } - public@Nullable Duration getTimeout() { + public @Nullable Duration getTimeout() { return timeout; } } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs b/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs index ebbd848f094..d831b327b8b 100644 --- a/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs @@ -6,7 +6,8 @@ import {{{packageName}}}.contenttype.ContentTypeDetector; import {{{packageName}}}.contenttype.ContentTypeSerializer; import {{{packageName}}}.contenttype.ContentTypeDeserializer; import {{{packageName}}}.exceptions.NotImplementedException; -import {{{packageName}}}.exceptions.OpenapiDocumentException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.mediatype.MediaType; import {{{packageName}}}.parameter.ParameterStyle; @@ -30,7 +31,7 @@ public class ContentHeader extends HeaderBase implements Header { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, OpenapiDocumentException { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { for (Map.Entry> entry: content.entrySet()) { var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; String contentType = entry.getKey(); @@ -41,11 +42,11 @@ public class ContentHeader extends HeaderBase implements Header { throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); } } - throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, OpenapiDocumentException { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { String inDataJoined = String.join(",", inData); // unsure if this is needed @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); if (validate) { @@ -57,7 +58,7 @@ public class ContentHeader extends HeaderBase implements Header { throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); } } - throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } return deserializedJson; } diff --git a/src/main/resources/java/src/main/java/packagename/header/Header.hbs b/src/main/resources/java/src/main/java/packagename/header/Header.hbs index 30a90da0468..7cf5059493b 100644 --- a/src/main/resources/java/src/main/java/packagename/header/Header.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/Header.hbs @@ -2,11 +2,14 @@ package {{{packageName}}}.header; import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.InvalidTypeException; import java.net.http.HttpHeaders; import java.util.List; public interface Header { - HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration); - @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration); + HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException; + @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs b/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs index 950c9c30dbd..f40bb005918 100644 --- a/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs @@ -1,22 +1,17 @@ package {{{packageName}}}.header; import org.checkerframework.checker.nullness.qual.Nullable; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.NotImplementedException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.AbstractMap; -import java.util.LinkedHashMap; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; -import static java.util.stream.Collectors.toList; -import static java.util.stream.Collectors.toMap; - public class Rfc6570Serializer { private static final String ENCODING = "UTF-8"; private static final Set namedParameterSeparators = Set.of("&", ";"); @@ -32,7 +27,7 @@ public class Rfc6570Serializer { .replace("%7E", "~"); // This could be done faster with more hand-crafted code. } catch (UnsupportedEncodingException wow) { - throw new NotImplementedException(wow.getMessage(), wow); + throw new NotImplementedException(wow.getMessage()); } } @@ -89,10 +84,14 @@ public class Rfc6570Serializer { String varNamePiece, boolean namedParameterExpansion ) throws NotImplementedException { - var itemValues = inData.stream() - .map(v -> rfc6570ItemValue(v, percentEncode)) - .filter(Objects::nonNull) - .collect(toList()); + 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 ""; @@ -118,11 +117,18 @@ public class Rfc6570Serializer { String varNamePiece, boolean namedParameterExpansion ) throws NotImplementedException { - var inDataMap = inData.entrySet().stream() - .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), rfc6570ItemValue(entry.getValue(), percentEncode))) - .filter(entry -> entry.getValue() != null) - .collect(toMap(Map.Entry::getKey, Map.Entry::getValue, (x, y) -> y, LinkedHashMap::new)); - + Map inDataMap = new HashMap<>(); + 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 ""; diff --git a/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs b/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs index 9542bf18f44..3a1ace25ae8 100644 --- a/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs @@ -4,6 +4,8 @@ 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}}}.exceptions.InvalidTypeException; import {{{packageName}}}.parameter.ParameterStyle; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaFactory; @@ -31,7 +33,7 @@ public class SchemaHeader extends HeaderBase implements Header { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { var castInData = validate ? schema.validate(inData, configuration) : inData; boolean usedExplode = explode != null && explode; var value = StyleSerializer.serializeSimple(castInData, name, usedExplode, false); @@ -86,7 +88,7 @@ public class SchemaHeader extends HeaderBase implements Header { } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { @Nullable Object castInData = getCastInData(schema, inData); if (validate) { return schema.validate(castInData, configuration); diff --git a/src/main/resources/java/src/main/java/packagename/parameter/CookieSerializer.hbs b/src/main/resources/java/src/main/java/packagename/parameter/CookieSerializer.hbs index 74e8e2d6465..5a56dc471f5 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/CookieSerializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/CookieSerializer.hbs @@ -1,6 +1,8 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -13,7 +15,7 @@ public abstract class CookieSerializer { this.parameters = parameters; } - public String serialize(Map inData) { + public String serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { String result = ""; Map sortedData = new TreeMap<>(inData); for (Map.Entry entry: sortedData.entrySet()) { diff --git a/src/main/resources/java/src/main/java/packagename/parameter/HeadersSerializer.hbs b/src/main/resources/java/src/main/java/packagename/parameter/HeadersSerializer.hbs index 78b184bef5e..1492c5e168c 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/HeadersSerializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/HeadersSerializer.hbs @@ -1,6 +1,8 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.LinkedHashMap; @@ -14,7 +16,7 @@ public abstract class HeadersSerializer { this.parameters = parameters; } - public Map> serialize(Map inData) { + public Map> serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { Map> results = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/src/main/resources/java/src/main/java/packagename/parameter/PathSerializer.hbs b/src/main/resources/java/src/main/java/packagename/parameter/PathSerializer.hbs index 690665a90bf..11d474d71c3 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/PathSerializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/PathSerializer.hbs @@ -1,6 +1,8 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -12,7 +14,7 @@ public abstract class PathSerializer { this.parameters = parameters; } - public String serialize(Map inData, String pathWithPlaceholders) { + public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException, OpenapiDocumentException { String result = pathWithPlaceholders; for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/src/main/resources/java/src/main/java/packagename/parameter/QuerySerializer.hbs b/src/main/resources/java/src/main/java/packagename/parameter/QuerySerializer.hbs index 870a79804b6..3d6d65f60c0 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/QuerySerializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/QuerySerializer.hbs @@ -1,6 +1,8 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.HashMap; @@ -14,7 +16,7 @@ public abstract class QuerySerializer { this.parameters = parameters; } - public Map getQueryMap(Map inData) { + public Map getQueryMap(Map inData) throws NotImplementedException, OpenapiDocumentException { Map results = new HashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs index e74ca3bf4ac..7a915dfb4e0 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs @@ -27,10 +27,15 @@ import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; {{#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.OpenapiDocumentException; +import {{packageName}}.exceptions.NotImplementedException; +import {{packageName}}.exceptions.InvalidTypeException; +import {{packageName}}.exceptions.ApiException; import {{packageName}}.restclient.RestClient; -import {{packageName}}.apiclient.ApiClient; {{#if requestBody}} import {{packageName}}.requestbody.SerializedRequestBody; {{/if}} @@ -67,7 +72,7 @@ public class {{jsonPathPiece.pascalCase}} { ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); {{#with requestBody}} @@ -193,7 +198,7 @@ public class {{jsonPathPiece.pascalCase}} { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Void{{/if}} {{jsonPathPiece.camelCase}}({{jsonPathPiece.pascalCase}}Request request) throws IOException, InterruptedException { + default {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Void{{/if}} {{jsonPathPiece.camelCase}}({{jsonPathPiece.pascalCase}}Request request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { return {{jsonPathPiece.pascalCase}}Provider.{{jsonPathPiece.camelCase}}(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs index 02100fba445..746605c4da5 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs @@ -9,6 +9,10 @@ import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; {{/with}} {{/each}} import {{{packageName}}}.exceptions.ApiException; +import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.OpenapiDocumentException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; {{#if nonErrorResponses }} import {{{packageName}}}.response.ApiResponse; {{/if}} @@ -81,7 +85,7 @@ public class {{responses.jsonPathPiece.pascalCase}} { {{/with}} } - public {{#if nonErrorResponses }}EndpointResponse{{else}}Void{{/if}} deserialize(HttpResponse response, SchemaConfiguration configuration) { + public {{#if nonErrorResponses }}EndpointResponse{{else}}Void{{/if}} deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { {{#eq defaultResponse null }} String statusCode = String.valueOf(response.statusCode()); {{#and statusCodeResponses wildcardCodeResponses }} diff --git a/src/main/resources/java/src/main/java/packagename/requestbody/RequestBodySerializer.hbs b/src/main/resources/java/src/main/java/packagename/requestbody/RequestBodySerializer.hbs index 238c530d28f..3c1ed740dd6 100644 --- a/src/main/resources/java/src/main/java/packagename/requestbody/RequestBodySerializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/requestbody/RequestBodySerializer.hbs @@ -43,5 +43,5 @@ public abstract class RequestBodySerializer { 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); + public abstract SerializedRequestBody serialize(T requestBody) throws NotImplementedException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs b/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs index 56f3607a49a..2b7c573a028 100644 --- a/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs @@ -4,6 +4,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.header.Header; import {{{packageName}}}.schemas.validation.MapSchemaValidator; @@ -20,7 +21,7 @@ public abstract class HeadersDeserializer { this.headersSchema = headersSchema; } - public OutType deserialize(HttpHeaders responseHeaders, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OutType deserialize(HttpHeaders responseHeaders, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException, NotImplementedException { Map headersToValidate = new HashMap<>(); for (Map.Entry> entry: responseHeaders.map().entrySet()) { String headerName = entry.getKey(); diff --git a/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs b/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs index 5d1b183fbd1..46453bf4e13 100644 --- a/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs @@ -7,9 +7,6 @@ import java.util.Map; import java.util.Optional; import org.checkerframework.checker.nullness.qual.Nullable; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.ToNumberPolicy; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.schemas.validation.JsonSchema; @@ -24,18 +21,14 @@ import {{{packageName}}}.header.Header; public abstract class ResponseDeserializer { public final Map content; public final @Nullable Map headers; - private static final Gson gson = new GsonBuilder() - .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .create(); public ResponseDeserializer(Map content) { this.content = content; this.headers = null; } - protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration); - protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration); + protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException; + protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException; protected @Nullable Object deserializeJson(byte[] body) { String bodyStr = new String(body, StandardCharsets.UTF_8); @@ -57,7 +50,7 @@ public abstract class ResponseDeserializer deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { throw new OpenapiDocumentException("Invalid response returned, Content-Type header is missing and it must be included"); diff --git a/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs b/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs index 7366d4f6953..57e22d4f907 100644 --- a/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs @@ -2,7 +2,12 @@ package {{{packageName}}}.response; import {{{packageName}}}.configurations.SchemaConfiguration; import java.net.http.HttpResponse; +import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.OpenapiDocumentException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration); + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException; } \ No newline at end of file From 2a29ed91d36e863f3b277313d55514d664a542f1 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 12:41:22 -0700 Subject: [PATCH 25/53] Adds exception info to ResponseDeserializerTest --- .../client/header/SchemaHeader.java | 2 +- .../client/header/StyleSerializer.java | 13 +++++++------ .../response/ResponseDeserializerTest.java | 18 +++++++++++------- .../java/packagename/header/SchemaHeader.hbs | 2 +- .../packagename/header/StyleSerializer.hbs | 13 +++++++------ .../response/ResponseDeserializerTest.hbs | 17 ++++++++++------- 6 files changed, 37 insertions(+), 28 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java index 4215029bf3b..b253262dc13 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java @@ -33,7 +33,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { var castInData = validate ? schema.validate(inData, configuration) : inData; boolean usedExplode = explode != null && explode; var value = StyleSerializer.serializeSimple(castInData, name, usedExplode, false); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java index d18be288684..f5fa5a0a75b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; public class StyleSerializer extends Rfc6570Serializer { public static String serializeSimple( @@ -8,7 +9,7 @@ public static String serializeSimple( String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); return rfc6570Expansion( name, @@ -24,7 +25,7 @@ public static String serializeForm( String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { // todo check that the prefix and suffix matches this one PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); return rfc6570Expansion( @@ -40,7 +41,7 @@ public static String serializeMatrix( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); return rfc6570Expansion( name, @@ -55,7 +56,7 @@ public static String serializeLabel( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); return rfc6570Expansion( name, @@ -70,7 +71,7 @@ public static String serializeSpaceDelimited( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); return rfc6570Expansion( name, @@ -85,7 +86,7 @@ public static String serializePipeDelimited( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); return rfc6570Expansion( name, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java index 408f04582a8..d4ba032bc5f 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java @@ -8,6 +8,10 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -64,7 +68,7 @@ public MyResponseDeserializer() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, InvalidTypeException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); @@ -152,7 +156,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserializeApplicationJsonNull() { + public void testDeserializeApplicationJsonNull() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(null).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -168,7 +172,7 @@ public void testDeserializeApplicationJsonNull() { } @Test - public void testDeserializeApplicationJsonTrue() { + public void testDeserializeApplicationJsonTrue() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(true).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -184,7 +188,7 @@ public void testDeserializeApplicationJsonTrue() { } @Test - public void testDeserializeApplicationJsonFalse() { + public void testDeserializeApplicationJsonFalse() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(false).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -200,7 +204,7 @@ public void testDeserializeApplicationJsonFalse() { } @Test - public void testDeserializeApplicationJsonInt() { + public void testDeserializeApplicationJsonInt() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(1).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -216,7 +220,7 @@ public void testDeserializeApplicationJsonInt() { } @Test - public void testDeserializeApplicationJsonFloat() { + public void testDeserializeApplicationJsonFloat() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(3.14).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -232,7 +236,7 @@ public void testDeserializeApplicationJsonFloat() { } @Test - public void testDeserializeApplicationJsonString() { + public void testDeserializeApplicationJsonString() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson("a").getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); diff --git a/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs b/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs index 3a1ace25ae8..fb060e9ea6d 100644 --- a/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs @@ -33,7 +33,7 @@ public class SchemaHeader extends HeaderBase implements Header { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { var castInData = validate ? schema.validate(inData, configuration) : inData; boolean usedExplode = explode != null && explode; var value = StyleSerializer.serializeSimple(castInData, name, usedExplode, false); diff --git a/src/main/resources/java/src/main/java/packagename/header/StyleSerializer.hbs b/src/main/resources/java/src/main/java/packagename/header/StyleSerializer.hbs index fac1bc0b57c..9efe3ff849e 100644 --- a/src/main/resources/java/src/main/java/packagename/header/StyleSerializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/StyleSerializer.hbs @@ -1,6 +1,7 @@ package {{{packageName}}}.header; import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; public class StyleSerializer extends Rfc6570Serializer { public static String serializeSimple( @@ -8,7 +9,7 @@ public class StyleSerializer extends Rfc6570Serializer { String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); return rfc6570Expansion( name, @@ -24,7 +25,7 @@ public class StyleSerializer extends Rfc6570Serializer { String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { // todo check that the prefix and suffix matches this one PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); return rfc6570Expansion( @@ -40,7 +41,7 @@ public class StyleSerializer extends Rfc6570Serializer { @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); return rfc6570Expansion( name, @@ -55,7 +56,7 @@ public class StyleSerializer extends Rfc6570Serializer { @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); return rfc6570Expansion( name, @@ -70,7 +71,7 @@ public class StyleSerializer extends Rfc6570Serializer { @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); return rfc6570Expansion( name, @@ -85,7 +86,7 @@ public class StyleSerializer extends Rfc6570Serializer { @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); return rfc6570Expansion( name, diff --git a/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs b/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs index e06fe92a476..de0dd283b31 100644 --- a/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs @@ -8,6 +8,9 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.mediatype.MediaType; import {{{packageName}}}.schemas.AnyTypeJsonSchema; import {{{packageName}}}.schemas.StringJsonSchema; @@ -64,7 +67,7 @@ public class ResponseDeserializerTest { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, InvalidTypeException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); @@ -152,7 +155,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonNull() { + public void testDeserializeApplicationJsonNull() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(null).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -168,7 +171,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonTrue() { + public void testDeserializeApplicationJsonTrue() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(true).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -184,7 +187,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonFalse() { + public void testDeserializeApplicationJsonFalse() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(false).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -200,7 +203,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonInt() { + public void testDeserializeApplicationJsonInt() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(1).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -216,7 +219,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonFloat() { + public void testDeserializeApplicationJsonFloat() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(3.14).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -232,7 +235,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonString() { + public void testDeserializeApplicationJsonString() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson("a").getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); From fe9fff4678ed0d152e500a4903ab6347434f6279 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 13:36:14 -0700 Subject: [PATCH 26/53] Updates getNewInstance to only throw RuntimExceptions --- .../ApplicationjsonSchema.java | 6 +- .../HeadersWithNoBodyHeadersSchema.java | 8 +- .../ApplicationjsonSchema.java | 6 +- .../applicationxml/ApplicationxmlSchema.java | 6 +- ...ssInlineContentAndHeaderHeadersSchema.java | 8 +- .../ApplicationjsonSchema.java | 8 +- ...ccessWithJsonApiResponseHeadersSchema.java | 6 +- .../schemas/AbstractStepMessage.java | 6 +- .../schemas/AdditionalPropertiesClass.java | 50 +++++----- .../schemas/AdditionalPropertiesSchema.java | 44 ++++----- .../AdditionalPropertiesWithArrayOfEnums.java | 14 +-- .../client/components/schemas/Address.java | 8 +- .../client/components/schemas/Animal.java | 6 +- .../client/components/schemas/AnimalFarm.java | 6 +- .../components/schemas/AnyTypeAndFormat.java | 96 +++++++++---------- .../components/schemas/AnyTypeNotString.java | 10 +- .../components/schemas/ApiResponseSchema.java | 6 +- .../client/components/schemas/Apple.java | 6 +- .../client/components/schemas/AppleReq.java | 8 +- .../schemas/ArrayHoldingAnyType.java | 4 +- .../schemas/ArrayOfArrayOfNumberOnly.java | 18 ++-- .../components/schemas/ArrayOfEnums.java | 6 +- .../components/schemas/ArrayOfNumberOnly.java | 12 +-- .../client/components/schemas/ArrayTest.java | 36 +++---- .../schemas/ArrayWithValidationsInItems.java | 6 +- .../client/components/schemas/Banana.java | 6 +- .../client/components/schemas/BananaReq.java | 8 +- .../client/components/schemas/BasquePig.java | 6 +- .../components/schemas/Capitalization.java | 6 +- .../client/components/schemas/Cat.java | 16 ++-- .../client/components/schemas/Category.java | 6 +- .../client/components/schemas/ChildCat.java | 16 ++-- .../client/components/schemas/ClassModel.java | 10 +- .../client/components/schemas/Client.java | 6 +- .../schemas/ComplexQuadrilateral.java | 16 ++-- ...posedAnyOfDifferentTypesNoValidations.java | 14 +-- .../components/schemas/ComposedArray.java | 4 +- .../components/schemas/ComposedObject.java | 6 +- .../schemas/ComposedOneOfDifferentTypes.java | 20 ++-- .../client/components/schemas/DanishPig.java | 6 +- .../client/components/schemas/Dog.java | 16 ++-- .../client/components/schemas/Drawing.java | 12 +-- .../client/components/schemas/EnumArrays.java | 12 +-- .../client/components/schemas/EnumTest.java | 6 +- .../schemas/EquilateralTriangle.java | 16 ++-- .../client/components/schemas/File.java | 6 +- .../schemas/FileSchemaTestClass.java | 12 +-- .../client/components/schemas/Foo.java | 6 +- .../client/components/schemas/FormatTest.java | 12 +-- .../client/components/schemas/FromSchema.java | 6 +- .../client/components/schemas/Fruit.java | 10 +- .../client/components/schemas/FruitReq.java | 10 +- .../client/components/schemas/GmFruit.java | 10 +- .../components/schemas/GrandparentAnimal.java | 6 +- .../components/schemas/HasOnlyReadOnly.java | 6 +- .../components/schemas/HealthCheckResult.java | 6 +- .../components/schemas/IsoscelesTriangle.java | 16 ++-- .../client/components/schemas/Items.java | 6 +- .../components/schemas/JSONPatchRequest.java | 14 +-- .../JSONPatchRequestAddReplaceTest.java | 6 +- .../schemas/JSONPatchRequestMoveCopy.java | 8 +- .../schemas/JSONPatchRequestRemove.java | 8 +- .../client/components/schemas/Mammal.java | 10 +- .../client/components/schemas/MapTest.java | 38 ++++---- ...ropertiesAndAdditionalPropertiesClass.java | 14 +-- .../client/components/schemas/Money.java | 6 +- .../components/schemas/MyObjectDto.java | 8 +- .../client/components/schemas/Name.java | 10 +- .../schemas/NoAdditionalProperties.java | 8 +- .../components/schemas/NullableClass.java | 80 ++++++++-------- .../components/schemas/NullableShape.java | 10 +- .../client/components/schemas/NumberOnly.java | 6 +- .../schemas/ObjWithRequiredProps.java | 6 +- .../schemas/ObjWithRequiredPropsBase.java | 6 +- .../ObjectModelWithArgAndArgsProperties.java | 6 +- .../schemas/ObjectModelWithRefProps.java | 6 +- ...hAllOfWithReqTestPropFromUnsetAddProp.java | 16 ++-- .../ObjectWithCollidingProperties.java | 6 +- .../schemas/ObjectWithDecimalProperties.java | 6 +- .../ObjectWithDifficultlyNamedProps.java | 6 +- .../ObjectWithInlineCompositionProperty.java | 16 ++-- ...ObjectWithInvalidNamedRefedProperties.java | 6 +- .../ObjectWithNonIntersectingValues.java | 8 +- .../schemas/ObjectWithOnlyOptionalProps.java | 8 +- .../schemas/ObjectWithOptionalTestProp.java | 6 +- .../schemas/ObjectWithValidations.java | 6 +- .../client/components/schemas/Order.java | 6 +- .../schemas/PaginatedResultMyObjectDto.java | 14 +-- .../client/components/schemas/ParentPet.java | 6 +- .../client/components/schemas/Pet.java | 18 ++-- .../client/components/schemas/Pig.java | 10 +- .../client/components/schemas/Player.java | 6 +- .../client/components/schemas/PublicKey.java | 6 +- .../components/schemas/Quadrilateral.java | 10 +- .../schemas/QuadrilateralInterface.java | 10 +- .../components/schemas/ReadOnlyFirst.java | 6 +- .../schemas/ReqPropsFromExplicitAddProps.java | 8 +- .../schemas/ReqPropsFromTrueAddProps.java | 6 +- .../schemas/ReqPropsFromUnsetAddProps.java | 6 +- .../components/schemas/ReturnSchema.java | 10 +- .../components/schemas/ScaleneTriangle.java | 16 ++-- .../components/schemas/Schema200Response.java | 10 +- .../schemas/SelfReferencingArrayModel.java | 6 +- .../schemas/SelfReferencingObjectModel.java | 6 +- .../client/components/schemas/Shape.java | 10 +- .../components/schemas/ShapeOrNull.java | 10 +- .../schemas/SimpleQuadrilateral.java | 16 ++-- .../client/components/schemas/SomeObject.java | 10 +- .../components/schemas/SpecialModelname.java | 6 +- .../components/schemas/StringBooleanMap.java | 8 +- .../client/components/schemas/Tag.java | 6 +- .../client/components/schemas/Triangle.java | 10 +- .../components/schemas/TriangleInterface.java | 10 +- .../client/components/schemas/User.java | 22 ++--- .../client/components/schemas/Whale.java | 6 +- .../client/components/schemas/Zebra.java | 6 +- .../delete/HeaderParameters.java | 8 +- .../delete/PathParameters.java | 8 +- .../commonparamsubdir/get/PathParameters.java | 8 +- .../get/QueryParameters.java | 8 +- .../post/HeaderParameters.java | 8 +- .../post/PathParameters.java | 8 +- .../paths/fake/delete/HeaderParameters.java | 6 +- .../paths/fake/delete/QueryParameters.java | 6 +- .../paths/fake/get/HeaderParameters.java | 6 +- .../paths/fake/get/QueryParameters.java | 6 +- .../get/parameters/parameter0/Schema0.java | 6 +- .../get/parameters/parameter2/Schema2.java | 6 +- .../ApplicationxwwwformurlencodedSchema.java | 12 +-- .../ApplicationxwwwformurlencodedSchema.java | 6 +- .../put/QueryParameters.java | 8 +- .../put/QueryParameters.java | 6 +- .../delete/PathParameters.java | 8 +- .../ApplicationjsonSchema.java | 8 +- .../post/QueryParameters.java | 6 +- .../post/parameters/parameter0/Schema0.java | 10 +- .../post/parameters/parameter1/Schema1.java | 16 ++-- .../ApplicationjsonSchema.java | 10 +- .../MultipartformdataSchema.java | 16 ++-- .../ApplicationjsonSchema.java | 10 +- .../MultipartformdataSchema.java | 16 ++-- .../ApplicationxwwwformurlencodedSchema.java | 6 +- .../ApplicationjsonSchema.java | 6 +- .../MultipartformdataSchema.java | 6 +- .../fakeobjinquery/get/QueryParameters.java | 8 +- .../get/parameters/parameter0/Schema0.java | 6 +- .../post/CookieParameters.java | 6 +- .../post/HeaderParameters.java | 6 +- .../post/PathParameters.java | 6 +- .../post/QueryParameters.java | 6 +- .../post/PathParameters.java | 8 +- .../MultipartformdataSchema.java | 6 +- .../get/QueryParameters.java | 8 +- .../get/QueryParameters.java | 8 +- .../put/QueryParameters.java | 6 +- .../put/parameters/parameter0/Schema0.java | 6 +- .../put/parameters/parameter1/Schema1.java | 6 +- .../put/parameters/parameter2/Schema2.java | 6 +- .../put/parameters/parameter3/Schema3.java | 6 +- .../put/parameters/parameter4/Schema4.java | 6 +- .../MultipartformdataSchema.java | 6 +- .../MultipartformdataSchema.java | 12 +-- .../ApplicationjsonSchema.java | 6 +- .../foo/get/servers/server1/Variables.java | 8 +- .../petfindbystatus/get/QueryParameters.java | 8 +- .../get/parameters/parameter0/Schema0.java | 6 +- .../servers/server1/Variables.java | 8 +- .../petfindbytags/get/QueryParameters.java | 8 +- .../get/parameters/parameter0/Schema0.java | 6 +- .../petpetid/delete/HeaderParameters.java | 8 +- .../paths/petpetid/delete/PathParameters.java | 8 +- .../paths/petpetid/get/PathParameters.java | 8 +- .../paths/petpetid/post/PathParameters.java | 8 +- .../ApplicationxwwwformurlencodedSchema.java | 6 +- .../post/PathParameters.java | 8 +- .../MultipartformdataSchema.java | 6 +- .../delete/PathParameters.java | 8 +- .../storeorderorderid/get/PathParameters.java | 8 +- .../paths/userlogin/get/QueryParameters.java | 6 +- .../Code200ResponseHeadersSchema.java | 6 +- .../userusername/delete/PathParameters.java | 8 +- .../userusername/get/PathParameters.java | 8 +- .../userusername/put/PathParameters.java | 8 +- .../client/schemas/AnyTypeJsonSchema.java | 14 +-- .../client/schemas/BooleanJsonSchema.java | 4 +- .../client/schemas/DateJsonSchema.java | 4 +- .../client/schemas/DateTimeJsonSchema.java | 4 +- .../client/schemas/DecimalJsonSchema.java | 4 +- .../client/schemas/DoubleJsonSchema.java | 4 +- .../client/schemas/FloatJsonSchema.java | 4 +- .../client/schemas/Int32JsonSchema.java | 4 +- .../client/schemas/Int64JsonSchema.java | 4 +- .../client/schemas/IntJsonSchema.java | 4 +- .../client/schemas/ListJsonSchema.java | 4 +- .../client/schemas/MapJsonSchema.java | 10 +- .../client/schemas/NotAnyTypeJsonSchema.java | 14 +-- .../client/schemas/NullJsonSchema.java | 4 +- .../client/schemas/NumberJsonSchema.java | 4 +- .../client/schemas/StringJsonSchema.java | 4 +- .../client/schemas/UuidJsonSchema.java | 4 +- .../client/schemas/validation/JsonSchema.java | 2 +- .../validation/UnsetAnyTypeJsonSchema.java | 14 +-- .../client/servers/server0/Variables.java | 8 +- .../client/servers/server1/Variables.java | 8 +- .../response/ResponseDeserializerTest.java | 1 - .../SchemaClass/_validate_implementor.hbs | 28 +++--- .../packagename/schemas/AnyTypeJsonSchema.hbs | 14 +-- .../packagename/schemas/BooleanJsonSchema.hbs | 4 +- .../packagename/schemas/DateJsonSchema.hbs | 4 +- .../schemas/DateTimeJsonSchema.hbs | 4 +- .../packagename/schemas/DecimalJsonSchema.hbs | 4 +- .../packagename/schemas/DoubleJsonSchema.hbs | 4 +- .../packagename/schemas/FloatJsonSchema.hbs | 4 +- .../packagename/schemas/Int32JsonSchema.hbs | 4 +- .../packagename/schemas/Int64JsonSchema.hbs | 4 +- .../packagename/schemas/IntJsonSchema.hbs | 4 +- .../packagename/schemas/ListJsonSchema.hbs | 4 +- .../packagename/schemas/MapJsonSchema.hbs | 10 +- .../schemas/NotAnyTypeJsonSchema.hbs | 14 +-- .../packagename/schemas/NullJsonSchema.hbs | 4 +- .../packagename/schemas/NumberJsonSchema.hbs | 4 +- .../packagename/schemas/StringJsonSchema.hbs | 4 +- .../packagename/schemas/UuidJsonSchema.hbs | 4 +- .../schemas/validation/JsonSchema.hbs | 2 +- .../validation/UnsetAnyTypeJsonSchema.hbs | 14 +-- 225 files changed, 1049 insertions(+), 1050 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java index 1d777ff12d5..c0afc397ef8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java @@ -88,7 +88,7 @@ public static ApplicationjsonSchema1 getInstance() { } @Override - public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -96,12 +96,12 @@ public ApplicationjsonSchemaList getNewInstance(List arg, List pathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof User.UserMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((User.UserMap) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java index fb258dbedbe..ae8a2d5f129 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java @@ -125,12 +125,12 @@ public static HeadersWithNoBodyHeadersSchema1 getInstance() { return instance; } - public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +138,12 @@ public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java index fda81b9ddc6..debe772349d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java @@ -89,7 +89,7 @@ public static ApplicationjsonSchema1 getInstance() { } @Override - public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationjsonSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -97,12 +97,12 @@ public ApplicationjsonSchemaList getNewInstance(List arg, List pathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Pet.PetMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Pet.PetMap) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java index 311e0766658..5fe337ebc9e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java @@ -88,7 +88,7 @@ public static ApplicationxmlSchema1 getInstance() { } @Override - public ApplicationxmlSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationxmlSchemaList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -96,12 +96,12 @@ public ApplicationxmlSchemaList getNewInstance(List arg, List pathToI itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Pet.PetMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Pet.PetMap) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java index 4cc85c8e474..8c034d05cb2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java @@ -125,12 +125,12 @@ public static SuccessInlineContentAndHeaderHeadersSchema1 getInstance() { return instance; } - public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +138,12 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map ar Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java index 911bdc443a2..25c65ba82b2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java @@ -124,12 +124,12 @@ public static ApplicationjsonSchema1 getInstance() { return instance; } - public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +137,12 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java index c64577d9eb9..71fb54f39d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java @@ -465,12 +465,12 @@ public static SuccessWithJsonApiResponseHeadersSchema1 getInstance() { return instance; } - public SuccessWithJsonApiResponseHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SuccessWithJsonApiResponseHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -478,7 +478,7 @@ public SuccessWithJsonApiResponseHeadersSchemaMap getNewInstance(Map arg, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java index a71a7c38b3b..9c42ed107fe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java @@ -392,12 +392,12 @@ public static AbstractStepMessage1 getInstance() { return instance; } - public AbstractStepMessageMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AbstractStepMessageMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -405,7 +405,7 @@ public AbstractStepMessageMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java index 48a4882d406..36fa1fa8662 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java @@ -122,12 +122,12 @@ public static MapProperty getInstance() { return instance; } - public MapPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MapPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -135,12 +135,12 @@ public MapPropertyMap getNewInstance(Map arg, List pathToItem, Pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -276,12 +276,12 @@ public static AdditionalProperties1 getInstance() { return instance; } - public AdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -289,12 +289,12 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -419,12 +419,12 @@ public static MapOfMapProperty getInstance() { return instance; } - public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -432,12 +432,12 @@ public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof AdditionalPropertiesMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (AdditionalPropertiesMap) propertyInstance); } @@ -662,12 +662,12 @@ public static MapWithUndeclaredPropertiesAnytype3 getInstance() { return instance; } - public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -675,7 +675,7 @@ public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -792,12 +792,12 @@ public static EmptyMap getInstance() { return instance; } - public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -805,7 +805,7 @@ public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -943,12 +943,12 @@ public static MapWithUndeclaredPropertiesString getInstance() { return instance; } - public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -956,12 +956,12 @@ public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -1342,12 +1342,12 @@ public static AdditionalPropertiesClass1 getInstance() { return instance; } - public AdditionalPropertiesClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AdditionalPropertiesClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1355,7 +1355,7 @@ public AdditionalPropertiesClassMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java index d2d487700c8..9f56d8a9214 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java @@ -183,12 +183,12 @@ public static Schema0 getInstance() { return instance; } - public Schema0Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema0Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -196,7 +196,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -385,7 +385,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -393,7 +393,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -415,12 +415,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -428,7 +428,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -664,12 +664,12 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -677,7 +677,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -866,7 +866,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -874,7 +874,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -896,12 +896,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -909,7 +909,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1145,12 +1145,12 @@ public static Schema2 getInstance() { return instance; } - public Schema2Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema2Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1158,7 +1158,7 @@ public Schema2Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1246,12 +1246,12 @@ public static AdditionalPropertiesSchema1 getInstance() { return instance; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1259,7 +1259,7 @@ public static AdditionalPropertiesSchema1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java index ffc2624941d..1268c2a66db 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java @@ -97,7 +97,7 @@ public static AdditionalProperties getInstance() { } @Override - public AdditionalPropertiesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AdditionalPropertiesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -105,12 +105,12 @@ public AdditionalPropertiesList getNewInstance(List arg, List pathToI itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -244,12 +244,12 @@ public static AdditionalPropertiesWithArrayOfEnums1 getInstance() { return instance; } - public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -257,12 +257,12 @@ public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(Map arg, Lis Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof AdditionalPropertiesList)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (AdditionalPropertiesList) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java index 4f46c0a211d..c0414c5bfbf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java @@ -144,12 +144,12 @@ public static Address1 getInstance() { return instance; } - public AddressMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AddressMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -157,12 +157,12 @@ public AddressMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java index f896958da11..261ad7b4d3e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java @@ -260,12 +260,12 @@ public static Animal1 getInstance() { return instance; } - public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -273,7 +273,7 @@ public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java index e2705a5f344..433a8300379 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java @@ -93,7 +93,7 @@ public static AnimalFarm1 getInstance() { } @Override - public AnimalFarmList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AnimalFarmList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -101,12 +101,12 @@ public AnimalFarmList getNewInstance(List arg, List pathToItem, PathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Animal.AnimalMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Animal.AnimalMap) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java index 8348806068b..047cf3c1288 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java @@ -177,7 +177,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -185,7 +185,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -207,12 +207,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -220,7 +220,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -462,7 +462,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -470,7 +470,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -492,12 +492,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -505,7 +505,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -747,7 +747,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -755,7 +755,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -777,12 +777,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -790,7 +790,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1032,7 +1032,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1040,7 +1040,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1062,12 +1062,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1075,7 +1075,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1317,7 +1317,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1325,7 +1325,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1347,12 +1347,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1360,7 +1360,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1602,7 +1602,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1610,7 +1610,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1632,12 +1632,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1645,7 +1645,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1887,7 +1887,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1895,7 +1895,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1917,12 +1917,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1930,7 +1930,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -2172,7 +2172,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -2180,7 +2180,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -2202,12 +2202,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2215,7 +2215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -2457,7 +2457,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -2465,7 +2465,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -2487,12 +2487,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2500,7 +2500,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -3279,12 +3279,12 @@ public static AnyTypeAndFormat1 getInstance() { return instance; } - public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -3292,7 +3292,7 @@ public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java index ef88da2c2a7..72b0ef9e5da 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java @@ -193,7 +193,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -201,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -223,12 +223,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java index 98ec34d9e0d..11cf4c5f322 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java @@ -226,12 +226,12 @@ public static ApiResponseSchema1 getInstance() { return instance; } - public ApiResponseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApiResponseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -239,7 +239,7 @@ public ApiResponseMap getNewInstance(Map arg, List pathToItem, Pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java index aafebda922b..9f2b69a9481 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java @@ -339,12 +339,12 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public AppleMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AppleMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -352,7 +352,7 @@ public AppleMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java index b6ea075aef9..b7f9edcf558 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java @@ -199,12 +199,12 @@ public static AppleReq1 getInstance() { return instance; } - public AppleReqMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AppleReqMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -212,12 +212,12 @@ public AppleReqMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java index b2bdd251a67..3dc7a793d07 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java @@ -144,7 +144,7 @@ public static ArrayHoldingAnyType1 getInstance() { } @Override - public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -152,7 +152,7 @@ public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToIt itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java index 89b42c8a7c5..67725b0d13b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java @@ -120,7 +120,7 @@ public static Items getInstance() { } @Override - public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -128,12 +128,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -242,7 +242,7 @@ public static ArrayArrayNumber getInstance() { } @Override - public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -250,12 +250,12 @@ public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList) itemInstance); i += 1; @@ -404,12 +404,12 @@ public static ArrayOfArrayOfNumberOnly1 getInstance() { return instance; } - public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -417,7 +417,7 @@ public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java index 075fa21242e..7044a7eb501 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java @@ -106,7 +106,7 @@ public static ArrayOfEnums1 getInstance() { } @Override - public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable String> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -114,12 +114,12 @@ public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, Pat itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((@Nullable String) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java index edff10895ce..5d229747360 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java @@ -120,7 +120,7 @@ public static ArrayNumber getInstance() { } @Override - public ArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayNumberList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -128,12 +128,12 @@ public ArrayNumberList getNewInstance(List arg, List pathToItem, Path itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -282,12 +282,12 @@ public static ArrayOfNumberOnly1 getInstance() { return instance; } - public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -295,7 +295,7 @@ public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java index 693dab7063c..db10c284923 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java @@ -106,7 +106,7 @@ public static ArrayOfString getInstance() { } @Override - public ArrayOfStringList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayOfStringList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -114,12 +114,12 @@ public ArrayOfStringList getNewInstance(List arg, List pathToItem, Pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -254,7 +254,7 @@ public static Items1 getInstance() { } @Override - public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -262,12 +262,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -376,7 +376,7 @@ public static ArrayArrayOfInteger getInstance() { } @Override - public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -384,12 +384,12 @@ public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToIt itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList) itemInstance); i += 1; @@ -498,7 +498,7 @@ public static Items3 getInstance() { } @Override - public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -506,12 +506,12 @@ public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ReadOnlyFirst.ReadOnlyFirstMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ReadOnlyFirst.ReadOnlyFirstMap) itemInstance); i += 1; @@ -620,7 +620,7 @@ public static ArrayArrayOfModel getInstance() { } @Override - public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -628,12 +628,12 @@ public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList1)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList1) itemInstance); i += 1; @@ -836,12 +836,12 @@ public static ArrayTest1 getInstance() { return instance; } - public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -849,7 +849,7 @@ public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java index 6050e5769c4..a35dbdfe76c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java @@ -198,7 +198,7 @@ public static ArrayWithValidationsInItems1 getInstance() { } @Override - public ArrayWithValidationsInItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayWithValidationsInItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -206,12 +206,12 @@ public ArrayWithValidationsInItemsList getNewInstance(List arg, List itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java index fba7acdce5b..38d9dcc32b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java @@ -172,12 +172,12 @@ public static Banana1 getInstance() { return instance; } - public BananaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public BananaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -185,7 +185,7 @@ public BananaMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java index 8f864d58efa..f629ec3b002 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java @@ -217,12 +217,12 @@ public static BananaReq1 getInstance() { return instance; } - public BananaReqMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public BananaReqMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,12 +230,12 @@ public BananaReqMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java index 5f9712c7bd3..6249c54e78f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java @@ -241,12 +241,12 @@ public static BasquePig1 getInstance() { return instance; } - public BasquePigMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public BasquePigMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -254,7 +254,7 @@ public BasquePigMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java index 3aa36cb5fc4..e9937464771 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java @@ -333,12 +333,12 @@ public static Capitalization1 getInstance() { return instance; } - public CapitalizationMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public CapitalizationMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -346,7 +346,7 @@ public CapitalizationMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java index 075caf00f66..16706d8c62f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java @@ -146,12 +146,12 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -159,7 +159,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -357,7 +357,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -365,7 +365,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -387,12 +387,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -400,7 +400,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java index c4f7236198e..107f01e5570 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java @@ -278,12 +278,12 @@ public static Category1 getInstance() { return instance; } - public CategoryMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public CategoryMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -291,7 +291,7 @@ public CategoryMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java index 9e87287b9f1..a5c84dbd0e9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java @@ -146,12 +146,12 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -159,7 +159,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -357,7 +357,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -365,7 +365,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -387,12 +387,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -400,7 +400,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java index b2814545e30..c534a812e84 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java @@ -255,7 +255,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -263,7 +263,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -285,12 +285,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public ClassModelMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ClassModelMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -298,7 +298,7 @@ public ClassModelMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java index 92cd2facd88..3dd614c3fea 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java @@ -143,12 +143,12 @@ public static Client1 getInstance() { return instance; } - public ClientMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ClientMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -156,7 +156,7 @@ public ClientMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java index 38aef21aa62..d89b0fc0cb3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java @@ -232,12 +232,12 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -245,7 +245,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -443,7 +443,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -451,7 +451,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -473,12 +473,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -486,7 +486,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java index 7691df34de1..ac5b7cc3be7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java @@ -262,7 +262,7 @@ public static Schema9 getInstance() { } @Override - public Schema9List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema9List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -270,7 +270,7 @@ public Schema9List getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -547,7 +547,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -555,7 +555,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -577,12 +577,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -590,7 +590,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java index b8014ee96c1..f08114ad244 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java @@ -144,7 +144,7 @@ public static ComposedArray1 getInstance() { } @Override - public ComposedArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ComposedArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -152,7 +152,7 @@ public ComposedArrayList getNewInstance(List arg, List pathToItem, Pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java index d9740ec68fb..a88b7268b30 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java @@ -75,12 +75,12 @@ public static ComposedObject1 getInstance() { return instance; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -88,7 +88,7 @@ public static ComposedObject1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java index 722bf7714e2..d3a6dcfaaa2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java @@ -91,12 +91,12 @@ public static Schema4 getInstance() { return instance; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -104,7 +104,7 @@ public static Schema4 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -269,7 +269,7 @@ public static Schema5 getInstance() { } @Override - public Schema5List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema5List getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -277,7 +277,7 @@ public Schema5List getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -554,7 +554,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -562,7 +562,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -584,12 +584,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -597,7 +597,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java index 410caa5986c..7c3806cc387 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java @@ -241,12 +241,12 @@ public static DanishPig1 getInstance() { return instance; } - public DanishPigMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public DanishPigMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -254,7 +254,7 @@ public DanishPigMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java index 1ad3b89b132..f8c08259e42 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java @@ -146,12 +146,12 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -159,7 +159,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -357,7 +357,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -365,7 +365,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -387,12 +387,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -400,7 +400,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java index 021e4bc7f39..1b3181e555b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java @@ -133,7 +133,7 @@ public static Shapes getInstance() { } @Override - public ShapesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ShapesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -141,12 +141,12 @@ public ShapesList getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((@Nullable Object) itemInstance); i += 1; @@ -593,12 +593,12 @@ public static Drawing1 getInstance() { return instance; } - public DrawingMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public DrawingMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -606,7 +606,7 @@ public DrawingMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java index 882a03cb729..0a70d911d91 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java @@ -284,7 +284,7 @@ public static ArrayEnum getInstance() { } @Override - public ArrayEnumList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayEnumList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -292,12 +292,12 @@ public ArrayEnumList getNewInstance(List arg, List pathToItem, PathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -479,12 +479,12 @@ public static EnumArrays1 getInstance() { return instance; } - public EnumArraysMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public EnumArraysMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -492,7 +492,7 @@ public EnumArraysMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java index 670eff44ebc..5ffb64a97c6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java @@ -1054,12 +1054,12 @@ public static EnumTest1 getInstance() { return instance; } - public EnumTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public EnumTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1067,7 +1067,7 @@ public EnumTestMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java index e438176362c..4978196ddae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java @@ -232,12 +232,12 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -245,7 +245,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -443,7 +443,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -451,7 +451,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -473,12 +473,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -486,7 +486,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java index 6581f02a84b..ee5d335ce25 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java @@ -145,12 +145,12 @@ public static File1 getInstance() { return instance; } - public FileMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FileMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,7 +158,7 @@ public FileMap getNewInstance(Map arg, List pathToItem, PathToSche Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java index cb909af4f07..194756a6aa6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java @@ -93,7 +93,7 @@ public static Files getInstance() { } @Override - public FilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -101,12 +101,12 @@ public FilesList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof File.FileMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((File.FileMap) itemInstance); i += 1; @@ -282,12 +282,12 @@ public static FileSchemaTestClass1 getInstance() { return instance; } - public FileSchemaTestClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FileSchemaTestClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -295,7 +295,7 @@ public FileSchemaTestClassMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java index 1013e5cbc55..b0e7360399a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java @@ -131,12 +131,12 @@ public static Foo1 getInstance() { return instance; } - public FooMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FooMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -144,7 +144,7 @@ public FooMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java index bcd62d370c5..3d410a64ade 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java @@ -600,7 +600,7 @@ public static ArrayWithUniqueItems getInstance() { } @Override - public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -608,12 +608,12 @@ public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToI itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -1975,12 +1975,12 @@ public static FormatTest1 getInstance() { return instance; } - public FormatTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FormatTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1988,7 +1988,7 @@ public FormatTestMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java index 328c8efd202..5e37b7fa644 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java @@ -200,12 +200,12 @@ public static FromSchema1 getInstance() { return instance; } - public FromSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FromSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -213,7 +213,7 @@ public FromSchemaMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java index 3366288e7af..c042a041623 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java @@ -267,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -275,7 +275,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -297,12 +297,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FruitMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FruitMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -310,7 +310,7 @@ public FruitMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java index cd38807b41f..f78fb8fc525 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java @@ -197,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -205,7 +205,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -227,12 +227,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -240,7 +240,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java index 233888ee187..fa8dc195b31 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java @@ -267,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -275,7 +275,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -297,12 +297,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -310,7 +310,7 @@ public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java index 6291e129f53..e5d9c3f63bc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java @@ -154,12 +154,12 @@ public static GrandparentAnimal1 getInstance() { return instance; } - public GrandparentAnimalMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public GrandparentAnimalMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -167,7 +167,7 @@ public GrandparentAnimalMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java index 2b28850201e..398c79c2729 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java @@ -181,12 +181,12 @@ public static HasOnlyReadOnly1 getInstance() { return instance; } - public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -194,7 +194,7 @@ public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java index 707d44abf15..329355cf688 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java @@ -240,12 +240,12 @@ public static HealthCheckResult1 getInstance() { return instance; } - public HealthCheckResultMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public HealthCheckResultMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -253,7 +253,7 @@ public HealthCheckResultMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java index 2166d96de66..24ae4b6f2d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java @@ -232,12 +232,12 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -245,7 +245,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -443,7 +443,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -451,7 +451,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -473,12 +473,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -486,7 +486,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java index f2c7b521a2c..84a1ccad6bb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java @@ -107,7 +107,7 @@ public static Items1 getInstance() { } @Override - public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ItemsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -115,12 +115,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((FrozenMap) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java index 7469d292e6c..52acd711ba4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java @@ -179,7 +179,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -187,7 +187,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -209,12 +209,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -222,7 +222,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -433,7 +433,7 @@ public static JSONPatchRequest1 getInstance() { } @Override - public JSONPatchRequestList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public JSONPatchRequestList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -441,7 +441,7 @@ public JSONPatchRequestList getNewInstance(List arg, List pathToItem, itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java index fff86cceaae..9545ebd840f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java @@ -457,12 +457,12 @@ public static JSONPatchRequestAddReplaceTest1 getInstance() { return instance; } - public JSONPatchRequestAddReplaceTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public JSONPatchRequestAddReplaceTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -470,7 +470,7 @@ public JSONPatchRequestAddReplaceTestMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java index 17cc84d0d8b..4ea6d40ed8f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java @@ -407,12 +407,12 @@ public static JSONPatchRequestMoveCopy1 getInstance() { return instance; } - public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -420,12 +420,12 @@ public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java index c07f8d6bbd4..0fabdb4d5b3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java @@ -307,12 +307,12 @@ public static JSONPatchRequestRemove1 getInstance() { return instance; } - public JSONPatchRequestRemoveMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public JSONPatchRequestRemoveMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -320,12 +320,12 @@ public JSONPatchRequestRemoveMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java index 57cdf3efd48..7aed72d332b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java @@ -185,7 +185,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -193,7 +193,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -215,12 +215,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -228,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java index 7cdf663dfd1..c5e4a22ab50 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java @@ -124,12 +124,12 @@ public static AdditionalProperties getInstance() { return instance; } - public AdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public AdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +137,12 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -267,12 +267,12 @@ public static MapMapOfString getInstance() { return instance; } - public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -280,12 +280,12 @@ public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof AdditionalPropertiesMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (AdditionalPropertiesMap) propertyInstance); } @@ -508,12 +508,12 @@ public static MapOfEnumString getInstance() { return instance; } - public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -521,12 +521,12 @@ public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -667,12 +667,12 @@ public static DirectMap getInstance() { return instance; } - public DirectMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public DirectMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -680,12 +680,12 @@ public DirectMapMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -916,12 +916,12 @@ public static MapTest1 getInstance() { return instance; } - public MapTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MapTestMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -929,7 +929,7 @@ public MapTestMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java index e8e63fdf231..e23bd7e93e7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java @@ -131,12 +131,12 @@ public static MapSchema getInstance() { return instance; } - public MapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -144,12 +144,12 @@ public MapMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Animal.AnimalMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Animal.AnimalMap) propertyInstance); } @@ -333,12 +333,12 @@ public static MixedPropertiesAndAdditionalPropertiesClass1 getInstance() { return instance; } - public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -346,7 +346,7 @@ public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map a Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java index dec0cec54ee..2662733c5c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java @@ -214,12 +214,12 @@ public static Money1 getInstance() { return instance; } - public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +227,7 @@ public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java index 67574dcfddb..7b31efab8a4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java @@ -142,12 +142,12 @@ public static MyObjectDto1 getInstance() { return instance; } - public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -155,12 +155,12 @@ public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, Pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java index 58f5c4a31b2..4b28c835523 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java @@ -366,7 +366,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -374,7 +374,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -396,12 +396,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public NameMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public NameMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -409,7 +409,7 @@ public NameMap getNewInstance(Map arg, List pathToItem, PathToSche Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java index 14440cb76b8..0a24dbf1e78 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java @@ -228,12 +228,12 @@ public static NoAdditionalProperties1 getInstance() { return instance; } - public NoAdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public NoAdditionalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -241,12 +241,12 @@ public NoAdditionalPropertiesMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java index 7a773c9f6db..7b0072832c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java @@ -87,12 +87,12 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -100,7 +100,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -892,7 +892,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public ArrayNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -900,12 +900,12 @@ public ArrayNullablePropList getNewInstance(List arg, List pathToItem itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((FrozenMap) itemInstance); i += 1; @@ -1011,12 +1011,12 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1024,7 +1024,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1172,7 +1172,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public ArrayAndItemsNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayAndItemsNullablePropList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable FrozenMap> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1180,12 +1180,12 @@ public ArrayAndItemsNullablePropList getNewInstance(List arg, List pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance == null || itemInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((@Nullable FrozenMap) itemInstance); i += 1; @@ -1291,12 +1291,12 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1304,7 +1304,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1431,7 +1431,7 @@ public static ArrayItemsNullable getInstance() { } @Override - public ArrayItemsNullableList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ArrayItemsNullableList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable FrozenMap> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -1439,12 +1439,12 @@ public ArrayItemsNullableList getNewInstance(List arg, List pathToIte itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance == null || itemInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((@Nullable FrozenMap) itemInstance); i += 1; @@ -1600,12 +1600,12 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public ObjectNullablePropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectNullablePropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap> properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1613,12 +1613,12 @@ public ObjectNullablePropMap getNewInstance(Map arg, List pathToIt Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (FrozenMap) propertyInstance); } @@ -1724,12 +1724,12 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1737,7 +1737,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1902,12 +1902,12 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap> properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1915,12 +1915,12 @@ public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance == null || propertyInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable FrozenMap) propertyInstance); } @@ -2026,12 +2026,12 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2039,7 +2039,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -2183,12 +2183,12 @@ public static ObjectItemsNullable getInstance() { return instance; } - public ObjectItemsNullableMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectItemsNullableMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap> properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2196,12 +2196,12 @@ public ObjectItemsNullableMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance == null || propertyInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable FrozenMap) propertyInstance); } @@ -2768,12 +2768,12 @@ public static NullableClass1 getInstance() { return instance; } - public NullableClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public NullableClassMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2781,12 +2781,12 @@ public NullableClassMap getNewInstance(Map arg, List pathToItem, P Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance == null || propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable Object) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java index 178ec5eb6e3..a9615b1b329 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java @@ -199,7 +199,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -207,7 +207,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -229,12 +229,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -242,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java index 852d158f3ea..b099c3fe847 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java @@ -161,12 +161,12 @@ public static NumberOnly1 getInstance() { return instance; } - public NumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public NumberOnlyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -174,7 +174,7 @@ public NumberOnlyMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java index 6bedbb1c726..4448b458f43 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java @@ -157,12 +157,12 @@ public static ObjWithRequiredProps1 getInstance() { return instance; } - public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -170,7 +170,7 @@ public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java index 256429d4d32..bf05915a73b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java @@ -154,12 +154,12 @@ public static ObjWithRequiredPropsBase1 getInstance() { return instance; } - public ObjWithRequiredPropsBaseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjWithRequiredPropsBaseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -167,7 +167,7 @@ public ObjWithRequiredPropsBaseMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java index 9c05ab18fb7..00c31269f82 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java @@ -217,12 +217,12 @@ public static ObjectModelWithArgAndArgsProperties1 getInstance() { return instance; } - public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,7 +230,7 @@ public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java index f88f2ae961d..382e0fe4cbe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java @@ -205,12 +205,12 @@ public static ObjectModelWithRefProps1 getInstance() { return instance; } - public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +218,7 @@ public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java index bc7bcb1186e..e86cf1c60cb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java @@ -232,12 +232,12 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -245,7 +245,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -443,7 +443,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -451,7 +451,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -473,12 +473,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -486,7 +486,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java index 025c5e10dc0..3e3ccfeccde 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java @@ -183,12 +183,12 @@ public static ObjectWithCollidingProperties1 getInstance() { return instance; } - public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -196,7 +196,7 @@ public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java index b1f22f6a0b6..c921349e4be 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java @@ -197,12 +197,12 @@ public static ObjectWithDecimalProperties1 getInstance() { return instance; } - public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -210,7 +210,7 @@ public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java index e2b8355cced..f2cbb823be3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java @@ -243,12 +243,12 @@ public static ObjectWithDifficultlyNamedProps1 getInstance() { return instance; } - public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -256,7 +256,7 @@ public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java index be226020f8e..45314759d3e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java @@ -249,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -257,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -279,12 +279,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -292,7 +292,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -539,12 +539,12 @@ public static ObjectWithInlineCompositionProperty1 getInstance() { return instance; } - public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -552,7 +552,7 @@ public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java index 203881b3dca..35f458b1588 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java @@ -186,12 +186,12 @@ public static ObjectWithInvalidNamedRefedProperties1 getInstance() { return instance; } - public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -199,7 +199,7 @@ public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(Map arg, Li Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java index 8d5653ec412..073d1570285 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java @@ -190,12 +190,12 @@ public static ObjectWithNonIntersectingValues1 getInstance() { return instance; } - public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -203,12 +203,12 @@ public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java index 33c292a9626..360071d246a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java @@ -205,12 +205,12 @@ public static ObjectWithOnlyOptionalProps1 getInstance() { return instance; } - public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,12 +218,12 @@ public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java index 12f5a077eb9..2a3cabf8336 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java @@ -143,12 +143,12 @@ public static ObjectWithOptionalTestProp1 getInstance() { return instance; } - public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -156,7 +156,7 @@ public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java index d0aa9f71d8a..6f6a5756e5e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java @@ -61,12 +61,12 @@ public static ObjectWithValidations1 getInstance() { return instance; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -74,7 +74,7 @@ public static ObjectWithValidations1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java index f0fb82e0ebe..9b742d2d11e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java @@ -470,12 +470,12 @@ public static Order1 getInstance() { return instance; } - public OrderMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public OrderMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -483,7 +483,7 @@ public OrderMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java index 20f6c839f5f..b79983b393a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java @@ -118,7 +118,7 @@ public static Results getInstance() { } @Override - public ResultsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ResultsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -126,12 +126,12 @@ public ResultsList getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof MyObjectDto.MyObjectDtoMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((MyObjectDto.MyObjectDtoMap) itemInstance); i += 1; @@ -350,12 +350,12 @@ public static PaginatedResultMyObjectDto1 getInstance() { return instance; } - public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -363,12 +363,12 @@ public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java index 8114db70884..c7657dacbc2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java @@ -63,12 +63,12 @@ public static ParentPet1 getInstance() { return instance; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -76,7 +76,7 @@ public static ParentPet1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java index b177ceca11c..9c6579408a9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java @@ -132,7 +132,7 @@ public static PhotoUrls getInstance() { } @Override - public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -140,12 +140,12 @@ public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -347,7 +347,7 @@ public static Tags getInstance() { } @Override - public TagsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public TagsList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -355,12 +355,12 @@ public TagsList getNewInstance(List arg, List pathToItem, PathToSchem itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Tag.TagMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Tag.TagMap) itemInstance); i += 1; @@ -707,12 +707,12 @@ public static Pet1 getInstance() { return instance; } - public PetMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PetMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -720,7 +720,7 @@ public PetMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java index 343e8ad49aa..4aeeeeae89a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java @@ -184,7 +184,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -192,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -214,12 +214,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java index 97db74cae6b..cbdb7de501d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java @@ -172,12 +172,12 @@ public static Player1 getInstance() { return instance; } - public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -185,7 +185,7 @@ public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java index d041df32906..9db40f3ec54 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java @@ -145,12 +145,12 @@ public static PublicKey1 getInstance() { return instance; } - public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,7 +158,7 @@ public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java index 03a218aa723..4094fef6bf6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java @@ -184,7 +184,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -192,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -214,12 +214,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java index 835ecb35680..32bb7a8d052 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java @@ -424,7 +424,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -432,7 +432,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -454,12 +454,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public QuadrilateralInterfaceMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QuadrilateralInterfaceMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -467,7 +467,7 @@ public QuadrilateralInterfaceMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java index d63f2433bba..45bc074f188 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java @@ -181,12 +181,12 @@ public static ReadOnlyFirst1 getInstance() { return instance; } - public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -194,7 +194,7 @@ public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, P Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java index 9cc070d0913..e52f77dea43 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java @@ -206,12 +206,12 @@ public static ReqPropsFromExplicitAddProps1 getInstance() { return instance; } - public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,12 +219,12 @@ public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java index 19f0a4ebe2e..f677852ed61 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java @@ -358,12 +358,12 @@ public static ReqPropsFromTrueAddProps1 getInstance() { return instance; } - public ReqPropsFromTrueAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ReqPropsFromTrueAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -371,7 +371,7 @@ public ReqPropsFromTrueAddPropsMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java index da77d50c61f..f0d292f3a04 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java @@ -277,12 +277,12 @@ public static ReqPropsFromUnsetAddProps1 getInstance() { return instance; } - public ReqPropsFromUnsetAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ReqPropsFromUnsetAddPropsMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -290,7 +290,7 @@ public ReqPropsFromUnsetAddPropsMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java index 2a7b44c41cb..f65427d6d87 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java @@ -261,7 +261,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -269,7 +269,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -291,12 +291,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -304,7 +304,7 @@ public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java index c390a495cc2..539520aa1b5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java @@ -232,12 +232,12 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -245,7 +245,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -443,7 +443,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -451,7 +451,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -473,12 +473,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -486,7 +486,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java index 22e33bdc301..1b4a243c18e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java @@ -300,7 +300,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -308,7 +308,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -330,12 +330,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public Schema200ResponseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema200ResponseMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -343,7 +343,7 @@ public Schema200ResponseMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java index a435e54b997..41d45a8f80a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java @@ -92,7 +92,7 @@ public static SelfReferencingArrayModel1 getInstance() { } @Override - public SelfReferencingArrayModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SelfReferencingArrayModelList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -100,12 +100,12 @@ public SelfReferencingArrayModelList getNewInstance(List arg, List pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof SelfReferencingArrayModelList)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((SelfReferencingArrayModelList) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java index 662e69677f5..d9bd79bd27a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java @@ -148,12 +148,12 @@ public static SelfReferencingObjectModel1 getInstance() { return instance; } - public SelfReferencingObjectModelMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SelfReferencingObjectModelMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -161,7 +161,7 @@ public SelfReferencingObjectModelMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java index 8eb367499ec..779e998a8c1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java @@ -184,7 +184,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -192,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -214,12 +214,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java index 4448d1887ae..2729d70eed9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java @@ -199,7 +199,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -207,7 +207,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -229,12 +229,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -242,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java index bb4a854e97e..effce3a4770 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java @@ -232,12 +232,12 @@ public static Schema1 getInstance() { return instance; } - public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Schema1Map getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -245,7 +245,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -443,7 +443,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -451,7 +451,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -473,12 +473,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -486,7 +486,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java index ab31049b44b..dd7926edc2d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java @@ -183,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -191,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -213,12 +213,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java index d15299b5728..448ee5e4b07 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java @@ -145,12 +145,12 @@ public static SpecialModelname1 getInstance() { return instance; } - public SpecialModelnameMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SpecialModelnameMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,7 +158,7 @@ public SpecialModelnameMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java index 5ef216f647b..0989bf0ddda 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java @@ -128,12 +128,12 @@ public static StringBooleanMap1 getInstance() { return instance; } - public StringBooleanMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public StringBooleanMapMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -141,12 +141,12 @@ public StringBooleanMapMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java index c7cbcff1620..3214bd7734a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java @@ -200,12 +200,12 @@ public static Tag1 getInstance() { return instance; } - public TagMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public TagMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -213,7 +213,7 @@ public TagMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java index d11963015ad..40dc603a6d2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java @@ -185,7 +185,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -193,7 +193,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -215,12 +215,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -228,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java index bc1370dd219..9725d699b63 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java @@ -424,7 +424,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -432,7 +432,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -454,12 +454,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public TriangleInterfaceMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public TriangleInterfaceMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -467,7 +467,7 @@ public TriangleInterfaceMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java index cafdf7f607a..51f53741963 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java @@ -191,12 +191,12 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castArg; } - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -204,7 +204,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -425,7 +425,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -433,7 +433,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -455,12 +455,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -468,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1164,12 +1164,12 @@ public static User1 getInstance() { return instance; } - public UserMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public UserMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1177,7 +1177,7 @@ public UserMap getNewInstance(Map arg, List pathToItem, PathToSche Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java index 644000077c5..9fef2af94b7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java @@ -319,12 +319,12 @@ public static Whale1 getInstance() { return instance; } - public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -332,7 +332,7 @@ public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java index 29971debaf0..b88839eb52e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java @@ -449,12 +449,12 @@ public static Zebra1 getInstance() { return instance; } - public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -462,7 +462,7 @@ public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java index ab0a17c080c..0a17c8a0067 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java @@ -125,12 +125,12 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +138,12 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java index fe5073c471f..19056bb872c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java @@ -145,12 +145,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,12 +158,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java index dac009a0806..9c5666e0624 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java @@ -145,12 +145,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,12 +158,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java index f69c62b3fe2..216c492cb93 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java @@ -125,12 +125,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +138,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java index a79332aaaf9..afd2bcf3c2c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java @@ -125,12 +125,12 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +138,12 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java index 8ad5f97481c..4343e4104c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java @@ -145,12 +145,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,12 +158,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java index ee70bd6aec3..5f52183686d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java @@ -183,12 +183,12 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -196,7 +196,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java index 0f27ade6250..2991469de71 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java @@ -288,12 +288,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -301,7 +301,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java index ef0cb9a208a..b71ea0be06d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java @@ -165,12 +165,12 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -178,7 +178,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java index 34c29309fb1..c6b377a4aa3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java @@ -281,12 +281,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -294,7 +294,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java index 7a815af8548..7877cea7383 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java @@ -193,7 +193,7 @@ public static Schema01 getInstance() { } @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -201,12 +201,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java index db6a76de965..91a6dd71d79 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java @@ -193,7 +193,7 @@ public static Schema21 getInstance() { } @Override - public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -201,12 +201,12 @@ public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index dc6ec8a6768..bc9b15c2fb7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -201,7 +201,7 @@ public static ApplicationxwwwformurlencodedEnumFormStringArray getInstance() { } @Override - public ApplicationxwwwformurlencodedEnumFormStringArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationxwwwformurlencodedEnumFormStringArrayList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -209,12 +209,12 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList getNewInstance(List< itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -490,12 +490,12 @@ public static ApplicationxwwwformurlencodedSchema1 getInstance() { return instance; } - public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +503,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index f3b533299f1..ab8c8078ff7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -1528,12 +1528,12 @@ public static ApplicationxwwwformurlencodedSchema1 getInstance() { return instance; } - public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1541,7 +1541,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java index b2b28b70d38..c715a4f3feb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java @@ -139,12 +139,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -152,12 +152,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java index eb7095f4ad9..74415fccb0e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java @@ -280,12 +280,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -293,7 +293,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java index 1c0eda6e495..e8b0b30486f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java @@ -139,12 +139,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -152,12 +152,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 46aab8874df..3aa072a178e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -117,12 +117,12 @@ public static ApplicationjsonSchema1 getInstance() { return instance; } - public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -130,12 +130,12 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java index ea9b8960d9d..44c40711409 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java @@ -207,12 +207,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -220,7 +220,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java index a48102a168b..de3f1645ab5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java @@ -247,7 +247,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -255,7 +255,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -277,12 +277,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -290,7 +290,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java index 33ed9d69ac0..90abc08fe80 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java @@ -249,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -257,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -279,12 +279,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -292,7 +292,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -533,12 +533,12 @@ public static Schema11 getInstance() { return instance; } - public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -546,7 +546,7 @@ public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index e978ccbf3ff..46c3d962eec 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -247,7 +247,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -255,7 +255,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -277,12 +277,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -290,7 +290,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index b9b6b89693f..c2b47e74ae8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -249,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -257,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -279,12 +279,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -292,7 +292,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -533,12 +533,12 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -546,7 +546,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java index be27f64ddfe..368e9926328 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java @@ -247,7 +247,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -255,7 +255,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -277,12 +277,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -290,7 +290,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java index 4a5cc0ede82..6e059c1c243 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java @@ -249,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -257,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -279,12 +279,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -292,7 +292,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -533,12 +533,12 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -546,7 +546,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index fe741053964..0ee4f6f3822 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -211,12 +211,12 @@ public static ApplicationxwwwformurlencodedSchema1 getInstance() { return instance; } - public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index f9c2b501627..d04680f12fe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -137,12 +137,12 @@ public static ApplicationjsonSchema1 getInstance() { return instance; } - public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -150,7 +150,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 50a0b670610..beded918eb5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -137,12 +137,12 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -150,7 +150,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java index 0c5c39b4fd3..e6047ac94f3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java @@ -125,12 +125,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +138,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Schema0.SchemaMap0)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Schema0.SchemaMap0) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java index cdfc92cf274..e4e05bc3513 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java @@ -137,12 +137,12 @@ public static Schema01 getInstance() { return instance; } - public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -150,7 +150,7 @@ public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java index 3ca2d82179a..64e8baf5ec2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java @@ -223,12 +223,12 @@ public static CookieParameters1 getInstance() { return instance; } - public CookieParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public CookieParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +236,7 @@ public CookieParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java index 26f10242116..0ccc38aa329 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java @@ -195,12 +195,12 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -208,7 +208,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java index 13b3affb6b2..450bddf5c7f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java @@ -756,12 +756,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -769,7 +769,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java index 77b7396eaa8..f8746a63d7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java @@ -223,12 +223,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +236,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java index d83883f9f44..4650cb249e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java @@ -157,12 +157,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -170,12 +170,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 923f865e375..4df6e40118d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -188,12 +188,12 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -201,7 +201,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java index 80a2d4a1d9e..ab99f6ce11b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java @@ -187,12 +187,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -200,12 +200,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable Object) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java index 4f9e9dcdb6e..8155138307f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java @@ -125,12 +125,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +138,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Foo.FooMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Foo.FooMap) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java index 3ddfd5cebc9..d8af6eeb999 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java @@ -1452,12 +1452,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1465,7 +1465,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java index 60cd2bbf362..7b061edc762 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java @@ -97,7 +97,7 @@ public static Schema01 getInstance() { } @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -105,12 +105,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java index b479849b2a5..54504cc58fc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java @@ -97,7 +97,7 @@ public static Schema11 getInstance() { } @Override - public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -105,12 +105,12 @@ public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java index 790a4dca1ab..c116051222c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java @@ -97,7 +97,7 @@ public static Schema21 getInstance() { } @Override - public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -105,12 +105,12 @@ public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java index dd6756603ef..829105e85f0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java @@ -97,7 +97,7 @@ public static Schema31 getInstance() { } @Override - public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -105,12 +105,12 @@ public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java index 8d76c891243..ea2fb8eba3e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java @@ -97,7 +97,7 @@ public static Schema41 getInstance() { } @Override - public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -105,12 +105,12 @@ public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 00f58bea03b..a0425ceb750 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -188,12 +188,12 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -201,7 +201,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 874a22b3304..031ea0b94b7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -106,7 +106,7 @@ public static MultipartformdataFiles getInstance() { } @Override - public MultipartformdataFilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MultipartformdataFilesList getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -114,12 +114,12 @@ public MultipartformdataFilesList getNewInstance(List arg, List pathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -262,12 +262,12 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -275,7 +275,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java index 177e9768dda..ffea94436a0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java @@ -116,12 +116,12 @@ public static ApplicationjsonSchema1 getInstance() { return instance; } - public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -129,7 +129,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java index a30a5663e29..52af34cc473 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java @@ -247,12 +247,12 @@ public static Variables1 getInstance() { return instance; } - public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -260,12 +260,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java index be90b02fb0a..e188aae0e45 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java @@ -140,12 +140,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -153,12 +153,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Schema0.SchemaList0)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Schema0.SchemaList0) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java index e58039f9a33..55b88271f9a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java @@ -195,7 +195,7 @@ public static Schema01 getInstance() { } @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -203,12 +203,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java index 559108d075b..e2a6ce3b959 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java @@ -247,12 +247,12 @@ public static Variables1 getInstance() { return instance; } - public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -260,12 +260,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java index faa04d0a390..52b07f074aa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java @@ -140,12 +140,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -153,12 +153,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Schema0.SchemaList0)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Schema0.SchemaList0) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java index 853c76678b1..16f731c1429 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java @@ -97,7 +97,7 @@ public static Schema01 getInstance() { } @Override - public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -105,12 +105,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java index 8f25fc6c813..a207c53c215 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java @@ -125,12 +125,12 @@ public static HeaderParameters1 getInstance() { return instance; } - public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public HeaderParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +138,12 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java index 72534b1f2c9..df6d9991ae2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java @@ -157,12 +157,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -170,12 +170,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java index 1f36d797c57..ac27819852a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java @@ -157,12 +157,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -170,12 +170,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java index d4497aa16c2..88a8b33d08c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java @@ -157,12 +157,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -170,12 +170,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 27582e1c7fc..f2f9c9d93b8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -175,12 +175,12 @@ public static ApplicationxwwwformurlencodedSchema1 getInstance() { return instance; } - public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -188,7 +188,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java index 2642b75cf4c..38190c56768 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java @@ -157,12 +157,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -170,12 +170,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 0346cd58bb7..3117506337a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -176,12 +176,12 @@ public static MultipartformdataSchema1 getInstance() { return instance; } - public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public MultipartformdataSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -189,7 +189,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java index 89a021814a9..d98ac41b8b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java @@ -139,12 +139,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -152,12 +152,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java index 98fbf638ab6..33041924c97 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java @@ -157,12 +157,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -170,12 +170,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java index 6eafd665e9a..7c277bdacae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java @@ -192,12 +192,12 @@ public static QueryParameters1 getInstance() { return instance; } - public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public QueryParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -205,7 +205,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java index 43728e2c52f..06c0b7c5381 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java @@ -326,12 +326,12 @@ public static Code200ResponseHeadersSchema1 getInstance() { return instance; } - public Code200ResponseHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public Code200ResponseHeadersSchemaMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -339,7 +339,7 @@ public Code200ResponseHeadersSchemaMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java index 2044250089f..42dfdb96d92 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java @@ -139,12 +139,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -152,12 +152,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java index 1ae45c9d19a..f452c04ff53 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java @@ -139,12 +139,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -152,12 +152,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java index e19e97b5348..694e78fc7a5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java @@ -139,12 +139,12 @@ public static PathParameters1 getInstance() { return instance; } - public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public PathParametersMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -152,12 +152,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index 962157dbcc6..6bc6fe04985 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -162,7 +162,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -170,7 +170,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -192,12 +192,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -205,7 +205,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -226,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -241,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java index f8b78b08c09..a5e697bc7e1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java @@ -55,12 +55,12 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index 8b367834de7..bc63f4a4bcb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -62,11 +62,11 @@ public String validate(LocalDate arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java index cafbebb9017..04afec44e81 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java @@ -62,11 +62,11 @@ public String validate(ZonedDateTime arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java index 65b957698bc..053ed1d9194 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java @@ -57,11 +57,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java index 751e2f4d353..30409a5bfa0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java @@ -61,11 +61,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java index 7c8ddfa15f1..b06048101bd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java @@ -61,11 +61,11 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java index 384f09f1796..0007819ca43 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java @@ -68,11 +68,11 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java index 1ce24379e6a..ab1735795d1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java @@ -78,11 +78,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java index fdb1ce8d6a4..16a442386f2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java @@ -78,11 +78,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index 565ac49ef93..ee185d63dd7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -48,7 +48,7 @@ public static ListJsonSchema1 getInstance() { } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -56,7 +56,7 @@ public static ListJsonSchema1 getInstance() { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index 16a084a6a07..e397fcadc47 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -49,12 +49,12 @@ public static MapJsonSchema1 getInstance() { } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -62,7 +62,7 @@ public static MapJsonSchema1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -82,11 +82,11 @@ public static MapJsonSchema1 getInstance() { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index e084922a19f..1135409baef 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -164,7 +164,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -172,7 +172,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -194,12 +194,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -207,7 +207,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -243,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java index ae78802e2fe..483996081d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java @@ -56,11 +56,11 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java index d8d31a8e9e4..d5650985076 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java @@ -77,11 +77,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java index fad38a479cc..d200689b1f5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java @@ -70,11 +70,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java index b03821b3be8..85b94ee2403 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java @@ -62,11 +62,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index 5c34105ded0..d6f5cdab7b7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -221,7 +221,7 @@ protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { this.keywordToValidator = keywordToValidator; } - public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; + public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas); public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index f336ac80c0d..f5604144fe7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -149,7 +149,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -157,7 +157,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -179,12 +179,12 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -192,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -213,7 +213,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -228,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java index 35fd95d31c3..6108ede4c5b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java @@ -405,12 +405,12 @@ public static Variables1 getInstance() { return instance; } - public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -418,12 +418,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java index 09b5f3bbd7b..8c16e0c9e5b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java @@ -247,12 +247,12 @@ public static Variables1 getInstance() { return instance; } - public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public VariablesMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -260,12 +260,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java index d4ba032bc5f..46e651edc69 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index a89372b77a4..e04fe979f77 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -15,12 +15,12 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat {{/eq}} {{#eq this "object"}} -public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<@Nullable Object>{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { +public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<@Nullable Object>{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -28,7 +28,7 @@ public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}} Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -37,7 +37,7 @@ public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}} properties.put(propertyName, propertyInstance); {{else}} if (!({{#contains ../mapValueSchema.types "null" }}propertyInstance == null || {{/contains}}propertyInstance instanceof {{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, ({{#with ../mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) propertyInstance); {{/if}} @@ -67,7 +67,7 @@ public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}} {{#eq this "array"}} @Override -public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { +public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -75,7 +75,7 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -84,7 +84,7 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCa items.add(itemInstance); {{else}} if (!({{#contains ../listItemSchema.types "null" }}itemInstance == null || {{/contains}}itemInstance instanceof {{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add(({{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) itemInstance); {{/if}} @@ -324,7 +324,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override -public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { +public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -332,7 +332,7 @@ public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{ itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -341,7 +341,7 @@ public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{ items.add(itemInstance); {{else}} if (!({{#contains listItemSchema.types "null" }}itemInstance == null || {{/contains}}itemInstance instanceof {{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add(({{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) itemInstance); {{/if}} @@ -369,12 +369,12 @@ public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{ } @Override -public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { +public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}> properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -382,7 +382,7 @@ public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -391,7 +391,7 @@ public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else properties.put(propertyName, propertyInstance); {{else}} if (!({{#contains mapValueSchema.types "null" }}propertyInstance == null || {{/contains}}propertyInstance instanceof {{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Object{{/with}})) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, ({{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}) propertyInstance); {{/if}} diff --git a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs index 7b1694812d8..80ad87837f7 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs @@ -162,7 +162,7 @@ public class AnyTypeJsonSchema { } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -170,7 +170,7 @@ public class AnyTypeJsonSchema { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -192,12 +192,12 @@ public class AnyTypeJsonSchema { } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -205,7 +205,7 @@ public class AnyTypeJsonSchema { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -226,7 +226,7 @@ public class AnyTypeJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -241,7 +241,7 @@ public class AnyTypeJsonSchema { } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs index 3540f718fa5..b82c4f320a9 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs @@ -55,12 +55,12 @@ public class BooleanJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs index 74632ff6940..4954a6f821f 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs @@ -62,11 +62,11 @@ public class DateJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs index 62b4823fae6..2eea7f7903f 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs @@ -62,11 +62,11 @@ public class DateTimeJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs index d8c618945c5..7364ba1596b 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs @@ -57,11 +57,11 @@ public class DecimalJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs index 9149940ca6e..895752167b7 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs @@ -61,11 +61,11 @@ public class DoubleJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs index ed4d2e39fff..cc403ac2715 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs @@ -61,11 +61,11 @@ public class FloatJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs index a6a0fd8b1fd..34e3ec48df8 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs @@ -68,11 +68,11 @@ public class Int32JsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs index d81bf7853e5..6d9090aebad 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs @@ -78,11 +78,11 @@ public class Int64JsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs index 5df7c400271..d8c9b1dd289 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs @@ -78,11 +78,11 @@ public class IntJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs index 740968e12a8..13c3a210f44 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs @@ -48,7 +48,7 @@ public class ListJsonSchema { } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -56,7 +56,7 @@ public class ListJsonSchema { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); diff --git a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs index 7fd6e414867..680564ffbe7 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs @@ -49,12 +49,12 @@ public class MapJsonSchema { } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -62,7 +62,7 @@ public class MapJsonSchema { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -82,11 +82,11 @@ public class MapJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs index 50144c10d6e..027294a551c 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -164,7 +164,7 @@ public class NotAnyTypeJsonSchema { } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -172,7 +172,7 @@ public class NotAnyTypeJsonSchema { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -194,12 +194,12 @@ public class NotAnyTypeJsonSchema { } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -207,7 +207,7 @@ public class NotAnyTypeJsonSchema { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +228,7 @@ public class NotAnyTypeJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -243,7 +243,7 @@ public class NotAnyTypeJsonSchema { } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs index 4690c66f136..20d551fb293 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs @@ -56,11 +56,11 @@ public class NullJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs index 4d2cefacd9d..7bbd3a65aa4 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs @@ -77,11 +77,11 @@ public class NumberJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs index 9d3face2485..a0b8052ecd2 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs @@ -70,11 +70,11 @@ public class StringJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs index 12757a78386..8e69aad0ef4 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs @@ -62,11 +62,11 @@ public class UuidJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs index c6960a075ab..135052bac15 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs @@ -221,7 +221,7 @@ public abstract class JsonSchema { this.keywordToValidator = keywordToValidator; } - public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; + public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas); public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index a1a444554c2..e19139dd7a0 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -149,7 +149,7 @@ public class UnsetAnyTypeJsonSchema { } @Override - public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenList<@Nullable Object> getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) { List<@Nullable Object> items = new ArrayList<>(); int i = 0; for (Object item: arg) { @@ -157,7 +157,7 @@ public class UnsetAnyTypeJsonSchema { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -179,12 +179,12 @@ public class UnsetAnyTypeJsonSchema { } @Override - public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public FrozenMap<@Nullable Object> getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -192,7 +192,7 @@ public class UnsetAnyTypeJsonSchema { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -213,7 +213,7 @@ public class UnsetAnyTypeJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -228,7 +228,7 @@ public class UnsetAnyTypeJsonSchema { } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override From 85fd44c14a70f29dee1d052c0653495b86dac4da Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 13:52:36 -0700 Subject: [PATCH 27/53] Fixes java tests in schema validation package --- .../AdditionalPropertiesValidatorTest.java | 6 ++-- .../validation/FormatValidatorTest.java | 28 +++++++++---------- .../validation/ItemsValidatorTest.java | 6 ++-- .../schemas/validation/JsonSchemaTest.java | 4 +-- .../validation/PropertiesValidatorTest.java | 6 ++-- .../validation/RequiredValidatorTest.java | 6 ++-- .../schemas/validation/TypeValidatorTest.java | 2 +- .../AdditionalPropertiesValidatorTest.hbs | 7 +++-- .../validation/FormatValidatorTest.hbs | 28 +++++++++---------- .../schemas/validation/ItemsValidatorTest.hbs | 6 ++-- .../schemas/validation/JsonSchemaTest.hbs | 4 +-- .../validation/PropertiesValidatorTest.hbs | 6 ++-- .../validation/RequiredValidatorTest.hbs | 6 ++-- .../schemas/validation/TypeValidatorTest.hbs | 2 +- 14 files changed, 59 insertions(+), 58 deletions(-) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java index 40a01c9983d..c3d2670bbe6 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java @@ -46,7 +46,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -70,7 +70,7 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -105,7 +105,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java index 1481f312f6a..cb03bcf8f5b 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java @@ -34,7 +34,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testIntFormatSucceedsWithFloat() { + public void testIntFormatSucceedsWithFloat() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -59,7 +59,7 @@ public void testIntFormatFailsWithFloat() { } @Test - public void testIntFormatSucceedsWithInt() { + public void testIntFormatSucceedsWithInt() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -84,7 +84,7 @@ public void testInt32UnderMinFails() { } @Test - public void testInt32InclusiveMinSucceeds() { + public void testInt32InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -97,7 +97,7 @@ public void testInt32InclusiveMinSucceeds() { } @Test - public void testInt32InclusiveMaxSucceeds() { + public void testInt32InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -135,7 +135,7 @@ public void testInt64UnderMinFails() { } @Test - public void testInt64InclusiveMinSucceeds() { + public void testInt64InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -148,7 +148,7 @@ public void testInt64InclusiveMinSucceeds() { } @Test - public void testInt64InclusiveMaxSucceeds() { + public void testInt64InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -186,7 +186,7 @@ public void testFloatUnderMinFails() { } @Test - public void testFloatInclusiveMinSucceeds() { + public void testFloatInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -199,7 +199,7 @@ public void testFloatInclusiveMinSucceeds() { } @Test - public void testFloatInclusiveMaxSucceeds() { + public void testFloatInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -236,7 +236,7 @@ public void testDoubleUnderMinFails() { } @Test - public void testDoubleInclusiveMinSucceeds() { + public void testDoubleInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -249,7 +249,7 @@ public void testDoubleInclusiveMinSucceeds() { } @Test - public void testDoubleInclusiveMaxSucceeds() { + public void testDoubleInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -286,7 +286,7 @@ public void testInvalidNumberStringFails() { } @Test - public void testValidFloatNumberStringSucceeds() { + public void testValidFloatNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -299,7 +299,7 @@ public void testValidFloatNumberStringSucceeds() { } @Test - public void testValidIntNumberStringSucceeds() { + public void testValidIntNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -324,7 +324,7 @@ public void testInvalidDateStringFails() { } @Test - public void testValidDateStringSucceeds() { + public void testValidDateStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -349,7 +349,7 @@ public void testInvalidDateTimeStringFails() { } @Test - public void testValidDateTimeStringSucceeds() { + public void testValidDateTimeStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java index e0e4a0c859e..6299f5e6ef2 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java @@ -37,7 +37,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List listArg) { return getNewInstance(listArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -55,7 +55,7 @@ public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConf } @Test - public void testCorrectItemsSucceeds() { + public void testCorrectItemsSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -89,7 +89,7 @@ public void testCorrectItemsSucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java index 8a14df7edd6..7a8578bae93 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java @@ -40,7 +40,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof String) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -58,7 +58,7 @@ public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java index 492f45af0c7..19d8a475edd 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java @@ -36,7 +36,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -59,7 +59,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( @@ -92,7 +92,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java index 65ff030d74b..221050d9e82 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java @@ -32,7 +32,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -55,7 +55,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -78,7 +78,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java index ebc8bbff1f5..c31855af4ff 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java @@ -18,7 +18,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { final TypeValidator validator = new TypeValidator(); ValidationMetadata validationMetadata = new ValidationMetadata( new ArrayList<>(), diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs index 88cbb7d6150..38a8f4e7325 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs @@ -6,6 +6,7 @@ import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.MapJsonSchema; import {{{packageName}}}.schemas.StringJsonSchema; import {{{packageName}}}.exceptions.ValidationException; @@ -46,7 +47,7 @@ public class AdditionalPropertiesValidatorTest { if (arg instanceof Map) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -70,7 +71,7 @@ public class AdditionalPropertiesValidatorTest { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -105,7 +106,7 @@ public class AdditionalPropertiesValidatorTest { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/FormatValidatorTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/FormatValidatorTest.hbs index 237027f490c..1bc43ac90fe 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/FormatValidatorTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/FormatValidatorTest.hbs @@ -34,7 +34,7 @@ public class FormatValidatorTest { } @Test - public void testIntFormatSucceedsWithFloat() { + public void testIntFormatSucceedsWithFloat() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -59,7 +59,7 @@ public class FormatValidatorTest { } @Test - public void testIntFormatSucceedsWithInt() { + public void testIntFormatSucceedsWithInt() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -84,7 +84,7 @@ public class FormatValidatorTest { } @Test - public void testInt32InclusiveMinSucceeds() { + public void testInt32InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -97,7 +97,7 @@ public class FormatValidatorTest { } @Test - public void testInt32InclusiveMaxSucceeds() { + public void testInt32InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -135,7 +135,7 @@ public class FormatValidatorTest { } @Test - public void testInt64InclusiveMinSucceeds() { + public void testInt64InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -148,7 +148,7 @@ public class FormatValidatorTest { } @Test - public void testInt64InclusiveMaxSucceeds() { + public void testInt64InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -186,7 +186,7 @@ public class FormatValidatorTest { } @Test - public void testFloatInclusiveMinSucceeds() { + public void testFloatInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -199,7 +199,7 @@ public class FormatValidatorTest { } @Test - public void testFloatInclusiveMaxSucceeds() { + public void testFloatInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -236,7 +236,7 @@ public class FormatValidatorTest { } @Test - public void testDoubleInclusiveMinSucceeds() { + public void testDoubleInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -249,7 +249,7 @@ public class FormatValidatorTest { } @Test - public void testDoubleInclusiveMaxSucceeds() { + public void testDoubleInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -286,7 +286,7 @@ public class FormatValidatorTest { } @Test - public void testValidFloatNumberStringSucceeds() { + public void testValidFloatNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -299,7 +299,7 @@ public class FormatValidatorTest { } @Test - public void testValidIntNumberStringSucceeds() { + public void testValidIntNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -324,7 +324,7 @@ public class FormatValidatorTest { } @Test - public void testValidDateStringSucceeds() { + public void testValidDateStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -349,7 +349,7 @@ public class FormatValidatorTest { } @Test - public void testValidDateTimeStringSucceeds() { + public void testValidDateTimeStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/ItemsValidatorTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/ItemsValidatorTest.hbs index af2b41c10ac..268ecce8dca 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/ItemsValidatorTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/ItemsValidatorTest.hbs @@ -37,7 +37,7 @@ public class ItemsValidatorTest { if (arg instanceof List listArg) { return getNewInstance(listArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -55,7 +55,7 @@ public class ItemsValidatorTest { } @Test - public void testCorrectItemsSucceeds() { + public void testCorrectItemsSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -89,7 +89,7 @@ public class ItemsValidatorTest { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs index be5faa5e9c8..2870c89a872 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs @@ -40,7 +40,7 @@ public class JsonSchemaTest { if (arg instanceof String) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -58,7 +58,7 @@ public class JsonSchemaTest { } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/PropertiesValidatorTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/PropertiesValidatorTest.hbs index de7a97379fc..e3821be2966 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/PropertiesValidatorTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/PropertiesValidatorTest.hbs @@ -36,7 +36,7 @@ public class PropertiesValidatorTest { if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -59,7 +59,7 @@ public class PropertiesValidatorTest { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( @@ -92,7 +92,7 @@ public class PropertiesValidatorTest { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/RequiredValidatorTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/RequiredValidatorTest.hbs index 491a7affc7f..d8fddba015d 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/RequiredValidatorTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/RequiredValidatorTest.hbs @@ -32,7 +32,7 @@ public class RequiredValidatorTest { if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -55,7 +55,7 @@ public class RequiredValidatorTest { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -78,7 +78,7 @@ public class RequiredValidatorTest { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/TypeValidatorTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/TypeValidatorTest.hbs index f345f43c2ce..98a9de31eca 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/TypeValidatorTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/TypeValidatorTest.hbs @@ -18,7 +18,7 @@ public class TypeValidatorTest { } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { final TypeValidator validator = new TypeValidator(); ValidationMetadata validationMetadata = new ValidationMetadata( new ArrayList<>(), From 5f9571b1a2ebfca0b723a9291fd1bf36af46e809 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 14:00:35 -0700 Subject: [PATCH 28/53] Fixes anytype and array type schema tests --- .../client/schemas/AnyTypeSchemaTest.java | 24 ++++++++++--------- .../client/schemas/ArrayTypeSchemaTest.java | 18 +++++++------- .../packagename/schemas/AnyTypeSchemaTest.hbs | 24 ++++++++++--------- .../schemas/ArrayTypeSchemaTest.hbs | 18 +++++++------- 4 files changed, 44 insertions(+), 40 deletions(-) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java index 9b76ff56c45..3a066958ffe 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java @@ -5,6 +5,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -26,13 +28,13 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testValidateNull() { + public void testValidateNull() throws ValidationException, InvalidTypeException { Void validatedValue = schema.validate((Void) null, configuration); assertNull(validatedValue); } @Test - public void testValidateBoolean() { + public void testValidateBoolean() throws ValidationException, InvalidTypeException { boolean trueValue = schema.validate(true, configuration); Assert.assertTrue(trueValue); @@ -41,49 +43,49 @@ public void testValidateBoolean() { } @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException, InvalidTypeException { int validatedValue = schema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException, InvalidTypeException { long validatedValue = schema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException, InvalidTypeException { float validatedValue = schema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException, InvalidTypeException { double validatedValue = schema.validate(70.6458763d, configuration); Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); } @Test - public void testValidateString() { + public void testValidateString() throws ValidationException, InvalidTypeException { String validatedValue = schema.validate("a", configuration); Assert.assertEquals(validatedValue, "a"); } @Test - public void testValidateZonedDateTime() { + public void testValidateZonedDateTime() throws ValidationException, InvalidTypeException { String validatedValue = schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration); Assert.assertEquals(validatedValue, "2017-07-21T17:32:28Z"); } @Test - public void testValidateLocalDate() { + public void testValidateLocalDate() throws ValidationException, InvalidTypeException { String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); Assert.assertEquals(validatedValue, "2017-07-21"); } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException, InvalidTypeException { LinkedHashMap inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap validatedValue = schema.validate(inMap, configuration); @@ -93,7 +95,7 @@ public void testValidateMap() { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException, InvalidTypeException { ArrayList inList = new ArrayList<>(); inList.add(LocalDate.of(2017, 7, 21)); FrozenList validatedValue = schema.validate(inList, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index 42dfcabf0d0..2d26f1563d4 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -53,12 +53,12 @@ public FrozenList getNewInstance(List arg, List pathToItem, P itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -86,7 +86,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -111,7 +111,7 @@ protected ArrayWithOutputClsSchemaList(FrozenList m) { super(m); } - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) { + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return new ArrayWithOutputClsSchema().validate(arg, configuration); } } @@ -138,12 +138,12 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -172,7 +172,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -202,7 +202,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateArrayWithItemsSchema() { + public void testValidateArrayWithItemsSchema() throws ValidationException, InvalidTypeException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); @@ -227,7 +227,7 @@ public void testValidateArrayWithItemsSchema() { } @Test - public void testValidateArrayWithOutputClsSchema() { + public void testValidateArrayWithOutputClsSchema() throws ValidationException, InvalidTypeException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/AnyTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/AnyTypeSchemaTest.hbs index 9981ca451fe..f27e26f7b0e 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/AnyTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/AnyTypeSchemaTest.hbs @@ -5,6 +5,8 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.FrozenList; import {{{packageName}}}.schemas.validation.FrozenMap; @@ -26,13 +28,13 @@ public class AnyTypeSchemaTest { } @Test - public void testValidateNull() { + public void testValidateNull() throws ValidationException, InvalidTypeException { Void validatedValue = schema.validate((Void) null, configuration); assertNull(validatedValue); } @Test - public void testValidateBoolean() { + public void testValidateBoolean() throws ValidationException, InvalidTypeException { boolean trueValue = schema.validate(true, configuration); Assert.assertTrue(trueValue); @@ -41,49 +43,49 @@ public class AnyTypeSchemaTest { } @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException, InvalidTypeException { int validatedValue = schema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException, InvalidTypeException { long validatedValue = schema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException, InvalidTypeException { float validatedValue = schema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException, InvalidTypeException { double validatedValue = schema.validate(70.6458763d, configuration); Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); } @Test - public void testValidateString() { + public void testValidateString() throws ValidationException, InvalidTypeException { String validatedValue = schema.validate("a", configuration); Assert.assertEquals(validatedValue, "a"); } @Test - public void testValidateZonedDateTime() { + public void testValidateZonedDateTime() throws ValidationException, InvalidTypeException { String validatedValue = schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration); Assert.assertEquals(validatedValue, "2017-07-21T17:32:28Z"); } @Test - public void testValidateLocalDate() { + public void testValidateLocalDate() throws ValidationException, InvalidTypeException { String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); Assert.assertEquals(validatedValue, "2017-07-21"); } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException, InvalidTypeException { LinkedHashMap inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap validatedValue = schema.validate(inMap, configuration); @@ -93,7 +95,7 @@ public class AnyTypeSchemaTest { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException, InvalidTypeException { ArrayList inList = new ArrayList<>(); inList.add(LocalDate.of(2017, 7, 21)); FrozenList validatedValue = schema.validate(inList, configuration); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs index 3256926f42d..5e69ae24b98 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs @@ -53,12 +53,12 @@ public class ArrayTypeSchemaTest { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -86,7 +86,7 @@ public class ArrayTypeSchemaTest { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -111,7 +111,7 @@ public class ArrayTypeSchemaTest { super(m); } - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) { + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return new ArrayWithOutputClsSchema().validate(arg, configuration); } } @@ -138,12 +138,12 @@ public class ArrayTypeSchemaTest { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -172,7 +172,7 @@ public class ArrayTypeSchemaTest { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -202,7 +202,7 @@ public class ArrayTypeSchemaTest { } @Test - public void testValidateArrayWithItemsSchema() { + public void testValidateArrayWithItemsSchema() throws ValidationException, InvalidTypeException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); @@ -227,7 +227,7 @@ public class ArrayTypeSchemaTest { } @Test - public void testValidateArrayWithOutputClsSchema() { + public void testValidateArrayWithOutputClsSchema() throws ValidationException, InvalidTypeException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); From 7185a274c6c9cdc6f8741edd2cab77b989ac12e4 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 14:19:18 -0700 Subject: [PATCH 29/53] Fixes schema tests --- .../client/schemas/BooleanSchemaTest.java | 8 ++-- .../client/schemas/ListSchemaTest.java | 3 +- .../client/schemas/MapSchemaTest.java | 3 +- .../client/schemas/NullSchemaTest.java | 4 +- .../client/schemas/NumberSchemaTest.java | 9 +++-- .../client/schemas/ObjectTypeSchemaTest.java | 38 +++++++++---------- .../client/schemas/RefBooleanSchemaTest.java | 6 +-- .../packagename/schemas/BooleanSchemaTest.hbs | 8 ++-- .../packagename/schemas/ListSchemaTest.hbs | 5 ++- .../packagename/schemas/MapSchemaTest.hbs | 5 ++- .../packagename/schemas/NullSchemaTest.hbs | 6 +-- .../packagename/schemas/NumberSchemaTest.hbs | 11 +++--- .../schemas/ObjectTypeSchemaTest.hbs | 38 +++++++++---------- .../schemas/RefBooleanSchemaTest.hbs | 8 ++-- 14 files changed, 79 insertions(+), 73 deletions(-) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java index 0b4261a7ef0..a989ca41eb2 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java @@ -4,9 +4,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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; @@ -24,13 +24,13 @@ public class BooleanSchemaTest { ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException, InvalidTypeException { boolean validatedValue = booleanJsonSchema.validate(true, configuration); Assert.assertTrue(validatedValue); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException, InvalidTypeException { boolean validatedValue = booleanJsonSchema.validate(false, configuration); Assert.assertFalse(validatedValue); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java index cb4aa60f4a8..bef1fd8484e 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java @@ -5,6 +5,7 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.exceptions.ValidationException; @@ -35,7 +36,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException, InvalidTypeException { List inList = new ArrayList<>(); inList.add("today"); FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java index 85afb15a068..acbb9f60016 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java @@ -5,6 +5,7 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenMap; import org.openapijsonschematools.client.exceptions.ValidationException; @@ -37,7 +38,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException, InvalidTypeException { Map inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap<@Nullable Object> validatedValue = mapJsonSchema.validate(inMap, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java index d566f15a69e..84e3b43c2b8 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java @@ -4,8 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -26,7 +26,7 @@ public class NullSchemaTest { @Test @SuppressWarnings("nullness") - public void testValidateNull() { + public void testValidateNull() throws ValidationException, InvalidTypeException { Void validatedValue = nullJsonSchema.validate(null, configuration); Assert.assertNull(validatedValue); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java index 2ab8d8a8121..6cc8f96625c 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java @@ -4,6 +4,7 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; @@ -23,25 +24,25 @@ public class NumberSchemaTest { ); @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException, InvalidTypeException { int validatedValue = numberJsonSchema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException, InvalidTypeException { long validatedValue = numberJsonSchema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException, InvalidTypeException { float validatedValue = numberJsonSchema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException, InvalidTypeException { double validatedValue = numberJsonSchema.validate(3.14d, configuration); Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index 02729b0f046..c1f9e5de4df 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -6,13 +6,13 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.PropertyEntry; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -62,7 +62,7 @@ public static ObjectWithPropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -70,7 +70,7 @@ public static ObjectWithPropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -99,7 +99,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -146,7 +146,7 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -154,12 +154,12 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(castValue instanceof String)) { - throw new InvalidTypeException("Invalid type for property value"); + throw new RuntimeException("Invalid type for property value"); } properties.put(propertyName, (String) castValue); } @@ -202,7 +202,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -235,7 +235,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -243,7 +243,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -288,7 +288,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -297,7 +297,7 @@ protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { super(m); } - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) { + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); } } @@ -330,7 +330,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -338,7 +338,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -383,7 +383,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -398,7 +398,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateObjectWithPropsSchema() { + public void testValidateObjectWithPropsSchema() throws ValidationException, InvalidTypeException { ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); // map with only property works @@ -429,7 +429,7 @@ public void testValidateObjectWithPropsSchema() { } @Test - public void testValidateObjectWithAddpropsSchema() { + public void testValidateObjectWithAddpropsSchema() throws ValidationException, InvalidTypeException { ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); // map with only property works @@ -460,7 +460,7 @@ public void testValidateObjectWithAddpropsSchema() { } @Test - public void testValidateObjectWithPropsAndAddpropsSchema() { + public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException, InvalidTypeException { ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); // map with only property works @@ -499,7 +499,7 @@ public void testValidateObjectWithPropsAndAddpropsSchema() { } @Test - public void testValidateObjectWithOutputTypeSchema() { + public void testValidateObjectWithOutputTypeSchema() throws ValidationException, InvalidTypeException { ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); // map with only property works diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java index c8079ef632a..81d5aeb7b7f 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java @@ -4,8 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -28,13 +28,13 @@ public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchem ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException, InvalidTypeException { Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); Assert.assertEquals(validatedValue, Boolean.TRUE); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException, InvalidTypeException { Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); Assert.assertEquals(validatedValue, Boolean.FALSE); } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/BooleanSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/BooleanSchemaTest.hbs index 1a33a8f033c..8511da6b07d 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/BooleanSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/BooleanSchemaTest.hbs @@ -4,9 +4,9 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaFactory; +import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.ValidationMetadata; @@ -24,13 +24,13 @@ public class BooleanSchemaTest { ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException, InvalidTypeException { boolean validatedValue = booleanJsonSchema.validate(true, configuration); Assert.assertTrue(validatedValue); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException, InvalidTypeException { boolean validatedValue = booleanJsonSchema.validate(false, configuration); Assert.assertFalse(validatedValue); } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ListSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ListSchemaTest.hbs index 2c2f435e045..eaeb1d1be41 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ListSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ListSchemaTest.hbs @@ -5,9 +5,10 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.FrozenList; -import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.ValidationMetadata; @@ -35,7 +36,7 @@ public class ListSchemaTest { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException, InvalidTypeException { List inList = new ArrayList<>(); inList.add("today"); FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/MapSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/MapSchemaTest.hbs index fc5ecf6aa2a..ab876c35431 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/MapSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/MapSchemaTest.hbs @@ -5,9 +5,10 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.FrozenMap; -import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.ValidationMetadata; @@ -37,7 +38,7 @@ public class MapSchemaTest { } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException, InvalidTypeException { Map inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap<@Nullable Object> validatedValue = mapJsonSchema.validate(inMap, configuration); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/NullSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/NullSchemaTest.hbs index a16b76b02c6..c971a06d62b 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/NullSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/NullSchemaTest.hbs @@ -4,9 +4,9 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaFactory; +import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.ValidationMetadata; @@ -26,7 +26,7 @@ public class NullSchemaTest { @Test @SuppressWarnings("nullness") - public void testValidateNull() { + public void testValidateNull() throws ValidationException, InvalidTypeException { Void validatedValue = nullJsonSchema.validate(null, configuration); Assert.assertNull(validatedValue); } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/NumberSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/NumberSchemaTest.hbs index 996287368a9..6b5ec12bda7 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/NumberSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/NumberSchemaTest.hbs @@ -4,8 +4,9 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.ValidationMetadata; @@ -23,25 +24,25 @@ public class NumberSchemaTest { ); @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException, InvalidTypeException { int validatedValue = numberJsonSchema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException, InvalidTypeException { long validatedValue = numberJsonSchema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException, InvalidTypeException { float validatedValue = numberJsonSchema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException, InvalidTypeException { double validatedValue = numberJsonSchema.validate(3.14d, configuration); Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs index ffc84f68f75..b659b49f344 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs @@ -6,13 +6,13 @@ import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.InvalidTypeException; +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.PropertyEntry; import {{{packageName}}}.schemas.validation.MapSchemaValidator; -import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -62,7 +62,7 @@ public class ObjectTypeSchemaTest { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -70,7 +70,7 @@ public class ObjectTypeSchemaTest { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -99,7 +99,7 @@ public class ObjectTypeSchemaTest { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -146,7 +146,7 @@ public class ObjectTypeSchemaTest { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -154,12 +154,12 @@ public class ObjectTypeSchemaTest { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(castValue instanceof String)) { - throw new InvalidTypeException("Invalid type for property value"); + throw new RuntimeException("Invalid type for property value"); } properties.put(propertyName, (String) castValue); } @@ -202,7 +202,7 @@ public class ObjectTypeSchemaTest { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -235,7 +235,7 @@ public class ObjectTypeSchemaTest { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -243,7 +243,7 @@ public class ObjectTypeSchemaTest { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -288,7 +288,7 @@ public class ObjectTypeSchemaTest { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -297,7 +297,7 @@ public class ObjectTypeSchemaTest { super(m); } - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) { + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); } } @@ -330,7 +330,7 @@ public class ObjectTypeSchemaTest { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -338,7 +338,7 @@ public class ObjectTypeSchemaTest { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -383,7 +383,7 @@ public class ObjectTypeSchemaTest { if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -398,7 +398,7 @@ public class ObjectTypeSchemaTest { } @Test - public void testValidateObjectWithPropsSchema() { + public void testValidateObjectWithPropsSchema() throws ValidationException, InvalidTypeException { ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); // map with only property works @@ -429,7 +429,7 @@ public class ObjectTypeSchemaTest { } @Test - public void testValidateObjectWithAddpropsSchema() { + public void testValidateObjectWithAddpropsSchema() throws ValidationException, InvalidTypeException { ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); // map with only property works @@ -460,7 +460,7 @@ public class ObjectTypeSchemaTest { } @Test - public void testValidateObjectWithPropsAndAddpropsSchema() { + public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException, InvalidTypeException { ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); // map with only property works @@ -499,7 +499,7 @@ public class ObjectTypeSchemaTest { } @Test - public void testValidateObjectWithOutputTypeSchema() { + public void testValidateObjectWithOutputTypeSchema() throws ValidationException, InvalidTypeException { ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); // map with only property works diff --git a/src/main/resources/java/src/test/java/packagename/schemas/RefBooleanSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/RefBooleanSchemaTest.hbs index 46830718ba9..adc70148e20 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/RefBooleanSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/RefBooleanSchemaTest.hbs @@ -4,9 +4,9 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.schemas.validation.JsonSchema; -import {{{packageName}}}.schemas.validation.JsonSchemaFactory; +import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.PathToSchemasMap; import {{{packageName}}}.schemas.validation.ValidationMetadata; @@ -28,13 +28,13 @@ public class RefBooleanSchemaTest { ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException, InvalidTypeException { Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); Assert.assertEquals(validatedValue, Boolean.TRUE); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException, InvalidTypeException { Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); Assert.assertEquals(validatedValue, Boolean.FALSE); } From 2db8f01a9aa83d22416d49aedf7045bc61796a1b Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 14:42:21 -0700 Subject: [PATCH 30/53] Fixes request body test --- .../ApplicationjsonSchema.java | 4 +- .../HeadersWithNoBodyHeadersSchema.java | 4 +- .../ApplicationjsonSchema.java | 4 +- .../applicationxml/ApplicationxmlSchema.java | 4 +- ...ssInlineContentAndHeaderHeadersSchema.java | 4 +- .../ApplicationjsonSchema.java | 4 +- ...ccessWithJsonApiResponseHeadersSchema.java | 4 +- .../schemas/AbstractStepMessage.java | 4 +- .../schemas/AdditionalPropertiesClass.java | 28 ++++---- .../schemas/AdditionalPropertiesSchema.java | 24 +++---- .../AdditionalPropertiesWithArrayOfEnums.java | 8 +-- .../client/components/schemas/Address.java | 4 +- .../client/components/schemas/Animal.java | 8 +-- .../client/components/schemas/AnimalFarm.java | 4 +- .../components/schemas/AnyTypeAndFormat.java | 40 +++++------ .../components/schemas/AnyTypeNotString.java | 4 +- .../components/schemas/ApiResponseSchema.java | 4 +- .../client/components/schemas/Apple.java | 12 ++-- .../client/components/schemas/AppleReq.java | 4 +- .../schemas/ArrayHoldingAnyType.java | 4 +- .../schemas/ArrayOfArrayOfNumberOnly.java | 12 ++-- .../components/schemas/ArrayOfEnums.java | 4 +- .../components/schemas/ArrayOfNumberOnly.java | 8 +-- .../client/components/schemas/ArrayTest.java | 24 +++---- .../schemas/ArrayWithValidationsInItems.java | 8 +-- .../client/components/schemas/Banana.java | 4 +- .../client/components/schemas/BananaReq.java | 4 +- .../client/components/schemas/Bar.java | 4 +- .../client/components/schemas/BasquePig.java | 8 +-- .../components/schemas/BooleanEnum.java | 4 +- .../components/schemas/Capitalization.java | 4 +- .../client/components/schemas/Cat.java | 8 +-- .../client/components/schemas/Category.java | 8 +-- .../client/components/schemas/ChildCat.java | 8 +-- .../client/components/schemas/ClassModel.java | 4 +- .../client/components/schemas/Client.java | 4 +- .../schemas/ComplexQuadrilateral.java | 12 ++-- ...posedAnyOfDifferentTypesNoValidations.java | 8 +-- .../components/schemas/ComposedArray.java | 4 +- .../components/schemas/ComposedBool.java | 4 +- .../components/schemas/ComposedNone.java | 4 +- .../components/schemas/ComposedNumber.java | 4 +- .../components/schemas/ComposedObject.java | 4 +- .../schemas/ComposedOneOfDifferentTypes.java | 16 ++--- .../components/schemas/ComposedString.java | 4 +- .../client/components/schemas/Currency.java | 4 +- .../client/components/schemas/DanishPig.java | 8 +-- .../components/schemas/DateTimeTest.java | 4 +- .../schemas/DateTimeWithValidations.java | 4 +- .../schemas/DateWithValidations.java | 4 +- .../client/components/schemas/Dog.java | 8 +-- .../client/components/schemas/Drawing.java | 8 +-- .../client/components/schemas/EnumArrays.java | 16 ++--- .../client/components/schemas/EnumClass.java | 4 +- .../client/components/schemas/EnumTest.java | 20 +++--- .../schemas/EquilateralTriangle.java | 12 ++-- .../client/components/schemas/File.java | 4 +- .../schemas/FileSchemaTestClass.java | 8 +-- .../client/components/schemas/Foo.java | 4 +- .../client/components/schemas/FormatTest.java | 44 ++++++------ .../client/components/schemas/FromSchema.java | 4 +- .../client/components/schemas/Fruit.java | 4 +- .../client/components/schemas/FruitReq.java | 4 +- .../client/components/schemas/GmFruit.java | 4 +- .../components/schemas/GrandparentAnimal.java | 4 +- .../components/schemas/HasOnlyReadOnly.java | 4 +- .../components/schemas/HealthCheckResult.java | 8 +-- .../components/schemas/IntegerEnum.java | 4 +- .../components/schemas/IntegerEnumBig.java | 4 +- .../schemas/IntegerEnumOneValue.java | 4 +- .../schemas/IntegerEnumWithDefaultValue.java | 4 +- .../components/schemas/IntegerMax10.java | 4 +- .../components/schemas/IntegerMin15.java | 4 +- .../components/schemas/IsoscelesTriangle.java | 12 ++-- .../client/components/schemas/Items.java | 4 +- .../components/schemas/JSONPatchRequest.java | 8 +-- .../JSONPatchRequestAddReplaceTest.java | 8 +-- .../schemas/JSONPatchRequestMoveCopy.java | 8 +-- .../schemas/JSONPatchRequestRemove.java | 8 +-- .../client/components/schemas/Mammal.java | 4 +- .../client/components/schemas/MapTest.java | 24 +++---- ...ropertiesAndAdditionalPropertiesClass.java | 8 +-- .../client/components/schemas/Money.java | 4 +- .../components/schemas/MyObjectDto.java | 4 +- .../client/components/schemas/Name.java | 4 +- .../schemas/NoAdditionalProperties.java | 4 +- .../components/schemas/NullableClass.java | 72 +++++++++---------- .../components/schemas/NullableShape.java | 4 +- .../components/schemas/NullableString.java | 4 +- .../client/components/schemas/NumberOnly.java | 4 +- .../schemas/NumberWithExclusiveMinMax.java | 4 +- .../schemas/NumberWithValidations.java | 4 +- .../schemas/ObjWithRequiredProps.java | 4 +- .../schemas/ObjWithRequiredPropsBase.java | 4 +- .../ObjectModelWithArgAndArgsProperties.java | 4 +- .../schemas/ObjectModelWithRefProps.java | 4 +- ...hAllOfWithReqTestPropFromUnsetAddProp.java | 8 +-- .../ObjectWithCollidingProperties.java | 4 +- .../schemas/ObjectWithDecimalProperties.java | 4 +- .../ObjectWithDifficultlyNamedProps.java | 4 +- .../ObjectWithInlineCompositionProperty.java | 12 ++-- ...ObjectWithInvalidNamedRefedProperties.java | 4 +- .../ObjectWithNonIntersectingValues.java | 4 +- .../schemas/ObjectWithOnlyOptionalProps.java | 4 +- .../schemas/ObjectWithOptionalTestProp.java | 4 +- .../schemas/ObjectWithValidations.java | 4 +- .../client/components/schemas/Order.java | 8 +-- .../schemas/PaginatedResultMyObjectDto.java | 8 +-- .../client/components/schemas/ParentPet.java | 4 +- .../client/components/schemas/Pet.java | 16 ++--- .../client/components/schemas/Pig.java | 4 +- .../client/components/schemas/Player.java | 4 +- .../client/components/schemas/PublicKey.java | 4 +- .../components/schemas/Quadrilateral.java | 4 +- .../schemas/QuadrilateralInterface.java | 8 +-- .../components/schemas/ReadOnlyFirst.java | 4 +- .../schemas/ReqPropsFromExplicitAddProps.java | 4 +- .../schemas/ReqPropsFromTrueAddProps.java | 4 +- .../schemas/ReqPropsFromUnsetAddProps.java | 4 +- .../components/schemas/ReturnSchema.java | 4 +- .../components/schemas/ScaleneTriangle.java | 12 ++-- .../components/schemas/Schema200Response.java | 4 +- .../schemas/SelfReferencingArrayModel.java | 4 +- .../schemas/SelfReferencingObjectModel.java | 4 +- .../client/components/schemas/Shape.java | 4 +- .../components/schemas/ShapeOrNull.java | 4 +- .../schemas/SimpleQuadrilateral.java | 12 ++-- .../client/components/schemas/SomeObject.java | 4 +- .../components/schemas/SpecialModelname.java | 4 +- .../components/schemas/StringBooleanMap.java | 4 +- .../client/components/schemas/StringEnum.java | 4 +- .../schemas/StringEnumWithDefaultValue.java | 4 +- .../schemas/StringWithValidation.java | 4 +- .../client/components/schemas/Tag.java | 4 +- .../client/components/schemas/Triangle.java | 4 +- .../components/schemas/TriangleInterface.java | 8 +-- .../client/components/schemas/UUIDString.java | 4 +- .../client/components/schemas/User.java | 12 ++-- .../client/components/schemas/Whale.java | 8 +-- .../client/components/schemas/Zebra.java | 12 ++-- .../delete/HeaderParameters.java | 4 +- .../delete/PathParameters.java | 4 +- .../delete/parameters/parameter1/Schema1.java | 4 +- .../commonparamsubdir/get/PathParameters.java | 4 +- .../get/QueryParameters.java | 4 +- .../routeparameter0/RouteParamSchema0.java | 4 +- .../post/HeaderParameters.java | 4 +- .../post/PathParameters.java | 4 +- .../paths/fake/delete/HeaderParameters.java | 4 +- .../paths/fake/delete/QueryParameters.java | 4 +- .../delete/parameters/parameter1/Schema1.java | 4 +- .../delete/parameters/parameter4/Schema4.java | 4 +- .../paths/fake/get/HeaderParameters.java | 4 +- .../paths/fake/get/QueryParameters.java | 4 +- .../get/parameters/parameter0/Schema0.java | 8 +-- .../get/parameters/parameter1/Schema1.java | 4 +- .../get/parameters/parameter2/Schema2.java | 8 +-- .../get/parameters/parameter3/Schema3.java | 4 +- .../get/parameters/parameter4/Schema4.java | 4 +- .../get/parameters/parameter5/Schema5.java | 4 +- .../ApplicationxwwwformurlencodedSchema.java | 16 ++--- .../ApplicationxwwwformurlencodedSchema.java | 40 +++++------ .../put/QueryParameters.java | 4 +- .../put/QueryParameters.java | 4 +- .../delete/PathParameters.java | 4 +- .../ApplicationjsonSchema.java | 4 +- .../post/QueryParameters.java | 4 +- .../post/parameters/parameter0/Schema0.java | 8 +-- .../post/parameters/parameter1/Schema1.java | 12 ++-- .../ApplicationjsonSchema.java | 8 +-- .../MultipartformdataSchema.java | 12 ++-- .../ApplicationjsonSchema.java | 8 +-- .../MultipartformdataSchema.java | 12 ++-- .../ApplicationxwwwformurlencodedSchema.java | 4 +- .../ApplicationjsonSchema.java | 4 +- .../MultipartformdataSchema.java | 4 +- .../fakeobjinquery/get/QueryParameters.java | 4 +- .../get/parameters/parameter0/Schema0.java | 4 +- .../post/CookieParameters.java | 4 +- .../post/HeaderParameters.java | 4 +- .../post/PathParameters.java | 4 +- .../post/QueryParameters.java | 4 +- .../post/PathParameters.java | 4 +- .../MultipartformdataSchema.java | 4 +- .../get/QueryParameters.java | 4 +- .../get/QueryParameters.java | 4 +- .../put/QueryParameters.java | 4 +- .../put/parameters/parameter0/Schema0.java | 4 +- .../put/parameters/parameter1/Schema1.java | 4 +- .../put/parameters/parameter2/Schema2.java | 4 +- .../put/parameters/parameter3/Schema3.java | 4 +- .../put/parameters/parameter4/Schema4.java | 4 +- .../MultipartformdataSchema.java | 4 +- .../MultipartformdataSchema.java | 8 +-- .../ApplicationjsonSchema.java | 4 +- .../foo/get/servers/server1/Variables.java | 8 +-- .../petfindbystatus/get/QueryParameters.java | 4 +- .../get/parameters/parameter0/Schema0.java | 8 +-- .../servers/server1/Variables.java | 8 +-- .../petfindbytags/get/QueryParameters.java | 4 +- .../get/parameters/parameter0/Schema0.java | 4 +- .../petpetid/delete/HeaderParameters.java | 4 +- .../paths/petpetid/delete/PathParameters.java | 4 +- .../paths/petpetid/get/PathParameters.java | 4 +- .../paths/petpetid/post/PathParameters.java | 4 +- .../ApplicationxwwwformurlencodedSchema.java | 4 +- .../post/PathParameters.java | 4 +- .../MultipartformdataSchema.java | 4 +- .../delete/PathParameters.java | 4 +- .../storeorderorderid/get/PathParameters.java | 4 +- .../get/parameters/parameter0/Schema0.java | 4 +- .../paths/userlogin/get/QueryParameters.java | 4 +- .../Code200ResponseHeadersSchema.java | 4 +- .../userusername/delete/PathParameters.java | 4 +- .../userusername/get/PathParameters.java | 4 +- .../userusername/put/PathParameters.java | 4 +- .../client/schemas/ListJsonSchema.java | 4 +- .../client/servers/server0/Variables.java | 12 ++-- .../client/servers/server1/Variables.java | 8 +-- .../RequestBodySerializerTest.java | 9 ++- .../response/ResponseDeserializerTest.java | 1 + .../client/schemas/ListSchemaTest.java | 2 +- .../client/schemas/MapSchemaTest.java | 2 +- .../client/schemas/NullSchemaTest.java | 2 +- .../client/schemas/NumberSchemaTest.java | 2 +- .../client/schemas/RefBooleanSchemaTest.java | 2 +- .../AdditionalPropertiesValidatorTest.java | 1 + .../_getNewInstanceObject_implementor.hbs | 4 +- .../packagename/schemas/ListJsonSchema.hbs | 4 +- .../requestbody/RequestBodySerializerTest.hbs | 9 ++- .../response/ResponseDeserializerTest.hbs | 1 + 231 files changed, 752 insertions(+), 743 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java index c0afc397ef8..8af7588a70f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java @@ -128,11 +128,11 @@ public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration confi throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java index ae8a2d5f129..9cf67e145ee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java @@ -170,11 +170,11 @@ public HeadersWithNoBodyHeadersSchemaMap validate(Map arg, SchemaConfigura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public HeadersWithNoBodyHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java index debe772349d..41648d26c45 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java @@ -129,11 +129,11 @@ public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration confi throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java index 5fe337ebc9e..ccd9ff1c17a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java @@ -128,11 +128,11 @@ public ApplicationxmlSchemaList validate(List arg, SchemaConfiguration config throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxmlSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java index 8c034d05cb2..fa81cb9cef7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java @@ -170,11 +170,11 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap validate(Map arg, Sch throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public SuccessInlineContentAndHeaderHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java index 25c65ba82b2..3c15438127d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java @@ -169,11 +169,11 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java index 71fb54f39d3..248ed6d8006 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java @@ -507,11 +507,11 @@ public SuccessWithJsonApiResponseHeadersSchemaMap validate(Map arg, Schema throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public SuccessWithJsonApiResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java index 9c42ed107fe..9b1a3a1b688 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java @@ -434,11 +434,11 @@ public AbstractStepMessageMap validate(Map arg, SchemaConfiguration config throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AbstractStepMessage1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java index 36fa1fa8662..bcd5b0cbf06 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java @@ -167,11 +167,11 @@ public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -321,11 +321,11 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration confi throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -464,11 +464,11 @@ public MapOfMapPropertyMap validate(Map arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MapOfMapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -704,11 +704,11 @@ public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MapWithUndeclaredPropertiesAnytype3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -834,11 +834,11 @@ public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) th throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EmptyMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -988,11 +988,11 @@ public MapWithUndeclaredPropertiesStringMap validate(Map arg, SchemaConfig throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MapWithUndeclaredPropertiesStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1384,11 +1384,11 @@ public AdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java index 9f56d8a9214..09ea7e4e3c4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java @@ -225,11 +225,11 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -468,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -483,7 +483,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -706,11 +706,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -949,7 +949,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -964,7 +964,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1187,11 +1187,11 @@ public Schema2Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1288,11 +1288,11 @@ public static AdditionalPropertiesSchema1 getInstance() { throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalPropertiesSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java index 1268c2a66db..6e2863a0abf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java @@ -137,11 +137,11 @@ public AdditionalPropertiesList validate(List arg, SchemaConfiguration config throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalPropertiesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -289,11 +289,11 @@ public AdditionalPropertiesWithArrayOfEnumsMap validate(Map arg, SchemaCon throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalPropertiesWithArrayOfEnums1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java index c0414c5bfbf..771d9a3dcf0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java @@ -189,11 +189,11 @@ public AddressMap validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Address1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java index 261ad7b4d3e..5251da28fd3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java @@ -93,11 +93,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -302,11 +302,11 @@ public AnimalMap validate(Map arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Animal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java index 433a8300379..28311a1e5c4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java @@ -133,11 +133,11 @@ public AnimalFarmList validate(List arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AnimalFarm1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java index 047cf3c1288..16001bb2b9a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java @@ -260,7 +260,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -275,7 +275,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UuidSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -545,7 +545,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -560,7 +560,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DateBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -830,7 +830,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -845,7 +845,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DatetimeBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1115,7 +1115,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1130,7 +1130,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NumberSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1400,7 +1400,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1415,7 +1415,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public BinaryBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1685,7 +1685,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1700,7 +1700,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Int32BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1970,7 +1970,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1985,7 +1985,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Int64BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -2255,7 +2255,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -2270,7 +2270,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DoubleSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -2540,7 +2540,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -2555,7 +2555,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public FloatSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -3321,11 +3321,11 @@ public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AnyTypeAndFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java index 72b0ef9e5da..7deece9a944 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java @@ -276,7 +276,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AnyTypeNotString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java index 11cf4c5f322..ca9bd15cc64 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java @@ -268,11 +268,11 @@ public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApiResponseSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java index 9f2b69a9481..b72bdffcb0d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java @@ -84,11 +84,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public CultivarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -157,11 +157,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OriginBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -383,13 +383,13 @@ public AppleMap validate(Map arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Apple1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java index b7f9edcf558..c6b68cc1026 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java @@ -244,11 +244,11 @@ public AppleReqMap validate(Map arg, SchemaConfiguration configuration) th throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AppleReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java index 3dc7a793d07..35e2c0c6459 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java @@ -181,11 +181,11 @@ public ArrayHoldingAnyTypeList validate(List arg, SchemaConfiguration configu throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayHoldingAnyType1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java index 67725b0d13b..de975fd98ca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java @@ -160,11 +160,11 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -282,11 +282,11 @@ public ArrayArrayNumberList validate(List arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -446,11 +446,11 @@ public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration c throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayOfArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java index 7044a7eb501..461ab2b731f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java @@ -146,11 +146,11 @@ public ArrayOfEnumsList validate(List arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayOfEnums1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java index 5d229747360..0d813a49f24 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java @@ -160,11 +160,11 @@ public ArrayNumberList validate(List arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -324,11 +324,11 @@ public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java index db10c284923..5674237c706 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java @@ -146,11 +146,11 @@ public ArrayOfStringList validate(List arg, SchemaConfiguration configuration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayOfStringBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -294,11 +294,11 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -416,11 +416,11 @@ public ArrayArrayOfIntegerList validate(List arg, SchemaConfiguration configu throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayArrayOfIntegerBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -538,11 +538,11 @@ public ItemsList1 validate(List arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Items3BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -660,11 +660,11 @@ public ArrayArrayOfModelList validate(List arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayArrayOfModelBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -878,11 +878,11 @@ public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java index a35dbdfe76c..52a966a767c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java @@ -94,11 +94,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -238,11 +238,11 @@ public ArrayWithValidationsInItemsList validate(List arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayWithValidationsInItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java index 38d9dcc32b1..dddd463f507 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java @@ -214,11 +214,11 @@ public BananaMap validate(Map arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Banana1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java index f629ec3b002..39ce0a23799 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java @@ -262,11 +262,11 @@ public BananaReqMap validate(Map arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public BananaReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java index 24a993b902f..0d7d903f99c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java @@ -77,11 +77,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java index 6249c54e78f..891877224f2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java @@ -102,11 +102,11 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -283,11 +283,11 @@ public BasquePigMap validate(Map arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public BasquePig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java index ec496bb4807..ac9c596b4da 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java @@ -97,12 +97,12 @@ public boolean validate(BooleanBooleanEnumEnums arg,SchemaConfiguration configur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public BooleanEnum1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java index e9937464771..4d8c49d8055 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java @@ -375,11 +375,11 @@ public CapitalizationMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Capitalization1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java index 16706d8c62f..5e813008bca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java @@ -188,11 +188,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -440,7 +440,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -455,7 +455,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Cat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java index 107f01e5570..49808839f5c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java @@ -93,11 +93,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -320,11 +320,11 @@ public CategoryMap validate(Map arg, SchemaConfiguration configuration) th throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Category1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java index a5c84dbd0e9..08bda08e4a3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java @@ -188,11 +188,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -440,7 +440,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -455,7 +455,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ChildCat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java index c534a812e84..b157d6b0b06 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java @@ -338,7 +338,7 @@ public ClassModelMap validate(Map arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -353,7 +353,7 @@ public ClassModelMap validate(Map arg, SchemaConfiguration configuration) } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ClassModel1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java index 3dd614c3fea..1cda33382cb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java @@ -185,11 +185,11 @@ public ClientMap validate(Map arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Client1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java index d89b0fc0cb3..9ec6d3ebfd5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java @@ -110,11 +110,11 @@ public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration conf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -274,11 +274,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -526,7 +526,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -541,7 +541,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ComplexQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java index ac5b7cc3be7..d032063edf1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java @@ -299,11 +299,11 @@ public Schema9List validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema9BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -630,7 +630,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -645,7 +645,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ComposedAnyOfDifferentTypesNoValidations1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java index f08114ad244..4f5db51dc33 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java @@ -181,11 +181,11 @@ public ComposedArrayList validate(List arg, SchemaConfiguration configuration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ComposedArray1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java index cc8e0e369e9..2f0997f4620 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java @@ -89,12 +89,12 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ComposedBool1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java index 6661e3e3a65..7c4d610c4c9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java @@ -88,11 +88,11 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ComposedNone1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java index 55ea6dad77f..581d261821c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java @@ -109,11 +109,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ComposedNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java index a88b7268b30..41d5395ee3f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java @@ -117,11 +117,11 @@ public static ComposedObject1 getInstance() { throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ComposedObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java index d3a6dcfaaa2..cf020558a2e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java @@ -133,11 +133,11 @@ public static Schema4 getInstance() { throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema4BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -306,11 +306,11 @@ public Schema5List validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema5BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -379,11 +379,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema6BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -637,7 +637,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -652,7 +652,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ComposedOneOfDifferentTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java index d7b4bb881eb..2a8ed2ceac4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java @@ -90,11 +90,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ComposedString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java index f1f538e7408..0ba5c778f44 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java @@ -100,11 +100,11 @@ public String validate(StringCurrencyEnums arg,SchemaConfiguration configuration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Currency1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java index 7c3806cc387..ccd04ccd803 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java @@ -102,11 +102,11 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -283,11 +283,11 @@ public DanishPigMap validate(Map arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DanishPig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java index 4e4f60df3b1..ad98a2f123d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java @@ -79,11 +79,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java index e8803ed07af..7046ade7c92 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java @@ -81,11 +81,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DateTimeWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java index d948b7f3044..4e2804bbd3b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java @@ -81,11 +81,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DateWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java index f8c08259e42..229f39974a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java @@ -188,11 +188,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -440,7 +440,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -455,7 +455,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Dog1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java index 1b3181e555b..b0da09c8066 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java @@ -173,11 +173,11 @@ public ShapesList validate(List arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ShapesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -635,11 +635,11 @@ public DrawingMap validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Drawing1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java index 0a70d911d91..c073d1d2e8a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java @@ -106,11 +106,11 @@ public String validate(StringJustSymbolEnums arg,SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public JustSymbolBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -197,11 +197,11 @@ public String validate(StringItemsEnums arg,SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -324,11 +324,11 @@ public ArrayEnumList validate(List arg, SchemaConfiguration configuration) th throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayEnumBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -521,11 +521,11 @@ public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumArrays1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java index 5edb162d2cf..dd316d9cb74 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java @@ -108,11 +108,11 @@ public String validate(StringEnumClassEnums arg,SchemaConfiguration configuratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java index 5ffb64a97c6..dbf9166af8f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java @@ -116,11 +116,11 @@ public String validate(StringEnumStringEnums arg,SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -209,11 +209,11 @@ public String validate(StringEnumStringRequiredEnums arg,SchemaConfiguration con throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumStringRequiredBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -366,11 +366,11 @@ public double validate(DoubleEnumIntegerEnums arg,SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -482,11 +482,11 @@ public double validate(DoubleEnumNumberEnums arg,SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1096,11 +1096,11 @@ public EnumTestMap validate(Map arg, SchemaConfiguration configuration) th throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java index 4978196ddae..46b67f0331b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java @@ -110,11 +110,11 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -274,11 +274,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -526,7 +526,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -541,7 +541,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EquilateralTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java index ee5d335ce25..ed5e7ee69d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java @@ -187,11 +187,11 @@ public FileMap validate(Map arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public File1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java index 194756a6aa6..c2bc5aba341 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java @@ -133,11 +133,11 @@ public FilesList validate(List arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public FilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -324,11 +324,11 @@ public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration config throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public FileSchemaTestClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java index b0e7360399a..2bc01a01ea5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java @@ -173,11 +173,11 @@ public FooMap validate(Map arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Foo1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java index 3d410a64ade..bbf28d75c60 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java @@ -117,11 +117,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public IntegerSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -211,11 +211,11 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Int32withValidationsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -313,11 +313,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -391,11 +391,11 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -480,11 +480,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -640,11 +640,11 @@ public ArrayWithUniqueItemsList validate(List arg, SchemaConfiguration config throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayWithUniqueItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -713,11 +713,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public StringSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -852,11 +852,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -924,11 +924,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PatternWithDigitsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -997,11 +997,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PatternWithDigitsAndDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -2017,11 +2017,11 @@ public FormatTestMap validate(Map arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public FormatTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java index 5e37b7fa644..c1dafe2d7aa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java @@ -242,11 +242,11 @@ public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public FromSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java index c042a041623..db2854cd464 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java @@ -350,7 +350,7 @@ public FruitMap validate(Map arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -365,7 +365,7 @@ public FruitMap validate(Map arg, SchemaConfiguration configuration) throw } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Fruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java index f78fb8fc525..bbc0144e6e7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java @@ -280,7 +280,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -295,7 +295,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public FruitReq1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java index fa8dc195b31..e072bf3b0a2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java @@ -350,7 +350,7 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -365,7 +365,7 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public GmFruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java index e5d9c3f63bc..2cb68aa124e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java @@ -196,11 +196,11 @@ public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public GrandparentAnimal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java index 398c79c2729..4f718683c66 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java @@ -223,11 +223,11 @@ public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public HasOnlyReadOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java index 329355cf688..68c23c758f9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java @@ -101,13 +101,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NullableMessageBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -282,11 +282,11 @@ public HealthCheckResultMap validate(Map arg, SchemaConfiguration configur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public HealthCheckResult1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java index 0ae374d8218..784f40a5be1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java @@ -186,11 +186,11 @@ public double validate(DoubleIntegerEnumEnums arg,SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public IntegerEnum1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java index 2c174fedbb0..ddedc296947 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java @@ -186,11 +186,11 @@ public double validate(DoubleIntegerEnumBigEnums arg,SchemaConfiguration configu throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public IntegerEnumBig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java index 25c20c6f654..2568448921f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java @@ -176,11 +176,11 @@ public double validate(DoubleIntegerEnumOneValueEnums arg,SchemaConfiguration co throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public IntegerEnumOneValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java index f20493461ee..eab8a6c8b01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java @@ -188,11 +188,11 @@ public double validate(DoubleIntegerEnumWithDefaultValueEnums arg,SchemaConfigur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public IntegerEnumWithDefaultValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java index 8f8be8bd121..83d95c760ab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java @@ -96,11 +96,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public IntegerMax101BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java index ce505b70d45..7ef094ddb67 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java @@ -96,11 +96,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public IntegerMin151BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java index 24ae4b6f2d3..07d966a166c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java @@ -110,11 +110,11 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -274,11 +274,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -526,7 +526,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -541,7 +541,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public IsoscelesTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java index 84a1ccad6bb..31bda2924b6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java @@ -147,11 +147,11 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java index 52acd711ba4..f461275f948 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java @@ -262,7 +262,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -277,7 +277,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -470,11 +470,11 @@ public JSONPatchRequestList validate(List arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public JSONPatchRequest1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java index 9545ebd840f..db08d3af4b0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java @@ -142,11 +142,11 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -499,11 +499,11 @@ public JSONPatchRequestAddReplaceTestMap validate(Map arg, SchemaConfigura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public JSONPatchRequestAddReplaceTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java index 4ea6d40ed8f..aec1e8ece3e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java @@ -140,11 +140,11 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -452,11 +452,11 @@ public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfiguration c throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public JSONPatchRequestMoveCopy1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java index 0fabdb4d5b3..dd6cc0b1d1a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java @@ -127,11 +127,11 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -352,11 +352,11 @@ public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfiguration con throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public JSONPatchRequestRemove1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java index 7aed72d332b..23fbf511a9e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java @@ -268,7 +268,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -283,7 +283,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Mammal1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java index c5e4a22ab50..0f112f5e10c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java @@ -169,11 +169,11 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration confi throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalPropertiesBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -312,11 +312,11 @@ public MapMapOfStringMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MapMapOfStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -404,11 +404,11 @@ public String validate(StringAdditionalPropertiesEnums arg,SchemaConfiguration c throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -553,11 +553,11 @@ public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MapOfEnumStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -712,11 +712,11 @@ public DirectMapMap validate(Map arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DirectMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -958,11 +958,11 @@ public MapTestMap validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MapTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java index e23bd7e93e7..354de5b9ae4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java @@ -176,11 +176,11 @@ public MapMap validate(Map arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MapSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -375,11 +375,11 @@ public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map arg, Sc throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MixedPropertiesAndAdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java index 2662733c5c2..d64b7e21b6b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java @@ -256,11 +256,11 @@ public MoneyMap validate(Map arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Money1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java index 7b31efab8a4..0f3ee4b146b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java @@ -187,11 +187,11 @@ public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java index 4b28c835523..4e70d396f79 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java @@ -449,7 +449,7 @@ public NameMap validate(Map arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -464,7 +464,7 @@ public NameMap validate(Map arg, SchemaConfiguration configuration) throws } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Name1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java index 0a24dbf1e78..07112ce09d6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java @@ -273,11 +273,11 @@ public NoAdditionalPropertiesMap validate(Map arg, SchemaConfiguration con throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NoAdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java index 7b0072832c2..fee17dcaa33 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java @@ -131,13 +131,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalProperties3BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -250,13 +250,13 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public IntegerPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -368,13 +368,13 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NumberPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -468,14 +468,14 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public BooleanPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -569,13 +569,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public StringPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -669,13 +669,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DatePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -769,13 +769,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DatetimePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -934,13 +934,13 @@ public ArrayNullablePropList validate(List arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1055,13 +1055,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Items1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1214,13 +1214,13 @@ public ArrayAndItemsNullablePropList validate(List arg, SchemaConfiguration c throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1335,13 +1335,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Items2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1471,11 +1471,11 @@ public ArrayItemsNullableList validate(List arg, SchemaConfiguration configur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayItemsNullableBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1647,13 +1647,13 @@ public ObjectNullablePropMap validate(Map arg, SchemaConfiguration configu throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1768,13 +1768,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1949,13 +1949,13 @@ public ObjectAndItemsNullablePropMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -2070,13 +2070,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -2228,11 +2228,11 @@ public ObjectItemsNullableMap validate(Map arg, SchemaConfiguration config throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectItemsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -2813,11 +2813,11 @@ public NullableClassMap validate(Map arg, SchemaConfiguration configuratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NullableClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java index a9615b1b329..c6c5d363ba2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java @@ -282,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -297,7 +297,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NullableShape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java index e42d1731060..65d302e6ff2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java @@ -98,13 +98,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NullableString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java index b099c3fe847..9871bbb637e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java @@ -203,11 +203,11 @@ public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java index 4f199fc58a1..cc9f66947cd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java @@ -96,11 +96,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NumberWithExclusiveMinMax1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java index f24ef914410..6ff107598ba 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java @@ -96,11 +96,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NumberWithValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java index 4448b458f43..9535263d425 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java @@ -199,11 +199,11 @@ public ObjWithRequiredPropsMap validate(Map arg, SchemaConfiguration confi throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjWithRequiredProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java index bf05915a73b..fe428a5aaa5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java @@ -196,11 +196,11 @@ public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfiguration c throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjWithRequiredPropsBase1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java index 00c31269f82..7148a75db63 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java @@ -259,11 +259,11 @@ public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectModelWithArgAndArgsProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java index 382e0fe4cbe..9b7a20ea6b5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java @@ -247,11 +247,11 @@ public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfiguration co throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectModelWithRefProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java index e86cf1c60cb..08109d7a7d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java @@ -274,11 +274,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -526,7 +526,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -541,7 +541,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java index 3e3ccfeccde..4bacb58eb6e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java @@ -225,11 +225,11 @@ public ObjectWithCollidingPropertiesMap validate(Map arg, SchemaConfigurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectWithCollidingProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java index c921349e4be..a055d3347f7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java @@ -239,11 +239,11 @@ public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectWithDecimalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java index f2cbb823be3..379516fee52 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java @@ -285,11 +285,11 @@ public ObjectWithDifficultlyNamedPropsMap validate(Map arg, SchemaConfigur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectWithDifficultlyNamedProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java index 45314759d3e..5a778351f9d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java @@ -88,11 +88,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -332,7 +332,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -347,7 +347,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public SomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -581,11 +581,11 @@ public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectWithInlineCompositionProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java index 35f458b1588..f2c25adf5b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java @@ -228,11 +228,11 @@ public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaCo throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectWithInvalidNamedRefedProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java index 073d1570285..77d997b739d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java @@ -235,11 +235,11 @@ public ObjectWithNonIntersectingValuesMap validate(Map arg, SchemaConfigur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectWithNonIntersectingValues1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java index 360071d246a..6801e4a3bfa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java @@ -250,11 +250,11 @@ public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectWithOnlyOptionalProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java index 2a3cabf8336..0865b282471 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java @@ -185,11 +185,11 @@ public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectWithOptionalTestProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java index 6f6a5756e5e..78c5b4aa10c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java @@ -103,11 +103,11 @@ public static ObjectWithValidations1 getInstance() { throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectWithValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java index 9b742d2d11e..bf6b0474bb9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java @@ -154,11 +154,11 @@ public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -512,11 +512,11 @@ public OrderMap validate(Map arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Order1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java index b79983b393a..cc9906d7d5f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java @@ -158,11 +158,11 @@ public ResultsList validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ResultsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -395,11 +395,11 @@ public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PaginatedResultMyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java index c7657dacbc2..1f5ca58ab3a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java @@ -105,11 +105,11 @@ public static ParentPet1 getInstance() { throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ParentPet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java index 9c6579408a9..95df7d95cc5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java @@ -172,11 +172,11 @@ public PhotoUrlsList validate(List arg, SchemaConfiguration configuration) th throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PhotoUrlsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -265,11 +265,11 @@ public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -387,11 +387,11 @@ public TagsList validate(List arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public TagsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -749,11 +749,11 @@ public PetMap validate(Map arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Pet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java index 4aeeeeae89a..d1905e00d45 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java @@ -267,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Pig1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java index cbdb7de501d..b8fbde3939a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java @@ -214,11 +214,11 @@ public PlayerMap validate(Map arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Player1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java index 9db40f3ec54..9c6057d02e7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java @@ -187,11 +187,11 @@ public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PublicKey1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java index 4094fef6bf6..d614559b5d9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java @@ -267,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Quadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java index 32bb7a8d052..a34f913a8e4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java @@ -111,11 +111,11 @@ public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -507,7 +507,7 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration con throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -522,7 +522,7 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QuadrilateralInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java index 45bc074f188..b820e79f937 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java @@ -223,11 +223,11 @@ public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ReadOnlyFirst1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java index e52f77dea43..39a136395c7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java @@ -251,11 +251,11 @@ public ReqPropsFromExplicitAddPropsMap validate(Map arg, SchemaConfigurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ReqPropsFromExplicitAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java index f677852ed61..d518fb83a8d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java @@ -400,11 +400,11 @@ public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfiguration c throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ReqPropsFromTrueAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java index f0d292f3a04..dfb9da99592 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java @@ -319,11 +319,11 @@ public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ReqPropsFromUnsetAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java index f65427d6d87..d5ce670188a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java @@ -344,7 +344,7 @@ public ReturnMap validate(Map arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -359,7 +359,7 @@ public ReturnMap validate(Map arg, SchemaConfiguration configuration) thro } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ReturnSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java index 539520aa1b5..052f0d58104 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java @@ -110,11 +110,11 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -274,11 +274,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -526,7 +526,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -541,7 +541,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ScaleneTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java index 1b4a243c18e..e985e4fc961 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java @@ -383,7 +383,7 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguration configur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -398,7 +398,7 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema200Response1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java index 41d45a8f80a..772fd0c377b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java @@ -132,11 +132,11 @@ public SelfReferencingArrayModelList validate(List arg, SchemaConfiguration c throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public SelfReferencingArrayModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java index d9bd79bd27a..86d3b5bf5f7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java @@ -190,11 +190,11 @@ public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public SelfReferencingObjectModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java index 779e998a8c1..fc2591ee41f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java @@ -267,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Shape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java index 2729d70eed9..ea2b2517101 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java @@ -282,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -297,7 +297,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ShapeOrNull1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java index effce3a4770..89b18465d78 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java @@ -110,11 +110,11 @@ public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration conf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -274,11 +274,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -526,7 +526,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -541,7 +541,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public SimpleQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java index dd7926edc2d..fa7f1bb0c45 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java @@ -266,7 +266,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,7 +281,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public SomeObject1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java index 448ee5e4b07..a0d7869e135 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java @@ -187,11 +187,11 @@ public SpecialModelnameMap validate(Map arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public SpecialModelname1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java index 0989bf0ddda..2eda6c59628 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java @@ -173,11 +173,11 @@ public StringBooleanMapMap validate(Map arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public StringBooleanMap1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java index 4ba9ddfdb9f..0ca779f13ba 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java @@ -151,13 +151,13 @@ public String validate(StringStringEnumEnums arg,SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public StringEnum1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java index d2f1b7bdf94..5bcc7f5a40e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java @@ -104,11 +104,11 @@ public String validate(StringStringEnumWithDefaultValueEnums arg,SchemaConfigura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java index 3e87f7a721a..a1855745f4a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java @@ -76,11 +76,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public StringWithValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java index 3214bd7734a..04847ec6ab9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java @@ -242,11 +242,11 @@ public TagMap validate(Map arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Tag1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java index 40dc603a6d2..924d3cbbec0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java @@ -268,7 +268,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -283,7 +283,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Triangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java index 9725d699b63..1ed56881f39 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java @@ -111,11 +111,11 @@ public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -507,7 +507,7 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -522,7 +522,7 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public TriangleInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java index d2e584bb2e5..4d41b3a5bdb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java @@ -78,11 +78,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UUIDString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java index 51f53741963..347391cbacc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java @@ -235,13 +235,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectWithNoDeclaredPropsNullableBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -508,7 +508,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -523,7 +523,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AnyTypeExceptNullPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1206,11 +1206,11 @@ public UserMap validate(Map arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public User1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java index 9fef2af94b7..fa016ed0ef6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java @@ -125,11 +125,11 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -361,11 +361,11 @@ public WhaleMap validate(Map arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Whale1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java index b88839eb52e..f17287ff271 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java @@ -118,11 +118,11 @@ public String validate(StringTypeEnums arg,SchemaConfiguration configuration) th throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public TypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -207,11 +207,11 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -491,11 +491,11 @@ public ZebraMap validate(Map arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Zebra1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java index 0a17c8a0067..27d5e082e04 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java @@ -170,11 +170,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java index 19056bb872c..f896975eb9c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java @@ -190,11 +190,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java index 0b6396a06f7..8f0871fbb01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java @@ -94,11 +94,11 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java index 9c5666e0624..e59706308c9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java @@ -190,11 +190,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java index 216c492cb93..07b9fc0a12d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java @@ -170,11 +170,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java index de8fc2b90b6..0c968d356f1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java @@ -94,11 +94,11 @@ public String validate(StringRouteParamSchemaEnums0 arg,SchemaConfiguration conf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RouteParamSchema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java index afd2bcf3c2c..d29fa64fa15 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java @@ -170,11 +170,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java index 4343e4104c2..19c4f712186 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java @@ -190,11 +190,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java index 5f52183686d..569943097bf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java @@ -225,11 +225,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java index 2991469de71..15eeef771e2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java @@ -330,11 +330,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java index 6b135ec1863..1fcfe9d5f82 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java @@ -94,11 +94,11 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java index 7fc0c44544e..6df2a50863a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java @@ -94,11 +94,11 @@ public String validate(StringSchemaEnums4 arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema41BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java index b71ea0be06d..d9389e372af 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java @@ -207,11 +207,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java index c6b377a4aa3..a25176302ba 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java @@ -323,11 +323,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java index 7877cea7383..197ed207b5e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java @@ -100,11 +100,11 @@ public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -233,11 +233,11 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java index 119393f0c76..7231dd2ee1f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java @@ -98,11 +98,11 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java index 91a6dd71d79..5f5c687684c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java @@ -100,11 +100,11 @@ public String validate(StringItemsEnums2 arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -233,11 +233,11 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java index 82197719bb8..84a671f3eab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java @@ -98,11 +98,11 @@ public String validate(StringSchemaEnums3 arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java index 61c9eb31a20..bbf30358b9e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java @@ -167,11 +167,11 @@ public double validate(DoubleSchemaEnums4 arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema41BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java index 3bf8e7f05dc..6206118464a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java @@ -122,11 +122,11 @@ public double validate(DoubleSchemaEnums5 arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema51BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index bc9b15c2fb7..d40a45957c1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -108,11 +108,11 @@ public String validate(StringApplicationxwwwformurlencodedItemsEnums arg,SchemaC throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -241,11 +241,11 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList validate(List arg throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -335,11 +335,11 @@ public String validate(StringApplicationxwwwformurlencodedEnumFormStringEnums ar throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -532,11 +532,11 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index ab8c8078ff7..b25205eba36 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -108,11 +108,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -191,11 +191,11 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedInt32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -292,11 +292,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -369,11 +369,11 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedFloatBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -447,11 +447,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedDoubleBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -520,11 +520,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -592,11 +592,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -697,11 +697,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -775,11 +775,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedPasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1570,11 +1570,11 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java index c715a4f3feb..ec37aacdef9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java @@ -184,11 +184,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java index 74415fccb0e..a087ffae8dc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java @@ -322,11 +322,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java index e8b0b30486f..8d43a07f983 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java @@ -184,11 +184,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 3aa072a178e..60bef93ad40 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -162,11 +162,11 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java index 44c40711409..d214f59fe6a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java @@ -249,11 +249,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java index de3f1645ab5..d3d1e6b83c3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java @@ -86,11 +86,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema00BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -330,7 +330,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -345,7 +345,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java index 90abc08fe80..4418ead419b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java @@ -88,11 +88,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -332,7 +332,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -347,7 +347,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public SomeProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -575,11 +575,11 @@ public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema11BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 46c3d962eec..71b2f8c0688 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -86,11 +86,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -330,7 +330,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -345,7 +345,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index c2b47e74ae8..75874622842 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -88,11 +88,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -332,7 +332,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -347,7 +347,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -575,11 +575,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java index 368e9926328..a7fd369ab3f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java @@ -86,11 +86,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -330,7 +330,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -345,7 +345,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java index 6e059c1c243..c23f54cc10c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java @@ -88,11 +88,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -332,7 +332,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -347,7 +347,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -575,11 +575,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 0ee4f6f3822..09715eef974 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -253,11 +253,11 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index d04680f12fe..fc0e9f7370a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -179,11 +179,11 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index beded918eb5..1e47f7b5fb9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -179,11 +179,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java index e6047ac94f3..8bacd8219d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java @@ -170,11 +170,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java index e4e05bc3513..7e0d45d29ef 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java @@ -179,11 +179,11 @@ public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java index 64e8baf5ec2..1eb0036adbf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java @@ -265,11 +265,11 @@ public CookieParametersMap validate(Map arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public CookieParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java index 0ccc38aa329..f914e01801c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java @@ -237,11 +237,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java index 450bddf5c7f..350cde408ec 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java @@ -798,11 +798,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java index f8746a63d7b..75cb0906e77 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java @@ -265,11 +265,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java index 4650cb249e5..6e22e59d43c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java @@ -202,11 +202,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 4df6e40118d..6dc3c67b7bf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -230,11 +230,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java index ab99f6ce11b..415e967f817 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java @@ -232,11 +232,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java index 8155138307f..7353b5a0858 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java @@ -170,11 +170,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java index d8af6eeb999..47c211d528a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java @@ -1494,11 +1494,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java index 7b061edc762..7e69b2efefd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java @@ -137,11 +137,11 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java index 54504cc58fc..7dc49eb28e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java @@ -137,11 +137,11 @@ public SchemaList1 validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema11BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java index c116051222c..9c02099dafc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java @@ -137,11 +137,11 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java index 829105e85f0..c7cde49fc1c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java @@ -137,11 +137,11 @@ public SchemaList3 validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema31BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java index ea2fb8eba3e..b1df82a9902 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java @@ -137,11 +137,11 @@ public SchemaList4 validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema41BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index a0425ceb750..78f810b7dde 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -230,11 +230,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 031ea0b94b7..028896bfe7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -146,11 +146,11 @@ public MultipartformdataFilesList validate(List arg, SchemaConfiguration conf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MultipartformdataFilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -304,11 +304,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java index ffea94436a0..5cd8f76499d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java @@ -158,11 +158,11 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java index 52af34cc473..8f3d384647e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java @@ -119,11 +119,11 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -292,11 +292,11 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java index e188aae0e45..8c386f45f8b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java @@ -185,11 +185,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java index 55b88271f9a..2d4d15690ac 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java @@ -102,11 +102,11 @@ public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -235,11 +235,11 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java index e2a6ce3b959..91d630876a5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java @@ -119,11 +119,11 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -292,11 +292,11 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java index 52b07f074aa..22ad5d4517b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java @@ -185,11 +185,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java index 16f731c1429..ce4ffe4d3db 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java @@ -137,11 +137,11 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java index a207c53c215..0e14cae85a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java @@ -170,11 +170,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java index df6d9991ae2..9b5c91d9392 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java @@ -202,11 +202,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java index ac27819852a..9dd18c89681 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java @@ -202,11 +202,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java index 88a8b33d08c..75122cf695e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java @@ -202,11 +202,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index f2f9c9d93b8..2392c0da8b5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -217,11 +217,11 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java index 38190c56768..e62ccf822b9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java @@ -202,11 +202,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 3117506337a..3274c7642d8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -218,11 +218,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java index d98ac41b8b1..75affd39735 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java @@ -184,11 +184,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java index 33041924c97..0260a0f7a1a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java @@ -202,11 +202,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java index 836d51db5a6..f9118a29b89 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java @@ -91,11 +91,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java index 7c277bdacae..776ed7baff6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java @@ -234,11 +234,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java index 06c0b7c5381..76d7ecb3390 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java @@ -368,11 +368,11 @@ public Code200ResponseHeadersSchemaMap validate(Map arg, SchemaConfigurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Code200ResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java index 42dfdb96d92..b51d6207c72 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java @@ -184,11 +184,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java index f452c04ff53..336d2df6829 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java @@ -184,11 +184,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java index 694e78fc7a5..e57d83e5196 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java @@ -184,11 +184,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index ee185d63dd7..0f6e5062fae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -78,11 +78,11 @@ public static ListJsonSchema1 getInstance() { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java index 6108ede4c5b..94f9fa76377 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java @@ -121,11 +121,11 @@ public String validate(StringServerEnums arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -219,11 +219,11 @@ public String validate(StringPortEnums arg,SchemaConfiguration configuration) th throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -450,11 +450,11 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java index 8c16e0c9e5b..a014676fa94 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java @@ -119,11 +119,11 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { @@ -292,11 +292,11 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java index 9f0c86ec5c4..880ad7749b3 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java @@ -3,6 +3,9 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -47,7 +50,7 @@ public MyRequestBodySerializer() { true); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { @@ -93,7 +96,7 @@ private String getJsonBody(SerializedRequestBody requestBody) { } @Test - public void testSerializeApplicationJson() { + public void testSerializeApplicationJson() throws ValidationException, InvalidTypeException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); String jsonBody; @@ -164,7 +167,7 @@ public void testSerializeApplicationJson() { } @Test - public void testSerializeTextPlain() { + public void testSerializeTextPlain() throws ValidationException, InvalidTypeException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); SerializedRequestBody requestBody = serializer.serialize( diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java index 46e651edc69..d4ba032bc5f 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java @@ -10,6 +10,7 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java index bef1fd8484e..b0417274fe5 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java @@ -6,9 +6,9 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java index acbb9f60016..2b3e4231fe4 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java @@ -6,9 +6,9 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java index 84e3b43c2b8..afcc5996893 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java @@ -5,8 +5,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; 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; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java index 6cc8f96625c..92698dee479 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java @@ -5,8 +5,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; 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; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java index 81d5aeb7b7f..92c61870552 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java @@ -5,8 +5,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; 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; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java index c3d2670bbe6..a48a2c742f0 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java @@ -6,6 +6,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs index 14938c251c3..17ebe7b30dd 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs @@ -1,6 +1,6 @@ @Override -public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { +public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { {{#if types}} {{#each types}} {{#if @first}} @@ -47,5 +47,5 @@ public @Nullable Object getNewInstance(@Nullable Object arg, List pathTo return getNewInstance((Map) arg, pathToItem, pathToSchemas); } {{/if}} - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs index 13c3a210f44..76311a285ec 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs @@ -78,11 +78,11 @@ public class ListJsonSchema { } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/src/main/resources/java/src/test/java/packagename/requestbody/RequestBodySerializerTest.hbs b/src/main/resources/java/src/test/java/packagename/requestbody/RequestBodySerializerTest.hbs index f4c7425e4ad..90bf6114e41 100644 --- a/src/main/resources/java/src/test/java/packagename/requestbody/RequestBodySerializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/requestbody/RequestBodySerializerTest.hbs @@ -3,6 +3,9 @@ package {{{packageName}}}.requestbody; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.contenttype.ContentTypeDetector; +import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; import {{{packageName}}}.schemas.StringJsonSchema; @@ -47,7 +50,7 @@ public final class RequestBodySerializerTest { true); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { @@ -93,7 +96,7 @@ public final class RequestBodySerializerTest { } @Test - public void testSerializeApplicationJson() { + public void testSerializeApplicationJson() throws ValidationException, InvalidTypeException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); String jsonBody; @@ -164,7 +167,7 @@ public final class RequestBodySerializerTest { } @Test - public void testSerializeTextPlain() { + public void testSerializeTextPlain() throws ValidationException, InvalidTypeException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); SerializedRequestBody requestBody = serializer.serialize( diff --git a/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs b/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs index de0dd283b31..c0b8734535b 100644 --- a/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs @@ -10,6 +10,7 @@ import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.OpenapiDocumentException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.mediatype.MediaType; import {{{packageName}}}.schemas.AnyTypeJsonSchema; From 195b617849df69997135c025112ecf1486c7db7c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 14:49:41 -0700 Subject: [PATCH 31/53] Fixes parameter tests --- .../client/parameter/CookieSerializerTest.java | 4 +++- .../client/parameter/HeadersSerializerTest.java | 4 +++- .../client/parameter/PathSerializerTest.java | 4 +++- .../client/parameter/QuerySerializerTest.java | 4 +++- .../client/parameter/SchemaNonQueryParameterTest.java | 11 ++++++----- .../client/parameter/SchemaQueryParameterTest.java | 7 ++++--- .../packagename/parameter/CookieSerializerTest.hbs | 4 +++- .../packagename/parameter/HeadersSerializerTest.hbs | 4 +++- .../java/packagename/parameter/PathSerializerTest.hbs | 4 +++- .../packagename/parameter/QuerySerializerTest.hbs | 4 +++- .../parameter/SchemaNonQueryParameterTest.hbs | 11 ++++++----- .../parameter/SchemaQueryParameterTest.hbs | 7 ++++--- 12 files changed, 44 insertions(+), 24 deletions(-) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java index a19ea8c1007..b940ebc4f6c 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java @@ -2,6 +2,8 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +34,7 @@ protected CookieParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java index 63f3159bf0a..e1ba3eebdcf 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java @@ -2,6 +2,8 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -33,7 +35,7 @@ protected HeaderParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java index bef110af08d..516c5617cea 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java @@ -2,6 +2,8 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +34,7 @@ protected PathParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java index ed5aae7e580..6231807a5e9 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java @@ -2,6 +2,8 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +34,7 @@ protected QueryParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java index 871d4f073f3..ea3baa96711 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java @@ -4,6 +4,7 @@ import org.junit.Assert; import org.junit.Test; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +27,7 @@ public HeaderParameter(@Nullable Boolean explode) { } @Test - public void testHeaderSerialization() { + public void testHeaderSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -104,7 +105,7 @@ public PathParameter(@Nullable Boolean explode) { } @Test - public void testPathSerialization() { + public void testPathSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -182,7 +183,7 @@ public CookieParameter(@Nullable Boolean explode) { } @Test - public void testCookieSerialization() { + public void testCookieSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -260,7 +261,7 @@ public PathMatrixParameter(@Nullable Boolean explode) { } @Test - public void testPathMatrixSerialization() { + public void testPathMatrixSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -331,7 +332,7 @@ public PathLabelParameter(@Nullable Boolean explode) { } @Test - public void testPathLabelSerialization() { + public void testPathLabelSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java index f4ea29fccb3..c10b33587ba 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java @@ -4,6 +4,7 @@ import org.junit.Assert; import org.junit.Test; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +27,7 @@ public QueryParameterNoStyle(@Nullable Boolean explode) { } @Test - public void testQueryParameterNoStyleSerialization() { + public void testQueryParameterNoStyleSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -104,7 +105,7 @@ public QueryParameterSpaceDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterSpaceDelimitedSerialization() { + public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -151,7 +152,7 @@ public QueryParameterPipeDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterPipeDelimitedSerialization() { + public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/src/main/resources/java/src/test/java/packagename/parameter/CookieSerializerTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/CookieSerializerTest.hbs index 519c675002c..7f04ccc894d 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/CookieSerializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/CookieSerializerTest.hbs @@ -2,6 +2,8 @@ package {{{packageName}}}.parameter; import org.junit.Assert; import org.junit.Test; +import {{{packageName}}}.exceptions.OpenapiDocumentException; +import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +34,7 @@ public class CookieSerializerTest { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/src/main/resources/java/src/test/java/packagename/parameter/HeadersSerializerTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/HeadersSerializerTest.hbs index c1ee270e699..871d97b52ec 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/HeadersSerializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/HeadersSerializerTest.hbs @@ -2,6 +2,8 @@ package {{{packageName}}}.parameter; import org.junit.Assert; import org.junit.Test; +import {{{packageName}}}.exceptions.OpenapiDocumentException; +import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -33,7 +35,7 @@ public class HeadersSerializerTest { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/src/main/resources/java/src/test/java/packagename/parameter/PathSerializerTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/PathSerializerTest.hbs index 75182fcb905..b9db6f5621d 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/PathSerializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/PathSerializerTest.hbs @@ -2,6 +2,8 @@ package {{{packageName}}}.parameter; import org.junit.Assert; import org.junit.Test; +import {{{packageName}}}.exceptions.OpenapiDocumentException; +import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +34,7 @@ public class PathSerializerTest { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/src/main/resources/java/src/test/java/packagename/parameter/QuerySerializerTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/QuerySerializerTest.hbs index 6fe0d72fa94..faeb1a36c66 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/QuerySerializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/QuerySerializerTest.hbs @@ -2,6 +2,8 @@ package {{{packageName}}}.parameter; import org.junit.Assert; import org.junit.Test; +import {{{packageName}}}.exceptions.OpenapiDocumentException; +import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +34,7 @@ public class QuerySerializerTest { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs index d12b67bd2e3..2d46ca26c4a 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs @@ -4,6 +4,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +27,7 @@ public class SchemaNonQueryParameterTest { } @Test - public void testHeaderSerialization() { + public void testHeaderSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -104,7 +105,7 @@ public class SchemaNonQueryParameterTest { } @Test - public void testPathSerialization() { + public void testPathSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -182,7 +183,7 @@ public class SchemaNonQueryParameterTest { } @Test - public void testCookieSerialization() { + public void testCookieSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -260,7 +261,7 @@ public class SchemaNonQueryParameterTest { } @Test - public void testPathMatrixSerialization() { + public void testPathMatrixSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -331,7 +332,7 @@ public class SchemaNonQueryParameterTest { } @Test - public void testPathLabelSerialization() { + public void testPathLabelSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs index 46532281884..65067feca82 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs @@ -4,6 +4,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +27,7 @@ public class SchemaQueryParameterTest { } @Test - public void testQueryParameterNoStyleSerialization() { + public void testQueryParameterNoStyleSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -104,7 +105,7 @@ public class SchemaQueryParameterTest { } @Test - public void testQueryParameterSpaceDelimitedSerialization() { + public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -151,7 +152,7 @@ public class SchemaQueryParameterTest { } @Test - public void testQueryParameterPipeDelimitedSerialization() { + public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); From 200a5aa0becd92fa5cc04c5e388db82294a75af1 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 14:50:28 -0700 Subject: [PATCH 32/53] Fixes cookie parameter test in java --- .../client/parameter/CookieSerializerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java index b940ebc4f6c..1c4f61300c1 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java @@ -34,7 +34,7 @@ protected CookieParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) From e5b5e80a7aa576465a62031b753be959d110653d Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 14:56:10 -0700 Subject: [PATCH 33/53] Fixes header tests --- .../client/header/ContentHeaderTest.java | 5 ++++- .../client/header/SchemaHeaderTest.java | 6 ++++-- .../src/test/java/packagename/header/ContentHeaderTest.hbs | 5 ++++- .../src/test/java/packagename/header/SchemaHeaderTest.hbs | 6 ++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java index 990f21a1148..64a34d3a6a2 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java @@ -5,6 +5,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -22,7 +25,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java index b0eaf780b2e..8dcb9715353 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java @@ -6,6 +6,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.ListJsonSchema; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -28,7 +30,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -126,7 +128,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserialization() { + public void testDeserialization() throws ValidationException, NotImplementedException, InvalidTypeException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); diff --git a/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs b/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs index 465de3766b8..8eab87ca449 100644 --- a/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs @@ -5,6 +5,9 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.mediatype.MediaType; import {{{packageName}}}.schemas.AnyTypeJsonSchema; @@ -22,7 +25,7 @@ public class ContentHeaderTest { } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs b/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs index 4af17ac9158..8b55d24ce61 100644 --- a/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs @@ -6,6 +6,8 @@ import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; import {{{packageName}}}.schemas.ListJsonSchema; import {{{packageName}}}.schemas.NullJsonSchema; @@ -28,7 +30,7 @@ public class SchemaHeaderTest { } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -126,7 +128,7 @@ public class SchemaHeaderTest { } @Test - public void testDeserialization() { + public void testDeserialization() throws ValidationException, NotImplementedException, InvalidTypeException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); From a1040ba640c027a029d5f7ec9e15bbdb9b2ec4c0 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 15:12:00 -0700 Subject: [PATCH 34/53] Regenerates java 303 sample with fixed schema tests --- .../java/.openapi-generator/FILES | 89 +++++++++++++++ .../java/docs/RootServerInfo.md | 23 ++++ .../client/RootServerInfo.java | 60 ++-------- ...rtiesAllowsASchemaWhichShouldValidate.java | 12 +- ...ditionalpropertiesAreAllowedByDefault.java | 28 ++--- .../AdditionalpropertiesCanExistByItself.java | 14 +-- ...lpropertiesShouldNotLookInApplicators.java | 60 +++++----- .../client/components/schemas/Allof.java | 86 +++++++-------- .../schemas/AllofCombinedWithAnyofOneof.java | 104 +++++++++--------- .../components/schemas/AllofSimpleTypes.java | 78 ++++++------- .../schemas/AllofWithBaseSchema.java | 90 +++++++-------- .../schemas/AllofWithOneEmptySchema.java | 26 ++--- .../schemas/AllofWithTheFirstEmptySchema.java | 26 ++--- .../schemas/AllofWithTheLastEmptySchema.java | 26 ++--- .../schemas/AllofWithTwoEmptySchemas.java | 26 ++--- .../client/components/schemas/Anyof.java | 52 ++++----- .../components/schemas/AnyofComplexTypes.java | 86 +++++++-------- .../schemas/AnyofWithBaseSchema.java | 58 +++++----- .../schemas/AnyofWithOneEmptySchema.java | 26 ++--- .../schemas/ArrayTypeMatchesArrays.java | 10 +- .../client/components/schemas/ByInt.java | 26 ++--- .../client/components/schemas/ByNumber.java | 26 ++--- .../components/schemas/BySmallNumber.java | 26 ++--- .../components/schemas/DateTimeFormat.java | 26 ++--- .../components/schemas/EmailFormat.java | 26 ++--- .../schemas/EnumWith0DoesNotMatchFalse.java | 22 ++-- .../schemas/EnumWith1DoesNotMatchTrue.java | 22 ++-- .../schemas/EnumWithEscapedCharacters.java | 8 +- .../schemas/EnumWithFalseDoesNotMatch0.java | 8 +- .../schemas/EnumWithTrueDoesNotMatch1.java | 8 +- .../components/schemas/EnumsInProperties.java | 30 ++--- .../components/schemas/ForbiddenProperty.java | 28 ++--- .../components/schemas/HostnameFormat.java | 26 ++--- ...ouldNotRaiseErrorWhenFloatDivisionInf.java | 14 +-- .../schemas/InvalidStringValueForDefault.java | 38 +++---- .../client/components/schemas/Ipv4Format.java | 26 ++--- .../client/components/schemas/Ipv6Format.java | 26 ++--- .../components/schemas/JsonPointerFormat.java | 26 ++--- .../components/schemas/MaximumValidation.java | 26 ++--- .../MaximumValidationWithUnsignedInteger.java | 26 ++--- .../schemas/MaxitemsValidation.java | 26 ++--- .../schemas/MaxlengthValidation.java | 26 ++--- .../Maxproperties0MeansTheObjectIsEmpty.java | 26 ++--- .../schemas/MaxpropertiesValidation.java | 26 ++--- .../components/schemas/MinimumValidation.java | 26 ++--- .../MinimumValidationWithSignedInteger.java | 26 ++--- .../schemas/MinitemsValidation.java | 26 ++--- .../schemas/MinlengthValidation.java | 26 ++--- .../schemas/MinpropertiesValidation.java | 26 ++--- ...NestedAllofToCheckValidationSemantics.java | 52 ++++----- ...NestedAnyofToCheckValidationSemantics.java | 52 ++++----- .../components/schemas/NestedItems.java | 48 ++++---- ...NestedOneofToCheckValidationSemantics.java | 52 ++++----- .../client/components/schemas/Not.java | 26 ++--- .../schemas/NotMoreComplexSchema.java | 38 +++---- .../schemas/NulCharactersInStrings.java | 8 +- .../schemas/ObjectPropertiesValidation.java | 32 +++--- .../client/components/schemas/Oneof.java | 52 ++++----- .../components/schemas/OneofComplexTypes.java | 86 +++++++-------- .../schemas/OneofWithBaseSchema.java | 58 +++++----- .../schemas/OneofWithEmptySchema.java | 26 ++--- .../components/schemas/OneofWithRequired.java | 88 +++++++++------ .../schemas/PatternIsNotAnchored.java | 26 ++--- .../components/schemas/PatternValidation.java | 26 ++--- .../PropertiesWithEscapedCharacters.java | 28 ++--- .../PropertyNamedRefThatIsNotAReference.java | 28 ++--- .../schemas/RefInAdditionalproperties.java | 12 +- .../client/components/schemas/RefInAllof.java | 26 ++--- .../client/components/schemas/RefInAnyof.java | 26 ++--- .../client/components/schemas/RefInItems.java | 12 +- .../client/components/schemas/RefInNot.java | 26 ++--- .../client/components/schemas/RefInOneof.java | 26 ++--- .../components/schemas/RefInProperty.java | 30 ++--- .../schemas/RequiredDefaultValidation.java | 28 ++--- .../schemas/RequiredValidation.java | 34 +++--- .../schemas/RequiredWithEmptyArray.java | 28 ++--- .../RequiredWithEscapedCharacters.java | 28 ++--- .../schemas/SimpleEnumValidation.java | 22 ++-- ...esNotDoAnythingIfThePropertyIsMissing.java | 26 ++--- .../schemas/UniqueitemsFalseValidation.java | 26 ++--- .../schemas/UniqueitemsValidation.java | 26 ++--- .../client/components/schemas/UriFormat.java | 26 ++--- .../schemas/UriReferenceFormat.java | 26 ++--- .../components/schemas/UriTemplateFormat.java | 26 ++--- .../configurations/ApiConfiguration.java | 35 ++++-- .../client/exceptions/BaseException.java | 2 +- .../exceptions/NotImplementedException.java | 8 ++ .../exceptions/OpenapiDocumentException.java | 8 ++ .../client/header/ContentHeader.java | 11 +- .../client/header/Header.java | 7 +- .../client/header/Rfc6570Serializer.java | 57 +++++----- .../client/header/SchemaHeader.java | 17 +-- .../client/header/StyleSerializer.java | 13 ++- .../client/parameter/ContentParameter.java | 8 +- .../client/parameter/CookieSerializer.java | 4 +- .../client/parameter/HeadersSerializer.java | 4 +- .../client/parameter/Parameter.java | 4 +- .../client/parameter/PathSerializer.java | 4 +- .../client/parameter/QuerySerializer.java | 4 +- .../client/parameter/SchemaParameter.java | 5 +- .../requestbody/RequestBodySerializer.java | 7 +- .../client/response/HeadersDeserializer.java | 5 +- .../client/response/ResponseDeserializer.java | 25 ++--- .../response/ResponsesDeserializer.java | 7 +- .../client/schemas/AnyTypeJsonSchema.java | 22 ++-- .../client/schemas/BooleanJsonSchema.java | 2 +- .../client/schemas/DateJsonSchema.java | 4 +- .../client/schemas/DateTimeJsonSchema.java | 4 +- .../client/schemas/DecimalJsonSchema.java | 2 +- .../client/schemas/DoubleJsonSchema.java | 4 +- .../client/schemas/FloatJsonSchema.java | 4 +- .../client/schemas/Int32JsonSchema.java | 6 +- .../client/schemas/Int64JsonSchema.java | 10 +- .../client/schemas/IntJsonSchema.java | 10 +- .../client/schemas/ListJsonSchema.java | 4 +- .../client/schemas/MapJsonSchema.java | 6 +- .../client/schemas/NotAnyTypeJsonSchema.java | 22 ++-- .../client/schemas/NullJsonSchema.java | 2 +- .../client/schemas/NumberJsonSchema.java | 10 +- .../client/schemas/StringJsonSchema.java | 8 +- .../client/schemas/UuidJsonSchema.java | 4 +- .../AdditionalPropertiesValidator.java | 4 +- .../schemas/validation/AllOfValidator.java | 4 +- .../schemas/validation/AnyOfValidator.java | 2 +- .../validation/BigDecimalValidator.java | 2 +- .../schemas/validation/ConstValidator.java | 2 +- .../schemas/validation/ContainsValidator.java | 2 +- .../validation/DefaultValueMethod.java | 4 +- .../DependentRequiredValidator.java | 2 +- .../validation/DependentSchemasValidator.java | 3 +- .../schemas/validation/ElseValidator.java | 2 +- .../schemas/validation/EnumValidator.java | 2 +- .../validation/ExclusiveMaximumValidator.java | 2 +- .../validation/ExclusiveMinimumValidator.java | 2 +- .../schemas/validation/FormatValidator.java | 6 +- .../schemas/validation/IfValidator.java | 2 +- .../schemas/validation/ItemsValidator.java | 3 +- .../client/schemas/validation/JsonSchema.java | 16 +-- .../validation/ListSchemaValidator.java | 2 +- .../validation/MapSchemaValidator.java | 2 +- .../validation/MaxContainsValidator.java | 2 +- .../schemas/validation/MaxItemsValidator.java | 2 +- .../validation/MaxLengthValidator.java | 2 +- .../validation/MaxPropertiesValidator.java | 2 +- .../schemas/validation/MaximumValidator.java | 2 +- .../validation/MinContainsValidator.java | 2 +- .../schemas/validation/MinItemsValidator.java | 2 +- .../validation/MinLengthValidator.java | 2 +- .../validation/MinPropertiesValidator.java | 2 +- .../schemas/validation/MinimumValidator.java | 2 +- .../validation/MultipleOfValidator.java | 2 +- .../schemas/validation/NotValidator.java | 2 +- .../validation/NullSchemaValidator.java | 3 - .../schemas/validation/OneOfValidator.java | 2 +- .../schemas/validation/PatternValidator.java | 2 +- .../validation/PrefixItemsValidator.java | 3 +- .../validation/PropertiesValidator.java | 3 +- .../validation/PropertyNamesValidator.java | 3 +- .../schemas/validation/RequiredValidator.java | 4 +- .../schemas/validation/ThenValidator.java | 3 +- .../schemas/validation/TypeValidator.java | 4 +- .../validation/UnevaluatedItemsValidator.java | 3 +- .../UnevaluatedPropertiesValidator.java | 6 +- .../validation/UniqueItemsValidator.java | 4 +- .../validation/UnsetAnyTypeJsonSchema.java | 22 ++-- .../client/servers/ServerProvider.java | 4 +- ...sAllowsASchemaWhichShouldValidateTest.java | 4 +- ...onalpropertiesAreAllowedByDefaultTest.java | 2 +- ...itionalpropertiesCanExistByItselfTest.java | 2 +- ...pertiesShouldNotLookInApplicatorsTest.java | 2 +- .../AllofCombinedWithAnyofOneofTest.java | 2 +- .../schemas/AllofSimpleTypesTest.java | 2 +- .../client/components/schemas/AllofTest.java | 2 +- .../schemas/AllofWithBaseSchemaTest.java | 2 +- .../schemas/AllofWithOneEmptySchemaTest.java | 2 +- .../AllofWithTheFirstEmptySchemaTest.java | 2 +- .../AllofWithTheLastEmptySchemaTest.java | 2 +- .../schemas/AllofWithTwoEmptySchemasTest.java | 2 +- .../schemas/AnyofComplexTypesTest.java | 6 +- .../client/components/schemas/AnyofTest.java | 6 +- .../schemas/AnyofWithBaseSchemaTest.java | 2 +- .../schemas/AnyofWithOneEmptySchemaTest.java | 4 +- .../schemas/ArrayTypeMatchesArraysTest.java | 2 +- .../BooleanTypeMatchesBooleansTest.java | 4 +- .../client/components/schemas/ByIntTest.java | 4 +- .../components/schemas/ByNumberTest.java | 4 +- .../components/schemas/BySmallNumberTest.java | 2 +- .../schemas/DateTimeFormatTest.java | 12 +- .../components/schemas/EmailFormatTest.java | 12 +- .../EnumWith0DoesNotMatchFalseTest.java | 4 +- .../EnumWith1DoesNotMatchTrueTest.java | 4 +- .../EnumWithEscapedCharactersTest.java | 4 +- .../EnumWithFalseDoesNotMatch0Test.java | 2 +- .../EnumWithTrueDoesNotMatch1Test.java | 2 +- .../schemas/EnumsInPropertiesTest.java | 4 +- .../schemas/ForbiddenPropertyTest.java | 2 +- .../schemas/HostnameFormatTest.java | 12 +- .../IntegerTypeMatchesIntegersTest.java | 4 +- ...NotRaiseErrorWhenFloatDivisionInfTest.java | 2 +- .../InvalidStringValueForDefaultTest.java | 4 +- .../components/schemas/Ipv4FormatTest.java | 12 +- .../components/schemas/Ipv6FormatTest.java | 12 +- .../schemas/JsonPointerFormatTest.java | 12 +- .../schemas/MaximumValidationTest.java | 6 +- ...imumValidationWithUnsignedIntegerTest.java | 6 +- .../schemas/MaxitemsValidationTest.java | 6 +- .../schemas/MaxlengthValidationTest.java | 8 +- ...xproperties0MeansTheObjectIsEmptyTest.java | 2 +- .../schemas/MaxpropertiesValidationTest.java | 10 +- .../schemas/MinimumValidationTest.java | 6 +- ...inimumValidationWithSignedIntegerTest.java | 10 +- .../schemas/MinitemsValidationTest.java | 6 +- .../schemas/MinlengthValidationTest.java | 6 +- .../schemas/MinpropertiesValidationTest.java | 10 +- ...edAllofToCheckValidationSemanticsTest.java | 2 +- ...edAnyofToCheckValidationSemanticsTest.java | 2 +- .../components/schemas/NestedItemsTest.java | 2 +- ...edOneofToCheckValidationSemanticsTest.java | 2 +- .../schemas/NotMoreComplexSchemaTest.java | 4 +- .../client/components/schemas/NotTest.java | 2 +- .../schemas/NulCharactersInStringsTest.java | 2 +- .../NullTypeMatchesOnlyTheNullObjectTest.java | 2 +- .../schemas/NumberTypeMatchesNumbersTest.java | 6 +- .../ObjectPropertiesValidationTest.java | 8 +- .../schemas/ObjectTypeMatchesObjectsTest.java | 2 +- .../schemas/OneofComplexTypesTest.java | 4 +- .../client/components/schemas/OneofTest.java | 4 +- .../schemas/OneofWithBaseSchemaTest.java | 2 +- .../schemas/OneofWithEmptySchemaTest.java | 2 +- .../schemas/OneofWithRequiredTest.java | 4 +- .../schemas/PatternIsNotAnchoredTest.java | 2 +- .../schemas/PatternValidationTest.java | 14 +-- .../PropertiesWithEscapedCharactersTest.java | 2 +- ...opertyNamedRefThatIsNotAReferenceTest.java | 2 +- .../RefInAdditionalpropertiesTest.java | 2 +- .../components/schemas/RefInAllofTest.java | 2 +- .../components/schemas/RefInAnyofTest.java | 2 +- .../components/schemas/RefInItemsTest.java | 2 +- .../components/schemas/RefInNotTest.java | 2 +- .../components/schemas/RefInOneofTest.java | 2 +- .../components/schemas/RefInPropertyTest.java | 2 +- .../RequiredDefaultValidationTest.java | 2 +- .../schemas/RequiredValidationTest.java | 8 +- .../schemas/RequiredWithEmptyArrayTest.java | 2 +- .../RequiredWithEscapedCharactersTest.java | 2 +- .../schemas/SimpleEnumValidationTest.java | 2 +- .../schemas/StringTypeMatchesStringsTest.java | 6 +- ...tDoAnythingIfThePropertyIsMissingTest.java | 4 +- .../UniqueitemsFalseValidationTest.java | 30 ++--- .../schemas/UniqueitemsValidationTest.java | 30 ++--- .../components/schemas/UriFormatTest.java | 12 +- .../schemas/UriReferenceFormatTest.java | 12 +- .../schemas/UriTemplateFormatTest.java | 12 +- .../client/header/ContentHeaderTest.java | 5 +- .../client/header/SchemaHeaderTest.java | 6 +- .../parameter/CookieSerializerTest.java | 4 +- .../parameter/HeadersSerializerTest.java | 4 +- .../client/parameter/PathSerializerTest.java | 4 +- .../client/parameter/QuerySerializerTest.java | 4 +- .../SchemaNonQueryParameterTest.java | 11 +- .../parameter/SchemaQueryParameterTest.java | 7 +- .../RequestBodySerializerTest.java | 9 +- .../response/ResponseDeserializerTest.java | 18 +-- .../client/schemas/AnyTypeSchemaTest.java | 24 ++-- .../client/schemas/ArrayTypeSchemaTest.java | 18 +-- .../client/schemas/BooleanSchemaTest.java | 8 +- .../client/schemas/ListSchemaTest.java | 5 +- .../client/schemas/MapSchemaTest.java | 5 +- .../client/schemas/NullSchemaTest.java | 6 +- .../client/schemas/NumberSchemaTest.java | 11 +- .../client/schemas/ObjectTypeSchemaTest.java | 38 +++---- .../client/schemas/RefBooleanSchemaTest.java | 8 +- .../AdditionalPropertiesValidatorTest.java | 7 +- .../validation/FormatValidatorTest.java | 28 ++--- .../validation/ItemsValidatorTest.java | 6 +- .../schemas/validation/JsonSchemaTest.java | 4 +- .../validation/PropertiesValidatorTest.java | 6 +- .../validation/RequiredValidatorTest.java | 6 +- .../schemas/validation/TypeValidatorTest.java | 2 +- .../components/schemas/Schema_test.hbs | 2 +- 280 files changed, 2136 insertions(+), 1937 deletions(-) create mode 100644 samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java create mode 100644 samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java diff --git a/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES b/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES index 89ec4058a24..f42a790caea 100644 --- a/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES +++ b/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES @@ -188,6 +188,8 @@ src/main/java/org/openapijsonschematools/client/exceptions/ApiException.java src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidTypeException.java +src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java +src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java src/main/java/org/openapijsonschematools/client/exceptions/UnsetPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/ValidationException.java src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -318,6 +320,93 @@ src/main/java/org/openapijsonschematools/client/servers/Server0.java src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java src/main/java/org/openapijsonschematools/client/servers/ServerWithVariables.java src/main/java/org/openapijsonschematools/client/servers/ServerWithoutVariables.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java src/test/java/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.java src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java diff --git a/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md b/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md index e1624a56d1f..02e74ac57a6 100644 --- a/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md +++ b/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md @@ -4,13 +4,36 @@ RootServerInfo.java public class RootServerInfo A class that provides a server, and any needed server info classes +- a class that is a 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 | | 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()
Creates an instance using default server variable values | +| RootServerInfo1(@Nullable [Server0](servers/Server0.md) server0)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [Server0](servers/Server0.md) | server0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + ## ServerIndex enum ServerIndex
diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java index d5c2f5cb5fd..7194d05eda1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java @@ -1,73 +1,33 @@ package org.openapijsonschematools.client; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server; import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.AbstractMap; -import java.util.Map; import java.util.Objects; -import java.util.EnumMap; -public class RootServerInfo implements ServerProvider { - final private Servers servers; - final private ServerIndex serverIndex; +public class RootServerInfo { + public static class RootServerInfo1 implements ServerProvider { + public final Server0 server0; - public RootServerInfo() { - this.servers = new Servers(); - this.serverIndex = ServerIndex.SERVER_0; - } - - public RootServerInfo(Servers servers, ServerIndex serverIndex) { - this.servers = servers; - this.serverIndex = serverIndex; - } - - public static class Servers { - private final EnumMap servers; - - public Servers() { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - new Server0() - ) - ) - ); + public RootServerInfo1() { + server0 = new Server0(); } - public Servers( + public RootServerInfo1( @Nullable Server0 server0 ) { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - Objects.requireNonNullElseGet(server0, Server0::new) - ) - ) - ); + this.server0 = Objects.requireNonNullElseGet(server0, Server0::new); } - public Server get(ServerIndex serverIndex) { - if (servers.containsKey(serverIndex)) { - return get(serverIndex); - } - throw new UnsetPropertyException(serverIndex+" is unset"); + @Override + public Server getServer(ServerIndex serverIndex) { + return server0; } } public enum ServerIndex { SERVER_0 } - - public Server getServer(@Nullable ServerIndex serverIndex) { - if (serverIndex == null) { - return servers.get(this.serverIndex); - } - return servers.get(serverIndex); - } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index b91c994ef9b..5e6abe6fc5d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -72,7 +72,7 @@ protected AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(FrozenMap<@Nul "foo", "bar" ); - public static AdditionalpropertiesAllowsASchemaWhichShouldValidateMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AdditionalpropertiesAllowsASchemaWhichShouldValidateMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance().validate(arg, configuration); } @@ -88,7 +88,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException, throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (boolean) value; } @@ -299,7 +299,7 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(Ma for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -307,7 +307,7 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(Ma Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -336,11 +336,11 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index e6517f75b10..a94cc959104 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -69,7 +69,7 @@ protected AdditionalpropertiesAreAllowedByDefaultMap(FrozenMap<@Nullable Object> "foo", "bar" ); - public static AdditionalpropertiesAreAllowedByDefaultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AdditionalpropertiesAreAllowedByDefaultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AdditionalpropertiesAreAllowedByDefault1.getInstance().validate(arg, configuration); } @@ -344,19 +344,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -372,15 +372,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -393,7 +393,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -404,7 +404,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -420,7 +420,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(Map arg, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -428,7 +428,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(Map arg, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -468,7 +468,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, Schema throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -483,7 +483,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, Schema } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalpropertiesAreAllowedByDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index 649e69307db..1add26d91a0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -45,7 +45,7 @@ protected AdditionalpropertiesCanExistByItselfMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AdditionalpropertiesCanExistByItselfMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AdditionalpropertiesCanExistByItselfMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AdditionalpropertiesCanExistByItself1.getInstance().validate(arg, configuration); } @@ -53,7 +53,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new InvalidTypeException("Value may not be null"); + throw new RuntimeException("Value may not be null"); } return (boolean) value; } @@ -133,7 +133,7 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(Map arg, Lis for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -141,12 +141,12 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(Map arg, Lis Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -173,11 +173,11 @@ public AdditionalpropertiesCanExistByItselfMap validate(Map arg, SchemaCon throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalpropertiesCanExistByItself1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index 46155636adf..6000d454536 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -70,7 +70,7 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema0.getInstance().validate(arg, configuration); } @@ -271,19 +271,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -299,15 +299,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -320,7 +320,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -331,7 +331,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -347,7 +347,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -355,7 +355,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -395,7 +395,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -410,7 +410,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -463,7 +463,7 @@ protected AdditionalpropertiesShouldNotLookInApplicatorsMap(FrozenMap m } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AdditionalpropertiesShouldNotLookInApplicatorsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AdditionalpropertiesShouldNotLookInApplicatorsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AdditionalpropertiesShouldNotLookInApplicators1.getInstance().validate(arg, configuration); } @@ -471,7 +471,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new InvalidTypeException("Value may not be null"); + throw new RuntimeException("Value may not be null"); } return (boolean) value; } @@ -619,19 +619,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -647,15 +647,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -668,7 +668,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -679,7 +679,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -695,7 +695,7 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(Map entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -703,12 +703,12 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(Map, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -746,7 +746,7 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap validate(Map arg, throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -761,7 +761,7 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap validate(Map arg, } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index f2c3bac9dfb..e19e222b2e4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -58,14 +58,14 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { "bar" ); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema0.getInstance().validate(arg, configuration); } public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -246,19 +246,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -274,15 +274,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -295,7 +295,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -322,7 +322,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +330,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -370,7 +370,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,7 +385,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -451,14 +451,14 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -621,19 +621,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -649,15 +649,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -670,7 +670,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -681,7 +681,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -697,7 +697,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +705,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -745,7 +745,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,7 +760,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -915,19 +915,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -943,15 +943,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -964,7 +964,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -975,7 +975,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -991,7 +991,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +999,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1039,7 +1039,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,7 +1054,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Allof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index e17daac12ce..f342708a0b3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -135,19 +135,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -163,15 +163,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -184,7 +184,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -195,7 +195,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -211,7 +211,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -259,7 +259,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -274,7 +274,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema02BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -420,19 +420,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -448,15 +448,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -469,7 +469,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -480,7 +480,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -496,7 +496,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -504,7 +504,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -544,7 +544,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -559,7 +559,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -705,19 +705,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -733,15 +733,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -754,7 +754,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -765,7 +765,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -781,7 +781,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -789,7 +789,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -829,7 +829,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -844,7 +844,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1004,19 +1004,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -1032,15 +1032,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -1053,7 +1053,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1064,7 +1064,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1080,7 +1080,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1088,7 +1088,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1128,7 +1128,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1143,7 +1143,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofCombinedWithAnyofOneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index 4c9d473a2f9..cfdfe8f7d24 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -134,19 +134,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -162,15 +162,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -183,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -194,7 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -210,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -258,7 +258,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,7 +273,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -419,19 +419,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -447,15 +447,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -468,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -479,7 +479,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -495,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -543,7 +543,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,7 +558,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -713,19 +713,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -741,15 +741,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -762,7 +762,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -773,7 +773,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -789,7 +789,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -797,7 +797,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -837,7 +837,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -852,7 +852,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofSimpleTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index a67e189c9e4..a05bd71d7c3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -59,14 +59,14 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema0.getInstance().validate(arg, configuration); } public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -229,19 +229,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -257,15 +257,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -278,7 +278,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -289,7 +289,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -305,7 +305,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -313,7 +313,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -353,7 +353,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -368,7 +368,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -434,14 +434,14 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { "baz" ); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } public Void baz() { @Nullable Object value = get("baz"); if (!(value == null || value instanceof Void)) { - throw new InvalidTypeException("Invalid value stored for baz"); + throw new RuntimeException("Invalid value stored for baz"); } return (Void) value; } @@ -604,19 +604,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -632,15 +632,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -653,7 +653,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -664,7 +664,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -680,7 +680,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -688,7 +688,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -728,7 +728,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -743,7 +743,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -809,14 +809,14 @@ protected AllofWithBaseSchemaMap(FrozenMap<@Nullable Object> m) { "bar" ); public static final Set optionalKeys = Set.of(); - public static AllofWithBaseSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static AllofWithBaseSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return AllofWithBaseSchema1.getInstance().validate(arg, configuration); } public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -1007,19 +1007,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -1035,15 +1035,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -1056,7 +1056,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1067,7 +1067,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1083,7 +1083,7 @@ public AllofWithBaseSchemaMap getNewInstance(Map arg, List pathToI for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1091,7 +1091,7 @@ public AllofWithBaseSchemaMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1131,7 +1131,7 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration config throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1146,7 +1146,7 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration config } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofWithBaseSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index 6ad17067551..df7ff6e1661 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -154,19 +154,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -182,15 +182,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -203,7 +203,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -214,7 +214,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -230,7 +230,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -238,7 +238,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -278,7 +278,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -293,7 +293,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 77063ed5e5c..48afc2705eb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -167,19 +167,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -195,15 +195,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofWithTheFirstEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index 0ea5f48a712..49eebf5cd46 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -167,19 +167,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -195,15 +195,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofWithTheLastEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index 6430ce42fd0..03a387d112d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -166,19 +166,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -194,15 +194,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -215,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -226,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -250,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -290,7 +290,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -305,7 +305,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofWithTwoEmptySchemas1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index 901e8939216..5dafc9805a3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -146,19 +146,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -174,15 +174,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -195,7 +195,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -206,7 +206,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -222,7 +222,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,7 +230,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -270,7 +270,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -285,7 +285,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -440,19 +440,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -468,15 +468,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -489,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -500,7 +500,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -516,7 +516,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -524,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -564,7 +564,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -579,7 +579,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Anyof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index 1057b9bce71..76ac59d0e64 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -58,14 +58,14 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { "bar" ); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema0.getInstance().validate(arg, configuration); } public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -246,19 +246,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -274,15 +274,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -295,7 +295,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -322,7 +322,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +330,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -370,7 +370,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,7 +385,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -451,14 +451,14 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -621,19 +621,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -649,15 +649,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -670,7 +670,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -681,7 +681,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -697,7 +697,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +705,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -745,7 +745,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,7 +760,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -915,19 +915,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -943,15 +943,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -964,7 +964,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -975,7 +975,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -991,7 +991,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +999,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1039,7 +1039,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,7 +1054,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AnyofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index c3885e3556d..f8740297732 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -134,19 +134,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -162,15 +162,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -183,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -194,7 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -210,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -258,7 +258,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,7 +273,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -419,19 +419,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -447,15 +447,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -468,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -479,7 +479,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -495,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -543,7 +543,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,7 +558,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -647,7 +647,7 @@ public static AnyofWithBaseSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -665,11 +665,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AnyofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index 8566d7392b2..a550e0b04b8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -167,19 +167,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -195,15 +195,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AnyofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java index 4a31884a01b..008bbe651a4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java @@ -39,7 +39,7 @@ public static class ArrayTypeMatchesArraysList extends FrozenList<@Nullable Obje protected ArrayTypeMatchesArraysList(FrozenList<@Nullable Object> m) { super(m); } - public static ArrayTypeMatchesArraysList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayTypeMatchesArraysList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ArrayTypeMatchesArrays1.getInstance().validate(arg, configuration); } } @@ -152,7 +152,7 @@ public ArrayTypeMatchesArraysList getNewInstance(List arg, List pathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -163,7 +163,7 @@ public ArrayTypeMatchesArraysList getNewInstance(List arg, List pathT return new ArrayTypeMatchesArraysList(newInstanceItems); } - public ArrayTypeMatchesArraysList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayTypeMatchesArraysList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -181,11 +181,11 @@ public ArrayTypeMatchesArraysList validate(List arg, SchemaConfiguration conf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayTypeMatchesArrays1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index ebcbb032fc3..d5326a3a257 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -141,19 +141,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -169,15 +169,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -190,7 +190,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -201,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -217,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -265,7 +265,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,7 +280,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ByInt1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index 828c756720c..ffa183d94ab 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -141,19 +141,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -169,15 +169,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -190,7 +190,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -201,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -217,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -265,7 +265,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,7 +280,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ByNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index c91371daa4a..2a7aca739ad 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -141,19 +141,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -169,15 +169,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -190,7 +190,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -201,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -217,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -265,7 +265,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,7 +280,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public BySmallNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index fd3953683af..5fa41afb598 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DateTimeFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index 97090800803..6c1fbceb093 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EmailFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java index 925c8e678d9..3c4c61d7168 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java @@ -121,7 +121,7 @@ public static EnumWith0DoesNotMatchFalse1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,39 +131,39 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws ValidationException { + public int validate(IntegerEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws ValidationException { + public long validate(LongEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws ValidationException { + public float validate(FloatEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws ValidationException { + public double validate(DoubleEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } @@ -175,11 +175,11 @@ public double validate(DoubleEnumWith0DoesNotMatchFalseEnums arg,SchemaConfigura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumWith0DoesNotMatchFalse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java index 3fc1f77d7d0..c728c06820a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java @@ -121,7 +121,7 @@ public static EnumWith1DoesNotMatchTrue1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,39 +131,39 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public int validate(IntegerEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public long validate(LongEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public float validate(FloatEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws ValidationException { + public double validate(DoubleEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } @@ -175,11 +175,11 @@ public double validate(DoubleEnumWith1DoesNotMatchTrueEnums arg,SchemaConfigurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumWith1DoesNotMatchTrue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java index d5dab170d98..ef586e9bf0f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java @@ -77,7 +77,7 @@ public static EnumWithEscapedCharacters1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -88,7 +88,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringEnumWithEscapedCharactersEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringEnumWithEscapedCharactersEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -100,11 +100,11 @@ public String validate(StringEnumWithEscapedCharactersEnums arg,SchemaConfigurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java index bfc0223b2f7..b9b58c3b67a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java @@ -73,7 +73,7 @@ public static EnumWithFalseDoesNotMatch01 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -84,7 +84,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public boolean validate(BooleanEnumWithFalseDoesNotMatch0Enums arg,SchemaConfiguration configuration) throws ValidationException { + public boolean validate(BooleanEnumWithFalseDoesNotMatch0Enums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -97,12 +97,12 @@ public boolean validate(BooleanEnumWithFalseDoesNotMatch0Enums arg,SchemaConfigu throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumWithFalseDoesNotMatch01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java index 4581de4b395..718dbc2a618 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java @@ -73,7 +73,7 @@ public static EnumWithTrueDoesNotMatch11 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -84,7 +84,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public boolean validate(BooleanEnumWithTrueDoesNotMatch1Enums arg,SchemaConfiguration configuration) throws ValidationException { + public boolean validate(BooleanEnumWithTrueDoesNotMatch1Enums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -97,12 +97,12 @@ public boolean validate(BooleanEnumWithTrueDoesNotMatch1Enums arg,SchemaConfigur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumWithTrueDoesNotMatch11BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index 3822c82493e..f4249e42cde 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -79,7 +79,7 @@ public static Foo getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,7 +90,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringFooEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringFooEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -102,11 +102,11 @@ public String validate(StringFooEnums arg,SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public FooBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -168,7 +168,7 @@ public static Bar getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -179,7 +179,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringBarEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringBarEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -191,11 +191,11 @@ public String validate(StringBarEnums arg,SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public BarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -220,14 +220,14 @@ protected EnumsInPropertiesMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static EnumsInPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static EnumsInPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return EnumsInProperties1.getInstance().validate(arg, configuration); } public String bar() { @Nullable Object value = get("bar"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -237,7 +237,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -369,7 +369,7 @@ public EnumsInPropertiesMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -377,7 +377,7 @@ public EnumsInPropertiesMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -406,11 +406,11 @@ public EnumsInPropertiesMap validate(Map arg, SchemaConfiguration configur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumsInProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index 75ee6ca186a..91ba47899c1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -59,7 +59,7 @@ protected ForbiddenPropertyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static ForbiddenPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ForbiddenPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ForbiddenProperty1.getInstance().validate(arg, configuration); } @@ -266,19 +266,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -294,15 +294,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -315,7 +315,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -326,7 +326,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -342,7 +342,7 @@ public ForbiddenPropertyMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -350,7 +350,7 @@ public ForbiddenPropertyMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -390,7 +390,7 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -405,7 +405,7 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ForbiddenProperty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index da84ef4c6ed..ef8f7abd410 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public HostnameFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java index e473cb0c78d..4d4a898835b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java @@ -63,7 +63,7 @@ public static InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1 getInstanc } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -73,19 +73,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -97,11 +97,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index bcb1f0ca8e1..c173a66a3ae 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -72,7 +72,7 @@ public static Bar getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,13 +90,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws InvalidTypeException { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -123,7 +123,7 @@ protected InvalidStringValueForDefaultMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "bar" ); - public static InvalidStringValueForDefaultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static InvalidStringValueForDefaultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return InvalidStringValueForDefault1.getInstance().validate(arg, configuration); } @@ -132,7 +132,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -288,19 +288,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -316,15 +316,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -337,7 +337,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -348,7 +348,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -364,7 +364,7 @@ public InvalidStringValueForDefaultMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -372,7 +372,7 @@ public InvalidStringValueForDefaultMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -412,7 +412,7 @@ public InvalidStringValueForDefaultMap validate(Map arg, SchemaConfigurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -427,7 +427,7 @@ public InvalidStringValueForDefaultMap validate(Map arg, SchemaConfigurati } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public InvalidStringValueForDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index 9db27444b5d..2e41d768129 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Ipv4Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index f52011acf83..44bb1ad124c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Ipv6Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index fce4b261f1d..be1979a67e9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public JsonPointerFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index ff2f9aec232..c7f2c5a8e50 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MaximumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index 9f2eefdd7cd..7526a6c6aba 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MaximumValidationWithUnsignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index dfbadbb5e68..ecc731f4c5b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MaxitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index 02d41b936b7..7b9aa8b0ab2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MaxlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index c71474bd82f..f68ad0814ad 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Maxproperties0MeansTheObjectIsEmpty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 5386164471a..921938fc2ea 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MaxpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index 29325be0f63..95951f93bef 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MinimumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 531298768ff..6505e110b19 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MinimumValidationWithSignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index 13a669101d6..96d61a607a9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MinitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index 835bdc24f37..036f3fcbc84 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MinlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index 1802917d267..9b3a02c1d92 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MinpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index b7648383ba2..3402fe153be 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -148,19 +148,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -176,15 +176,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -197,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -208,7 +208,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +232,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -272,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,7 +287,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -441,19 +441,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -469,15 +469,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -490,7 +490,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -501,7 +501,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -517,7 +517,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -565,7 +565,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,7 +580,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NestedAllofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index 7709bbbf75c..6b7545a33c8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -148,19 +148,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -176,15 +176,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -197,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -208,7 +208,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +232,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -272,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,7 +287,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -441,19 +441,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -469,15 +469,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -490,7 +490,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -501,7 +501,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -517,7 +517,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -565,7 +565,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,7 +580,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NestedAnyofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index 9e6928c1b4c..72122316653 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -38,7 +38,7 @@ public static class ItemsList extends FrozenList { protected ItemsList(FrozenList m) { super(m); } - public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Items2.getInstance().validate(arg, configuration); } } @@ -120,12 +120,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -134,7 +134,7 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche return new ItemsList(newInstanceItems); } - public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,11 +152,11 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Items2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -175,7 +175,7 @@ public static class ItemsList1 extends FrozenList { protected ItemsList1(FrozenList m) { super(m); } - public static ItemsList1 of(List> arg, SchemaConfiguration configuration) throws ValidationException { + public static ItemsList1 of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Items1.getInstance().validate(arg, configuration); } } @@ -242,12 +242,12 @@ public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList) itemInstance); i += 1; @@ -256,7 +256,7 @@ public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSch return new ItemsList1(newInstanceItems); } - public ItemsList1 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsList1 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -274,11 +274,11 @@ public ItemsList1 validate(List arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -297,7 +297,7 @@ public static class ItemsList2 extends FrozenList { protected ItemsList2(FrozenList m) { super(m); } - public static ItemsList2 of(List>> arg, SchemaConfiguration configuration) throws ValidationException { + public static ItemsList2 of(List>> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Items.getInstance().validate(arg, configuration); } } @@ -364,12 +364,12 @@ public ItemsList2 getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList1)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList1) itemInstance); i += 1; @@ -378,7 +378,7 @@ public ItemsList2 getNewInstance(List arg, List pathToItem, PathToSch return new ItemsList2(newInstanceItems); } - public ItemsList2 validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsList2 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -396,11 +396,11 @@ public ItemsList2 validate(List arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -419,7 +419,7 @@ public static class NestedItemsList extends FrozenList { protected NestedItemsList(FrozenList m) { super(m); } - public static NestedItemsList of(List>>> arg, SchemaConfiguration configuration) throws ValidationException { + public static NestedItemsList of(List>>> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return NestedItems1.getInstance().validate(arg, configuration); } } @@ -492,12 +492,12 @@ public NestedItemsList getNewInstance(List arg, List pathToItem, Path itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList2)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList2) itemInstance); i += 1; @@ -506,7 +506,7 @@ public NestedItemsList getNewInstance(List arg, List pathToItem, Path return new NestedItemsList(newInstanceItems); } - public NestedItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public NestedItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -524,11 +524,11 @@ public NestedItemsList validate(List arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NestedItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index e75084fe04d..7de97629ae1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -148,19 +148,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -176,15 +176,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -197,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -208,7 +208,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +232,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -272,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,7 +287,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -441,19 +441,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -469,15 +469,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -490,7 +490,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -501,7 +501,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -517,7 +517,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -565,7 +565,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,7 +580,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NestedOneofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index 98514e1cbff..fa609f4724a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -152,19 +152,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -180,15 +180,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -201,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -212,7 +212,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -276,7 +276,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Not1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index 0e92dc9eac8..55f4dc27279 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -57,7 +57,7 @@ protected NotMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static NotMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static NotMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Not.getInstance().validate(arg, configuration); } @@ -66,7 +66,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -151,7 +151,7 @@ public NotMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -159,7 +159,7 @@ public NotMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -188,11 +188,11 @@ public NotMap validate(Map arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NotBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -313,19 +313,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -341,15 +341,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -362,7 +362,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -373,7 +373,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -389,7 +389,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -397,7 +397,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -437,7 +437,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -452,7 +452,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NotMoreComplexSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java index cccbac4a8ff..ca9182d5ba5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java @@ -75,7 +75,7 @@ public static NulCharactersInStrings1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,7 +86,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringNulCharactersInStringsEnums arg,SchemaConfiguration configuration) throws ValidationException { + public String validate(StringNulCharactersInStringsEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return validate(arg.value(), configuration); } @@ -98,11 +98,11 @@ public String validate(StringNulCharactersInStringsEnums arg,SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NulCharactersInStrings1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index 01f7f868c52..a4a8c741d46 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -70,7 +70,7 @@ protected ObjectPropertiesValidationMap(FrozenMap<@Nullable Object> m) { "foo", "bar" ); - public static ObjectPropertiesValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectPropertiesValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectPropertiesValidation1.getInstance().validate(arg, configuration); } @@ -79,7 +79,7 @@ public Number foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (Number) value; } @@ -89,7 +89,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -279,19 +279,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -307,15 +307,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -328,7 +328,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -339,7 +339,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -355,7 +355,7 @@ public ObjectPropertiesValidationMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -363,7 +363,7 @@ public ObjectPropertiesValidationMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -403,7 +403,7 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -418,7 +418,7 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectPropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index 86951cf5e63..edecb920633 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -146,19 +146,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -174,15 +174,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -195,7 +195,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -206,7 +206,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -222,7 +222,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,7 +230,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -270,7 +270,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -285,7 +285,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -440,19 +440,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -468,15 +468,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -489,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -500,7 +500,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -516,7 +516,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -524,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -564,7 +564,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -579,7 +579,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Oneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index ee1966faee0..142c5352ac3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -58,14 +58,14 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { "bar" ); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema0.getInstance().validate(arg, configuration); } public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -246,19 +246,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -274,15 +274,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -295,7 +295,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -322,7 +322,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +330,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -370,7 +370,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,7 +385,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -451,14 +451,14 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -621,19 +621,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -649,15 +649,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -670,7 +670,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -681,7 +681,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -697,7 +697,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +705,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -745,7 +745,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,7 +760,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -915,19 +915,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -943,15 +943,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -964,7 +964,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -975,7 +975,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -991,7 +991,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +999,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1039,7 +1039,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,7 +1054,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OneofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index e9d3f27028e..498c42e870d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -134,19 +134,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -162,15 +162,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -183,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -194,7 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -210,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -258,7 +258,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,7 +273,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -419,19 +419,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -447,15 +447,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -468,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -479,7 +479,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -495,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -543,7 +543,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,7 +558,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -647,7 +647,7 @@ public static OneofWithBaseSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -665,11 +665,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OneofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index 96c4c68034b..55451f8710c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -167,19 +167,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -195,15 +195,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OneofWithEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index b62dc7bf97e..cc46195ec67 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -45,16 +45,24 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema0.getInstance().validate(arg, configuration); } public @Nullable Object bar() { - return getOrThrow("bar"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object foo() { - return getOrThrow("foo"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -350,19 +358,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -378,15 +386,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -399,7 +407,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -410,7 +418,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -426,7 +434,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -434,7 +442,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -474,7 +482,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -489,7 +497,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -545,16 +553,24 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return Schema1.getInstance().validate(arg, configuration); } public @Nullable Object baz() { - return getOrThrow("baz"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object foo() { - return getOrThrow("foo"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -850,19 +866,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -878,15 +894,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -899,7 +915,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -910,7 +926,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -926,7 +942,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -934,7 +950,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -974,7 +990,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -989,7 +1005,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1079,7 +1095,7 @@ public static OneofWithRequired1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1087,7 +1103,7 @@ public static OneofWithRequired1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1116,11 +1132,11 @@ public static OneofWithRequired1 getInstance() { throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OneofWithRequired1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index 49d4017ae06..2cef4137dea 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -143,19 +143,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -171,15 +171,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -192,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -203,7 +203,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -219,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -267,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PatternIsNotAnchored1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index 7e0ffabd596..e55c2ae533f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -143,19 +143,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -171,15 +171,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -192,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -203,7 +203,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -219,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -267,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PatternValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index 6e99b7bfe97..5b9c6730970 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -117,7 +117,7 @@ protected PropertiesWithEscapedCharactersMap(FrozenMap<@Nullable Object> m) { "foo\tbar", "foo\fbar" ); - public static PropertiesWithEscapedCharactersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PropertiesWithEscapedCharactersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PropertiesWithEscapedCharacters1.getInstance().validate(arg, configuration); } @@ -460,19 +460,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -488,15 +488,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -509,7 +509,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -520,7 +520,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -536,7 +536,7 @@ public PropertiesWithEscapedCharactersMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -544,7 +544,7 @@ public PropertiesWithEscapedCharactersMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -584,7 +584,7 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfigur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -599,7 +599,7 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfigur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PropertiesWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index 070d7d5977f..bd38cb5ac49 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -57,7 +57,7 @@ protected PropertyNamedRefThatIsNotAReferenceMap(FrozenMap<@Nullable Object> m) public static final Set optionalKeys = Set.of( "$ref" ); - public static PropertyNamedRefThatIsNotAReferenceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PropertyNamedRefThatIsNotAReferenceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return PropertyNamedRefThatIsNotAReference1.getInstance().validate(arg, configuration); } @@ -212,19 +212,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -240,15 +240,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -261,7 +261,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -272,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -288,7 +288,7 @@ public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -296,7 +296,7 @@ public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -336,7 +336,7 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -351,7 +351,7 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConf } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PropertyNamedRefThatIsNotAReference1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java index efa1e208ac7..6135d033ee5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java @@ -33,7 +33,7 @@ protected RefInAdditionalpropertiesMap(FrozenMap<@Nullable Object> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static RefInAdditionalpropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static RefInAdditionalpropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return RefInAdditionalproperties1.getInstance().validate(arg, configuration); } @@ -172,7 +172,7 @@ public RefInAdditionalpropertiesMap getNewInstance(Map arg, List p for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -180,12 +180,12 @@ public RefInAdditionalpropertiesMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable Object) propertyInstance); } @@ -212,11 +212,11 @@ public RefInAdditionalpropertiesMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInAdditionalproperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index a826571f87c..6dc12e4b003 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -142,19 +142,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -170,15 +170,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -191,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -202,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -266,7 +266,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,7 +281,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInAllof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index c77c290df32..748f35a4932 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -142,19 +142,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -170,15 +170,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -191,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -202,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -266,7 +266,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,7 +281,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInAnyof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java index ca25ea6cd5d..7af0444f567 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java @@ -27,7 +27,7 @@ public static class RefInItemsList extends FrozenList<@Nullable Object> { protected RefInItemsList(FrozenList<@Nullable Object> m) { super(m); } - public static RefInItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static RefInItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return RefInItems1.getInstance().validate(arg, configuration); } } @@ -140,12 +140,12 @@ public RefInItemsList getNewInstance(List arg, List pathToItem, PathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((@Nullable Object) itemInstance); i += 1; @@ -154,7 +154,7 @@ public RefInItemsList getNewInstance(List arg, List pathToItem, PathT return new RefInItemsList(newInstanceItems); } - public RefInItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public RefInItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,11 +172,11 @@ public RefInItemsList validate(List arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index 069ea431cda..8b9510b9002 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInNot1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index 16dfea00c74..3183ec6f20f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -142,19 +142,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -170,15 +170,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -191,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -202,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -266,7 +266,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,7 +281,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInOneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index d6ed9d63722..23a015c9ba5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -45,7 +45,7 @@ protected RefInPropertyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "a" ); - public static RefInPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static RefInPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return RefInProperty1.getInstance().validate(arg, configuration); } @@ -54,7 +54,7 @@ public static RefInPropertyMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for a"); + throw new RuntimeException("Invalid value stored for a"); } return (@Nullable Object) value; } @@ -258,19 +258,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -286,15 +286,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -307,7 +307,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -318,7 +318,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -334,7 +334,7 @@ public RefInPropertyMap getNewInstance(Map arg, List pathToItem, P for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -342,7 +342,7 @@ public RefInPropertyMap getNewInstance(Map arg, List pathToItem, P Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -382,7 +382,7 @@ public RefInPropertyMap validate(Map arg, SchemaConfiguration configuratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -397,7 +397,7 @@ public RefInPropertyMap validate(Map arg, SchemaConfiguration configuratio } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInProperty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index 8be0cb10a2a..85482519567 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -57,7 +57,7 @@ protected RequiredDefaultValidationMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static RequiredDefaultValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static RequiredDefaultValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return RequiredDefaultValidation1.getInstance().validate(arg, configuration); } @@ -264,19 +264,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -292,15 +292,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -313,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -324,7 +324,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -340,7 +340,7 @@ public RequiredDefaultValidationMap getNewInstance(Map arg, List p for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -348,7 +348,7 @@ public RequiredDefaultValidationMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -388,7 +388,7 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -403,7 +403,7 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RequiredDefaultValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index aeaff53e4dd..d08e1cad6f5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -70,12 +70,16 @@ protected RequiredValidationMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "bar" ); - public static RequiredValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static RequiredValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return RequiredValidation1.getInstance().validate(arg, configuration); } public @Nullable Object foo() { - return getOrThrow("foo"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object bar() throws UnsetPropertyException { @@ -358,19 +362,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -386,15 +390,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -407,7 +411,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -418,7 +422,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -434,7 +438,7 @@ public RequiredValidationMap getNewInstance(Map arg, List pathToIt for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -442,7 +446,7 @@ public RequiredValidationMap getNewInstance(Map arg, List pathToIt Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -482,7 +486,7 @@ public RequiredValidationMap validate(Map arg, SchemaConfiguration configu throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -497,7 +501,7 @@ public RequiredValidationMap validate(Map arg, SchemaConfiguration configu } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RequiredValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index 8f3fb5dbb03..e94a741e97e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -57,7 +57,7 @@ protected RequiredWithEmptyArrayMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static RequiredWithEmptyArrayMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static RequiredWithEmptyArrayMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return RequiredWithEmptyArray1.getInstance().validate(arg, configuration); } @@ -264,19 +264,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -292,15 +292,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -313,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -324,7 +324,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -340,7 +340,7 @@ public RequiredWithEmptyArrayMap getNewInstance(Map arg, List path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -348,7 +348,7 @@ public RequiredWithEmptyArrayMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -388,7 +388,7 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration con throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -403,7 +403,7 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RequiredWithEmptyArray1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index 4b8b674d256..1aa3ccfe301 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -49,7 +49,7 @@ protected RequiredWithEscapedCharactersMap(FrozenMap<@Nullable Object> m) { "foo\\bar" ); public static final Set optionalKeys = Set.of(); - public static RequiredWithEscapedCharactersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static RequiredWithEscapedCharactersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return RequiredWithEscapedCharacters1.getInstance().validate(arg, configuration); } @@ -1760,19 +1760,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -1788,15 +1788,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -1809,7 +1809,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1820,7 +1820,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1836,7 +1836,7 @@ public RequiredWithEscapedCharactersMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1844,7 +1844,7 @@ public RequiredWithEscapedCharactersMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1884,7 +1884,7 @@ public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfigurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1899,7 +1899,7 @@ public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfigurat } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RequiredWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java index 9234455603c..8db19def288 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java @@ -131,7 +131,7 @@ public static SimpleEnumValidation1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,39 +141,39 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws ValidationException { + public int validate(IntegerSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws ValidationException { + public long validate(LongSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws ValidationException { + public float validate(FloatSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws ValidationException { + public double validate(DoubleSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return (double) validate((Number) arg.value(), configuration); } @@ -185,11 +185,11 @@ public double validate(DoubleSimpleEnumValidationEnums arg,SchemaConfiguration c throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public SimpleEnumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java index e730c2690f0..33bb250f4b0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java @@ -67,7 +67,7 @@ public static Alpha getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -77,19 +77,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -101,11 +101,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AlphaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -128,7 +128,7 @@ protected TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap(FrozenMap< public static final Set optionalKeys = Set.of( "alpha" ); - public static TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance().validate(arg, configuration); } @@ -137,7 +137,7 @@ public Number alpha() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for alpha"); + throw new RuntimeException("Invalid value stored for alpha"); } return (Number) value; } @@ -246,7 +246,7 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstanc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -254,7 +254,7 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstanc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -283,11 +283,11 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap validate(Map< throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index 4399cec94a9..d4561044119 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UniqueitemsFalseValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index 2433913da51..f4fe001c795 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UniqueitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index bc2d00b8518..adb11efefbb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UriFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index bee6021f6cf..cbff063863a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UriReferenceFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index 16dead22e86..92042ca34fb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UriTemplateFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index 10f995aadef..90fa50e06e4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -12,41 +12,62 @@ public class ApiConfiguration { private final ServerInfo serverInfo; + private final ServerIndexInfo serverIndexInfo; private final @Nullable Duration timeout; public ApiConfiguration() { serverInfo = new ServerInfo(); + serverIndexInfo = new ServerIndexInfo(); timeout = null; } - public ApiConfiguration(ServerInfo serverInfo, Duration timeout) { + public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, Duration timeout) { this.serverInfo = serverInfo; + this.serverIndexInfo = serverIndexInfo; this.timeout = timeout; } public static class ServerInfo { - protected final RootServerInfo rootServerInfo; + protected final RootServerInfo.RootServerInfo1 rootServerInfo; public ServerInfo() { - rootServerInfo = new RootServerInfo(); + rootServerInfo = new RootServerInfo.RootServerInfo1(); } public ServerInfo( - @Nullable RootServerInfo rootServerInfo + RootServerInfo. @Nullable RootServerInfo1 rootServerInfo ) { - this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo::new); + this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo.RootServerInfo1::new); + } + } + + public static class ServerIndexInfo { + protected RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex; + public ServerIndexInfo() {} + + public ServerIndexInfo rootServerInfoServerIndex(RootServerInfo.ServerIndex serverIndex) { + this.rootServerInfoServerIndex = serverIndex; + return this; } } public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { - return serverInfo.rootServerInfo.getServer(serverIndex); + var serverProvider = serverInfo.rootServerInfo; + if (serverIndex == null) { + RootServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.rootServerInfoServerIndex; + if (configServerIndex == null) { + throw new RuntimeException("rootServerInfoServerIndex is unset"); + } + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); } public Map> getDefaultHeaders() { return new HashMap<>(); } - public@Nullable Duration getTimeout() { + public @Nullable Duration getTimeout() { return timeout; } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java index 3bea6999da1..268e9373289 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.exceptions; @SuppressWarnings("serial") -public class BaseException extends RuntimeException { +public class BaseException extends Exception { public BaseException(String s) { super(s); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java new file mode 100644 index 00000000000..4e9633c9d8d --- /dev/null +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.exceptions; + +@SuppressWarnings("serial") +public class NotImplementedException extends BaseException { + public NotImplementedException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java new file mode 100644 index 00000000000..7614532f832 --- /dev/null +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.exceptions; + +@SuppressWarnings("serial") +public class OpenapiDocumentException extends BaseException { + public OpenapiDocumentException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java index 2b09f2f77df..13c8f50bcc9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -5,6 +5,9 @@ import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.parameter.ParameterStyle; @@ -28,7 +31,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { for (Map.Entry> entry: content.entrySet()) { var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; String contentType = entry.getKey(); @@ -36,14 +39,14 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid var value = ContentTypeSerializer.toJson(castInData); return toHeaders(name, value); } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); } } throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { String inDataJoined = String.join(",", inData); // unsure if this is needed @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); if (validate) { @@ -52,7 +55,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid if (ContentTypeDetector.contentTypeIsJson(contentType)) { return entry.getValue().schema().validate(deserializedJson, configuration); } else { - throw new RuntimeException("Header deserialization of "+contentType+" has not yet been implemented"); + throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); } } throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java index ac9f6274b0d..89728acfb77 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java @@ -2,11 +2,14 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import java.net.http.HttpHeaders; import java.util.List; public interface Header { - HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration); - @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration); + HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException; + @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java index 7bac0c8a6be..79220e47cbf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java @@ -1,26 +1,22 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.AbstractMap; -import java.util.LinkedHashMap; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; -import static java.util.stream.Collectors.toList; -import static java.util.stream.Collectors.toMap; - public class Rfc6570Serializer { private static final String ENCODING = "UTF-8"; private static final Set namedParameterSeparators = Set.of("&", ";"); - private static String percentEncode(String s) { + private static String percentEncode(String s) throws NotImplementedException { if (s == null) { return ""; } @@ -31,11 +27,11 @@ private static String percentEncode(String s) { .replace("%7E", "~"); // This could be done faster with more hand-crafted code. } catch (UnsupportedEncodingException wow) { - throw new RuntimeException(wow.getMessage(), wow); + throw new NotImplementedException(wow.getMessage()); } } - private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) { + 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= @@ -62,7 +58,7 @@ private static String percentEncode(String s) { // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 return null; } - throw new InvalidTypeException("Unable to generate a rfc6570 item representation of "+item); + throw new NotImplementedException("Unable to generate a rfc6570 item representation of "+item); } private static String rfc6570StrNumberExpansion( @@ -71,7 +67,7 @@ private static String rfc6570StrNumberExpansion( 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; @@ -87,11 +83,15 @@ private static String rfc6570ListExpansion( PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { - var itemValues = inData.stream() - .map(v -> rfc6570ItemValue(v, percentEncode)) - .filter(Objects::nonNull) - .collect(toList()); + ) 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 ""; @@ -116,12 +116,19 @@ private static String rfc6570MapExpansion( PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { - var inDataMap = inData.entrySet().stream() - .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), rfc6570ItemValue(entry.getValue(), percentEncode))) - .filter(entry -> entry.getValue() != null) - .collect(toMap(Map.Entry::getKey, Map.Entry::getValue, (x, y) -> y, LinkedHashMap::new)); - + ) throws NotImplementedException { + Map inDataMap = new HashMap<>(); + 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 ""; @@ -143,7 +150,7 @@ protected static String rfc6570Expansion( boolean explode, boolean percentEncode, PrefixSeparatorIterator prefixSeparatorIterator - ) { + ) throws NotImplementedException { /* Separator is for separate variables like dict with explode true, not for array item separation @@ -181,6 +188,6 @@ protected static String rfc6570Expansion( ); } // bool, bytes, etc - throw new InvalidTypeException("Unable to generate a rfc6570 representation of "+inData); + throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java index e4fcfd99924..b253262dc13 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java @@ -3,6 +3,9 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.parameter.ParameterStyle; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; @@ -30,7 +33,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { var castInData = validate ? schema.validate(inData, configuration) : inData; boolean usedExplode = explode != null && explode; var value = StyleSerializer.serializeSimple(castInData, name, usedExplode, false); @@ -49,7 +52,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid 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) { + 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<>(); @@ -60,7 +63,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return castList; } - private @Nullable Object getCastInData(JsonSchema schema, List inData) { + private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { if (schema.type == null) { if (inData.size() == 1) { return inData.get(0); @@ -68,7 +71,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return getList(schema, inData); } else if (schema.type.size() == 1) { if (schema.type.equals(BOOLEAN_TYPES)) { - throw new RuntimeException("Boolean serialization is not defined in Rfc6570, there is no agreed upon way to sent a boolean, send a string enum instead"); + 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) { @@ -76,16 +79,16 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid } else if (schema.type.equals(LIST_TYPES)) { return getList(schema, inData); } else if (schema.type.equals(MAP_TYPES)) { - throw new RuntimeException("Header map deserialization has not yet been implemented"); + 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 RuntimeException("Header deserialization for schemas with multiple types has not yet been implemented"); + 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) { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { @Nullable Object castInData = getCastInData(schema, inData); if (validate) { return schema.validate(castInData, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java index d18be288684..f5fa5a0a75b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; public class StyleSerializer extends Rfc6570Serializer { public static String serializeSimple( @@ -8,7 +9,7 @@ public static String serializeSimple( String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); return rfc6570Expansion( name, @@ -24,7 +25,7 @@ public static String serializeForm( String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { // todo check that the prefix and suffix matches this one PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); return rfc6570Expansion( @@ -40,7 +41,7 @@ public static String serializeMatrix( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); return rfc6570Expansion( name, @@ -55,7 +56,7 @@ public static String serializeLabel( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); return rfc6570Expansion( name, @@ -70,7 +71,7 @@ public static String serializeSpaceDelimited( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); return rfc6570Expansion( name, @@ -85,7 +86,7 @@ public static String serializePipeDelimited( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); return rfc6570Expansion( name, diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java index 79a3e781051..431fa2c90da 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java @@ -3,6 +3,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import java.util.Map; @@ -17,16 +19,16 @@ public ContentParameter(String name, ParameterInType inType, boolean required, @ } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException { for (Map.Entry> entry: content.entrySet()) { String contentType = entry.getKey(); if (ContentTypeDetector.contentTypeIsJson(contentType)) { var value = ContentTypeSerializer.toJson(inData); return new AbstractMap.SimpleEntry<>(name, value); } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); } } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java index b04b2ca1754..4b8ff010aed 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java @@ -1,6 +1,8 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -13,7 +15,7 @@ protected CookieSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData) { + public String serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { String result = ""; Map sortedData = new TreeMap<>(inData); for (Map.Entry entry: sortedData.entrySet()) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java index b4a23229944..b9d6fb008bb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java @@ -1,6 +1,8 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.LinkedHashMap; @@ -14,7 +16,7 @@ protected HeadersSerializer(Map parameters) { this.parameters = parameters; } - public Map> serialize(Map inData) { + public Map> serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { Map> results = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java index 9fe0745417c..2d9c85b603d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java @@ -1,9 +1,11 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData); + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java index 5864f89c901..4e1858f88f8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java @@ -1,6 +1,8 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -12,7 +14,7 @@ protected PathSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData, String pathWithPlaceholders) { + public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException, OpenapiDocumentException { String result = pathWithPlaceholders; for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java index 91ea0b041bb..c5f39d81aff 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java @@ -1,6 +1,8 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.HashMap; @@ -14,7 +16,7 @@ protected QuerySerializer(Map parameters) { this.parameters = parameters; } - public Map getQueryMap(Map inData) { + public Map getQueryMap(Map inData) throws NotImplementedException, OpenapiDocumentException { Map results = new HashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java index 8acfdafcc8a..eef0b6bc371 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java @@ -2,6 +2,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.header.StyleSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import java.util.AbstractMap; @@ -26,7 +27,7 @@ private ParameterStyle getStyle() { } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { ParameterStyle usedStyle = getStyle(); boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; String value; @@ -52,7 +53,7 @@ public AbstractMap.SimpleEntry serialize(@Nullable Object inData } else { // usedStyle == ParameterStyle.DEEP_OBJECT // query - throw new RuntimeException("Style deep object serialization has not yet been implemented."); + throw new NotImplementedException("Style deep object serialization has not yet been implemented."); } return new AbstractMap.SimpleEntry<>(name, value); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java index 37fb90cd4f2..6be6cbffd80 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java @@ -5,6 +5,7 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.Map; @@ -33,14 +34,14 @@ private SerializedRequestBody serializeTextPlain(String contentType, @Nullable O 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) { + 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 RuntimeException("Serialization has not yet been implemented for contentType="+contentType+". If you need it please file a PR"); + 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); + public abstract SerializedRequestBody serialize(T requestBody) throws NotImplementedException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java index bbd744abebc..d0eeaaa566d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java @@ -2,6 +2,9 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.header.Header; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; @@ -18,7 +21,7 @@ public HeadersDeserializer(Map headers, MapSchemaValidator headersToValidate = new HashMap<>(); for (Map.Entry> entry: responseHeaders.map().entrySet()) { String headerName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java index 59079f9f1a1..17b0895e57c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java @@ -7,31 +7,28 @@ import java.util.Optional; import org.checkerframework.checker.nullness.qual.Nullable; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.ToNumberPolicy; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.header.Header; public abstract class ResponseDeserializer { public final Map content; public final @Nullable Map headers; - private static final Gson gson = new GsonBuilder() - .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .create(); public ResponseDeserializer(Map content) { this.content = content; this.headers = null; } - protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration); - protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration); + protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException; + protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException; protected @Nullable Object deserializeJson(byte[] body) { String bodyStr = new String(body, StandardCharsets.UTF_8); @@ -42,7 +39,7 @@ protected String deserializeTextPlain(byte[] body) { return new String(body, StandardCharsets.UTF_8); } - protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) { + protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { if (ContentTypeDetector.contentTypeIsJson(contentType)) { @Nullable Object bodyData = deserializeJson(body); return schema.validateAndBox(bodyData, configuration); @@ -50,17 +47,17 @@ protected T deserializeBody(String contentType, byte[] body, JsonSchema s String bodyData = deserializeTextPlain(body); return schema.validateAndBox(bodyData, configuration); } - throw new RuntimeException("Deserialization for contentType="+contentType+" has not yet been implemented."); + throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); } - public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { - throw new RuntimeException("Invalid response returned, Content-Type header is missing and it must be included"); + throw new OpenapiDocumentException("Invalid response returned, Content-Type header is missing and it must be included"); } String contentType = contentTypeInfo.get(); if (content != null && !content.containsKey(contentType)) { - throw new RuntimeException( + throw new OpenapiDocumentException( "Invalid contentType returned. contentType="+contentType+" was returned "+ "when only "+content.keySet()+" are defined for statusCode="+response.statusCode() ); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java index 20b56db17da..26204003e31 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java @@ -2,7 +2,12 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import java.net.http.HttpResponse; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration); + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index 0ffcae114bd..6bc6fe04985 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -121,19 +121,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -149,15 +149,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -170,7 +170,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -197,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -205,7 +205,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -241,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java index 2cceae9d49f..a5e697bc7e1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java @@ -60,7 +60,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index 15b5ca67f26..bc63f4a4bcb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -57,7 +57,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -66,7 +66,7 @@ public String validate(LocalDate arg, SchemaConfiguration configuration) throws if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java index e695f3c2ac9..04afec44e81 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java @@ -57,7 +57,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -66,7 +66,7 @@ public String validate(ZonedDateTime arg, SchemaConfiguration configuration) thr if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java index f961e94f802..053ed1d9194 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java @@ -61,7 +61,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java index 56f7894f670..30409a5bfa0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java @@ -56,7 +56,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -65,7 +65,7 @@ public double validate(double arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java index 65221627b46..b06048101bd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java @@ -56,7 +56,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @@ -65,7 +65,7 @@ public float validate(float arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java index 836fa1db724..0007819ca43 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java @@ -59,11 +59,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } @@ -72,7 +72,7 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java index da3f9d8d5f7..ab1735795d1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java @@ -61,19 +61,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -82,7 +82,7 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java index 6205c5b4380..16a442386f2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java @@ -61,19 +61,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -82,7 +82,7 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index 7ebb3106467..0f6e5062fae 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -56,7 +56,7 @@ public static ListJsonSchema1 getInstance() { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -82,7 +82,7 @@ public static ListJsonSchema1 getInstance() { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index 47e141dac53..e397fcadc47 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -54,7 +54,7 @@ public static MapJsonSchema1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -62,7 +62,7 @@ public static MapJsonSchema1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -86,7 +86,7 @@ public static MapJsonSchema1 getInstance() { if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index de1ed91b0cd..1135409baef 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -123,19 +123,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -151,15 +151,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -172,7 +172,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -199,7 +199,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -207,7 +207,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -243,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java index d028dbf295e..483996081d7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java @@ -60,7 +60,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java index 5c33b047d95..d5650985076 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java @@ -60,19 +60,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -81,7 +81,7 @@ public double validate(double arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java index 749f5faba63..d200689b1f5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java @@ -57,15 +57,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -74,7 +74,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java index c2087929db7..85b94ee2403 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java @@ -57,7 +57,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -66,7 +66,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java index 64d9f476798..b7afc854c15 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java @@ -1,5 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -11,7 +13,7 @@ public class AdditionalPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java index eb6bcf21d4a..4b969c68a20 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java @@ -1,11 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; public class AllOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var allOf = data.schema().allOf; if (allOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java index d466518d3fe..19d4e0337c9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java @@ -10,7 +10,7 @@ public class AnyOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var anyOf = data.schema().anyOf; if (anyOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java index cb28fcb9662..639d32e889e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java @@ -5,7 +5,7 @@ import java.math.BigDecimal; public abstract class BigDecimalValidator { - protected BigDecimal getBigDecimal(Number arg) { + protected BigDecimal getBigDecimal(Number arg) throws ValidationException { if (arg instanceof Integer) { return new BigDecimal((Integer) arg); } else if (arg instanceof Long) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java index 6409a23e5ca..93872adcc2f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java @@ -10,7 +10,7 @@ public class ConstValidator extends BigDecimalValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!data.schema().constValueSet) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java index fbfd1c9c700..41565577d58 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java @@ -9,7 +9,7 @@ public class ContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof List)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java index 43fe8423969..1a0611f1b8e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java @@ -1,5 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; + public interface DefaultValueMethod { - T defaultValue(); + T defaultValue() throws InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java index 77b21ca801d..2640e2f6d8d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java @@ -11,7 +11,7 @@ public class DependentRequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java index e329529fe8a..f51b5eaf339 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashSet; import java.util.Map; @@ -10,7 +11,7 @@ public class DependentSchemasValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java index 3f50d9326c4..337af4a9a60 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java @@ -8,7 +8,7 @@ public class ElseValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var elseSchema = data.schema().elseSchema; if (elseSchema == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java index 8af756619bd..66563d80960 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java @@ -15,7 +15,7 @@ private static boolean enumContainsArg(Set<@Nullable Object> enumValues, @Nullab @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var enumValues = data.schema().enumValues; if (enumValues == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java index 7d05ff65546..e05df98079f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMaximum = data.schema().exclusiveMaximum; if (exclusiveMaximum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java index 73eb1e547c3..0e06f391f62 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMinimum = data.schema().exclusiveMinimum; if (exclusiveMinimum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java index c1ca45e44f3..35c089a03c7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java @@ -18,7 +18,7 @@ public class FormatValidator implements KeywordValidator { private final static BigDecimal doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308d); private final static BigDecimal doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308d); - private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) { + private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) throws ValidationException { if (format.startsWith("int")) { // there is a json schema test where 1.0 validates as an integer BigInteger intArg; @@ -85,7 +85,7 @@ private static void validateNumericFormat(Number arg, ValidationMetadata validat } } - private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) { + private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { switch (format) { case "uuid" -> { try { @@ -133,7 +133,7 @@ private static void validateStringFormat(String arg, ValidationMetadata validati @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var format = data.schema().format; if (format == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java index b145ab8007a..2a05893a22a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java @@ -7,7 +7,7 @@ public class IfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var ifSchema = data.schema().ifSchema; if (ifSchema == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java index 1b03c0b3094..68d62107337 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class ItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var items = data.schema().items; if (items == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index beb7460b86c..d6f5cdab7b7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -221,7 +221,7 @@ protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { this.keywordToValidator = keywordToValidator; } - public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; + public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas); public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; @@ -262,7 +262,7 @@ private List getContainsPathToSchemas( private PathToSchemasMap getPatternPropertiesPathToSchemas( @Nullable Object arg, ValidationMetadata validationMetadata - ) { + ) throws ValidationException { if (!(arg instanceof Map mapArg) || patternProperties == null) { return new PathToSchemasMap(); } @@ -270,7 +270,7 @@ private PathToSchemasMap getPatternPropertiesPathToSchemas( for (Map.Entry entry: mapArg.entrySet()) { Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new InvalidTypeException("Invalid non-string type for map key"); + throw new ValidationException("Invalid non-string type for map key"); } List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); propPathToItem.add(key); @@ -306,7 +306,7 @@ private PathToSchemasMap getIfPathToSchemas( try { var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException | InvalidTypeException ignored) {} + } catch (ValidationException ignored) {} return pathToSchemas; } @@ -389,7 +389,7 @@ protected Void castToAllowedTypes(Void arg, List pathToItem, Set castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws InvalidTypeException { pathSet.add(pathToItem); List<@Nullable Object> argFixed = new ArrayList<>(); int i =0; @@ -403,7 +403,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws InvalidTypeException { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @@ -420,7 +420,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set pathToItem, Set> pathSet) { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws InvalidTypeException { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { @@ -468,7 +468,7 @@ public String getNewInstance(String arg, List pathToItem, PathToSchemasM return arg; } - protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) { + protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) throws ValidationException { PathToSchemasMap pathToSchemasMap = new PathToSchemasMap(); // todo add check of validationMetadata.validationRanEarlier(this) PathToSchemasMap otherPathToSchemas = validate(jsonSchema, arg, validationMetadata); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index d0ff52b29c8..2ef994a9c9f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -7,7 +7,7 @@ import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java index 984693428e8..5633ebe09f9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java @@ -8,7 +8,7 @@ import java.util.Map; public interface MapSchemaValidator { - OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java index 9e9b3b92c18..315771b9e0c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java @@ -9,7 +9,7 @@ public class MaxContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxContains = data.schema().maxContains; if (maxContains == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java index 98ed5cb4ff4..2749843cbf2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java @@ -9,7 +9,7 @@ public class MaxItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxItems = data.schema().maxItems; if (maxItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java index 08d91666c5d..f2a77fa91f6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java @@ -7,7 +7,7 @@ public class MaxLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxLength = data.schema().maxLength; if (maxLength == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java index d117f1688e2..57a53e71be5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java @@ -9,7 +9,7 @@ public class MaxPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxProperties = data.schema().maxProperties; if (maxProperties == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java index 702f09686dc..df1c7f5c338 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java @@ -7,7 +7,7 @@ public class MaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maximum = data.schema().maximum; if (maximum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java index 1827e95cc83..6ea4404dc1f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java @@ -9,7 +9,7 @@ public class MinContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minContains = data.schema().minContains; if (minContains == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java index d1933ca7750..25bae60bda7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java @@ -9,7 +9,7 @@ public class MinItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minItems = data.schema().minItems; if (minItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java index 1defdc891e3..f4639e8a207 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java @@ -7,7 +7,7 @@ public class MinLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minLength = data.schema().minLength; if (minLength == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java index c0b99e7fb7d..011ac76dd31 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java @@ -9,7 +9,7 @@ public class MinPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minProperties = data.schema().minProperties; if (minProperties == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java index 3b539120e42..76065fe50b5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java @@ -7,7 +7,7 @@ public class MinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minimum = data.schema().minimum; if (minimum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java index eebc07a0f10..d8273d04d9c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java @@ -9,7 +9,7 @@ public class MultipleOfValidator extends BigDecimalValidator implements KeywordV @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var multipleOf = data.schema().multipleOf; if (multipleOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java index b077e2056a1..3e6b8e91e7c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java @@ -7,7 +7,7 @@ public class NotValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var not = data.schema().not; if (not == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java index c49fc0150fe..89924e90d5a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java @@ -4,9 +4,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; -import java.util.List; -import java.util.Set; - public interface NullSchemaValidator { Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java index 3c4f4b5a085..7dd5f4128ac 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java @@ -10,7 +10,7 @@ public class OneOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var oneOf = data.schema().oneOf; if (oneOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java index eceeb19e311..d7eebd78098 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java @@ -7,7 +7,7 @@ public class PatternValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var pattern = data.schema().pattern; if (pattern == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java index 237bc250190..510f3a8760e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class PrefixItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var prefixItems = data.schema().prefixItems; if (prefixItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java index b8ddd6fcb46..8803b661fd6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -12,7 +13,7 @@ public class PropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var properties = data.schema().properties; if (properties == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java index 087cd308b11..0169ff5bdba 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +11,7 @@ public class PropertyNamesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var propertyNames = data.schema().propertyNames; if (propertyNames == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java index f2e1a8ecde8..2519cbcfd3b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -12,7 +12,7 @@ public class RequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var required = data.schema().required; if (required == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java index bf599bc812f..75c083e2edc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ThenValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var then = data.schema().then; if (then == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java index bb4133a770e..300d472cfdf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; import java.util.Map; @@ -10,7 +10,7 @@ public class TypeValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var type = data.schema().type; if (type == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java index 8903d0b19a7..407904da444 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class UnevaluatedItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedItems = data.schema().unevaluatedItems; if (unevaluatedItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java index 344c0cfab1b..8fd34950404 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -11,7 +11,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedProperties = data.schema().unevaluatedProperties; if (unevaluatedProperties == null) { return null; @@ -27,7 +27,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { JsonSchema unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties); for(Map.Entry entry: mapArg.entrySet()) { if (!(entry.getKey() instanceof String propName)) { - throw new InvalidTypeException("Map keys must be strings"); + throw new ValidationException("Map keys must be strings"); } List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); propPathToItem.add(propName); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java index a42a7d60b60..6b40ba79fff 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -11,7 +11,7 @@ public class UniqueItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var uniqueItems = data.schema().uniqueItems; if (uniqueItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index 1c23a427dd0..f5604144fe7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -108,19 +108,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return (double) validate((Number) arg, configuration); } @@ -136,15 +136,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return validate(arg.toString(), configuration); } @@ -157,7 +157,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -184,7 +184,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -192,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java index 8c93a971aae..f736485870c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java @@ -1,8 +1,6 @@ package org.openapijsonschematools.client.servers; -import org.checkerframework.checker.nullness.qual.Nullable; - public interface ServerProvider { - Server getServer(@Nullable T serverIndex); + Server getServer(T serverIndex); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java index e78afe58438..cc0235a41a3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java @@ -18,7 +18,7 @@ public class AdditionalpropertiesAllowsASchemaWhichShouldValidateTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNoAdditionalPropertiesIsValidPasses() { + public void testNoAdditionalPropertiesIsValidPasses() throws ValidationException, InvalidTypeException { // no additional properties is valid final var schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testNoAdditionalPropertiesIsValidPasses() { } @Test - public void testAnAdditionalValidPropertyIsValidPasses() { + public void testAnAdditionalValidPropertyIsValidPasses() throws ValidationException, InvalidTypeException { // an additional valid property is valid final var schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java index b279d9037a1..2800d7992ff 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java @@ -18,7 +18,7 @@ public class AdditionalpropertiesAreAllowedByDefaultTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAdditionalPropertiesAreAllowedPasses() { + public void testAdditionalPropertiesAreAllowedPasses() throws ValidationException, InvalidTypeException { // additional properties are allowed final var schema = AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java index 8c8d5a930f8..a3cd2406db7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java @@ -18,7 +18,7 @@ public class AdditionalpropertiesCanExistByItselfTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnAdditionalValidPropertyIsValidPasses() { + public void testAnAdditionalValidPropertyIsValidPasses() throws ValidationException, InvalidTypeException { // an additional valid property is valid final var schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java index 576f44818fe..ebcfcc5527b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java @@ -42,7 +42,7 @@ public void testPropertiesDefinedInAllofAreNotExaminedFails() { } @Test - public void testValidTestCasePasses() { + public void testValidTestCasePasses() throws ValidationException, InvalidTypeException { // valid test case final var schema = AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java index e32dd818973..6b7bd47958b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java @@ -78,7 +78,7 @@ public void testAllofTrueAnyofFalseOneofFalseFails() { } @Test - public void testAllofTrueAnyofTrueOneofTruePasses() { + public void testAllofTrueAnyofTrueOneofTruePasses() throws ValidationException, InvalidTypeException { // allOf: true, anyOf: true, oneOf: true final var schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java index 6738af4533a..05d15b05628 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java @@ -33,7 +33,7 @@ public void testMismatchOneFails() { } @Test - public void testValidPasses() { + public void testValidPasses() throws ValidationException, InvalidTypeException { // valid final var schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java index 96ceb9d6354..1bf1c8f7e7a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java @@ -82,7 +82,7 @@ public void testMismatchFirstFails() { } @Test - public void testAllofPasses() { + public void testAllofPasses() throws ValidationException, InvalidTypeException { // allOf final var schema = Allof.Allof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java index 8b7da7ba706..94426b3db75 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java @@ -66,7 +66,7 @@ public void testMismatchFirstAllofFails() { } @Test - public void testValidPasses() { + public void testValidPasses() throws ValidationException, InvalidTypeException { // valid final var schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java index 4a51f3f1393..14ca1ed4b73 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java @@ -18,7 +18,7 @@ public class AllofWithOneEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnyDataIsValidPasses() { + public void testAnyDataIsValidPasses() throws ValidationException, InvalidTypeException { // any data is valid final var schema = AllofWithOneEmptySchema.AllofWithOneEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java index 84351d8fbe9..761dcdd392b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java @@ -33,7 +33,7 @@ public void testStringIsInvalidFails() { } @Test - public void testNumberIsValidPasses() { + public void testNumberIsValidPasses() throws ValidationException, InvalidTypeException { // number is valid final var schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java index f0a11562d85..2c2bc63ab13 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java @@ -33,7 +33,7 @@ public void testStringIsInvalidFails() { } @Test - public void testNumberIsValidPasses() { + public void testNumberIsValidPasses() throws ValidationException, InvalidTypeException { // number is valid final var schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java index b7bcf055a29..65901743265 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java @@ -18,7 +18,7 @@ public class AllofWithTwoEmptySchemasTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnyDataIsValidPasses() { + public void testAnyDataIsValidPasses() throws ValidationException, InvalidTypeException { // any data is valid final var schema = AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java index a931b23d567..881f4b79548 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java @@ -18,7 +18,7 @@ public class AnyofComplexTypesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testSecondAnyofValidComplexPasses() { + public void testSecondAnyofValidComplexPasses() throws ValidationException, InvalidTypeException { // second anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testSecondAnyofValidComplexPasses() { } @Test - public void testBothAnyofValidComplexPasses() { + public void testBothAnyofValidComplexPasses() throws ValidationException, InvalidTypeException { // both anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( @@ -52,7 +52,7 @@ public void testBothAnyofValidComplexPasses() { } @Test - public void testFirstAnyofValidComplexPasses() { + public void testFirstAnyofValidComplexPasses() throws ValidationException, InvalidTypeException { // first anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java index ef97ff6dff1..3bb76a50524 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java @@ -18,7 +18,7 @@ public class AnyofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBothAnyofValidPasses() { + public void testBothAnyofValidPasses() throws ValidationException, InvalidTypeException { // both anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testNeitherAnyofValidFails() { } @Test - public void testFirstAnyofValidPasses() { + public void testFirstAnyofValidPasses() throws ValidationException, InvalidTypeException { // first anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testFirstAnyofValidPasses() { } @Test - public void testSecondAnyofValidPasses() { + public void testSecondAnyofValidPasses() throws ValidationException, InvalidTypeException { // second anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java index b75095b0576..ae564038996 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java @@ -33,7 +33,7 @@ public void testMismatchBaseSchemaFails() { } @Test - public void testOneAnyofValidPasses() { + public void testOneAnyofValidPasses() throws ValidationException, InvalidTypeException { // one anyOf valid final var schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java index 8829498ffaa..df1375385f2 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java @@ -18,7 +18,7 @@ public class AnyofWithOneEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNumberIsValidPasses() { + public void testNumberIsValidPasses() throws ValidationException, InvalidTypeException { // number is valid final var schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testNumberIsValidPasses() { } @Test - public void testStringIsValidPasses() { + public void testStringIsValidPasses() throws ValidationException, InvalidTypeException { // string is valid final var schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java index 7320de65c06..5c55e234f84 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java @@ -48,7 +48,7 @@ public void testAFloatIsNotAnArrayFails() { } @Test - public void testAnArrayIsAnArrayPasses() { + public void testAnArrayIsAnArrayPasses() throws ValidationException, InvalidTypeException { // an array is an array final var schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java index 28095652c59..e1b339ecb80 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java @@ -48,7 +48,7 @@ public void testAStringIsNotABooleanFails() { } @Test - public void testFalseIsABooleanPasses() { + public void testFalseIsABooleanPasses() throws ValidationException, InvalidTypeException { // false is a boolean final var schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance(); schema.validate( @@ -58,7 +58,7 @@ public void testFalseIsABooleanPasses() { } @Test - public void testTrueIsABooleanPasses() { + public void testTrueIsABooleanPasses() throws ValidationException, InvalidTypeException { // true is a boolean final var schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java index 5238a51609e..de65e64d650 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java @@ -33,7 +33,7 @@ public void testIntByIntFailFails() { } @Test - public void testIntByIntPasses() { + public void testIntByIntPasses() throws ValidationException, InvalidTypeException { // int by int final var schema = ByInt.ByInt1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testIntByIntPasses() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException, InvalidTypeException { // ignores non-numbers final var schema = ByInt.ByInt1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java index c7a9bc144bd..accbea21a98 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java @@ -33,7 +33,7 @@ public void test35IsNotMultipleOf15Fails() { } @Test - public void test45IsMultipleOf15Passes() { + public void test45IsMultipleOf15Passes() throws ValidationException, InvalidTypeException { // 4.5 is multiple of 1.5 final var schema = ByNumber.ByNumber1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void test45IsMultipleOf15Passes() { } @Test - public void testZeroIsMultipleOfAnythingPasses() { + public void testZeroIsMultipleOfAnythingPasses() throws ValidationException, InvalidTypeException { // zero is multiple of anything final var schema = ByNumber.ByNumber1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java index 4bbf88c3921..ea0e9afbe83 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java @@ -33,7 +33,7 @@ public void test000751IsNotMultipleOf00001Fails() { } @Test - public void test00075IsMultipleOf00001Passes() { + public void test00075IsMultipleOf00001Passes() throws ValidationException, InvalidTypeException { // 0.0075 is multiple of 0.0001 final var schema = BySmallNumber.BySmallNumber1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java index a34d0f03faa..ad2fc557324 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java @@ -18,7 +18,7 @@ public class DateTimeFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { // all string formats ignore integers final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore nulls final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore objects final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore floats final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { // all string formats ignore arrays final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { // all string formats ignore booleans final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java index e09400e1157..ad5653fcc9c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java @@ -18,7 +18,7 @@ public class EmailFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { // all string formats ignore integers final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore nulls final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore objects final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore floats final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { // all string formats ignore arrays final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { // all string formats ignore booleans final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java index 3a72a8ab282..5a62cd2f344 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java @@ -18,7 +18,7 @@ public class EnumWith0DoesNotMatchFalseTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testFloatZeroIsValidPasses() { + public void testFloatZeroIsValidPasses() throws ValidationException, InvalidTypeException { // float zero is valid final var schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testFalseIsInvalidFails() { } @Test - public void testIntegerZeroIsValidPasses() { + public void testIntegerZeroIsValidPasses() throws ValidationException, InvalidTypeException { // integer zero is valid final var schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java index fbfeb797f7a..2520a972f25 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java @@ -33,7 +33,7 @@ public void testTrueIsInvalidFails() { } @Test - public void testFloatOneIsValidPasses() { + public void testFloatOneIsValidPasses() throws ValidationException, InvalidTypeException { // float one is valid final var schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testFloatOneIsValidPasses() { } @Test - public void testIntegerOneIsValidPasses() { + public void testIntegerOneIsValidPasses() throws ValidationException, InvalidTypeException { // integer one is valid final var schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java index 1b2fd92ec8e..666b6f44de0 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java @@ -33,7 +33,7 @@ public void testAnotherStringIsInvalidFails() { } @Test - public void testMember2IsValidPasses() { + public void testMember2IsValidPasses() throws ValidationException, InvalidTypeException { // member 2 is valid final var schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testMember2IsValidPasses() { } @Test - public void testMember1IsValidPasses() { + public void testMember1IsValidPasses() throws ValidationException, InvalidTypeException { // member 1 is valid final var schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java index 4737d1537ac..e9c71a6a552 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java @@ -33,7 +33,7 @@ public void testFloatZeroIsInvalidFails() { } @Test - public void testFalseIsValidPasses() { + public void testFalseIsValidPasses() throws ValidationException, InvalidTypeException { // false is valid final var schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java index 183135f6f0f..5a9e1d5dc15 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java @@ -48,7 +48,7 @@ public void testIntegerOneIsInvalidFails() { } @Test - public void testTrueIsValidPasses() { + public void testTrueIsValidPasses() throws ValidationException, InvalidTypeException { // true is valid final var schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java index 0917720a711..2fd29effafa 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java @@ -82,7 +82,7 @@ public void testMissingAllPropertiesIsInvalidFails() { } @Test - public void testBothPropertiesAreValidPasses() { + public void testBothPropertiesAreValidPasses() throws ValidationException, InvalidTypeException { // both properties are valid final var schema = EnumsInProperties.EnumsInProperties1.getInstance(); schema.validate( @@ -101,7 +101,7 @@ public void testBothPropertiesAreValidPasses() { } @Test - public void testMissingOptionalPropertyIsValidPasses() { + public void testMissingOptionalPropertyIsValidPasses() throws ValidationException, InvalidTypeException { // missing optional property is valid final var schema = EnumsInProperties.EnumsInProperties1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java index 82ee3dc86a9..6fc31a8a72d 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java @@ -42,7 +42,7 @@ public void testPropertyPresentFails() { } @Test - public void testPropertyAbsentPasses() { + public void testPropertyAbsentPasses() throws ValidationException, InvalidTypeException { // property absent final var schema = ForbiddenProperty.ForbiddenProperty1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java index 28827e12a61..1c0dca23e1e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java @@ -18,7 +18,7 @@ public class HostnameFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { // all string formats ignore integers final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore nulls final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore objects final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore floats final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { // all string formats ignore arrays final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { // all string formats ignore booleans final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java index 9bd3fc054a5..cbd4bf3b205 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java @@ -65,7 +65,7 @@ public void testNullIsNotAnIntegerFails() { } @Test - public void testAFloatWithZeroFractionalPartIsAnIntegerPasses() { + public void testAFloatWithZeroFractionalPartIsAnIntegerPasses() throws ValidationException, InvalidTypeException { // a float with zero fractional part is an integer final var schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance(); schema.validate( @@ -120,7 +120,7 @@ public void testAStringIsNotAnIntegerFails() { } @Test - public void testAnIntegerIsAnIntegerPasses() { + public void testAnIntegerIsAnIntegerPasses() throws ValidationException, InvalidTypeException { // an integer is an integer final var schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java index 9e11bdbcdb6..81c2e15f2f9 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java @@ -33,7 +33,7 @@ public void testAlwaysInvalidButNaiveImplementationsMayRaiseAnOverflowErrorFails } @Test - public void testValidIntegerWithMultipleofFloatPasses() { + public void testValidIntegerWithMultipleofFloatPasses() throws ValidationException, InvalidTypeException { // valid integer with multipleOf float final var schema = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java index 3a4c529692d..01a9eb81a57 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java @@ -18,7 +18,7 @@ public class InvalidStringValueForDefaultTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testValidWhenPropertyIsSpecifiedPasses() { + public void testValidWhenPropertyIsSpecifiedPasses() throws ValidationException, InvalidTypeException { // valid when property is specified final var schema = InvalidStringValueForDefault.InvalidStringValueForDefault1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testValidWhenPropertyIsSpecifiedPasses() { } @Test - public void testStillValidWhenTheInvalidDefaultIsUsedPasses() { + public void testStillValidWhenTheInvalidDefaultIsUsedPasses() throws ValidationException, InvalidTypeException { // still valid when the invalid default is used final var schema = InvalidStringValueForDefault.InvalidStringValueForDefault1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java index 0397a32aae1..37d503d4b45 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java @@ -18,7 +18,7 @@ public class Ipv4FormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { // all string formats ignore integers final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore nulls final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore objects final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore floats final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { // all string formats ignore arrays final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { // all string formats ignore booleans final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java index da110ec06c0..33d77de9d68 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java @@ -18,7 +18,7 @@ public class Ipv6FormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { // all string formats ignore integers final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore nulls final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore objects final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore floats final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { // all string formats ignore arrays final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { // all string formats ignore booleans final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java index 37ac945057a..e4e8b5ddda3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java @@ -18,7 +18,7 @@ public class JsonPointerFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { // all string formats ignore integers final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore nulls final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore objects final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore floats final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { // all string formats ignore arrays final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { // all string formats ignore booleans final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java index 060e7cbe47c..79f74a77fb6 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java @@ -33,7 +33,7 @@ public void testAboveTheMaximumIsInvalidFails() { } @Test - public void testBoundaryPointIsValidPasses() { + public void testBoundaryPointIsValidPasses() throws ValidationException, InvalidTypeException { // boundary point is valid final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testBoundaryPointIsValidPasses() { } @Test - public void testBelowTheMaximumIsValidPasses() { + public void testBelowTheMaximumIsValidPasses() throws ValidationException, InvalidTypeException { // below the maximum is valid final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testBelowTheMaximumIsValidPasses() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException, InvalidTypeException { // ignores non-numbers final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java index 7de1376dc82..814d01d4c1b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java @@ -33,7 +33,7 @@ public void testAboveTheMaximumIsInvalidFails() { } @Test - public void testBelowTheMaximumIsInvalidPasses() { + public void testBelowTheMaximumIsInvalidPasses() throws ValidationException, InvalidTypeException { // below the maximum is invalid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testBelowTheMaximumIsInvalidPasses() { } @Test - public void testBoundaryPointIntegerIsValidPasses() { + public void testBoundaryPointIntegerIsValidPasses() throws ValidationException, InvalidTypeException { // boundary point integer is valid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testBoundaryPointIntegerIsValidPasses() { } @Test - public void testBoundaryPointFloatIsValidPasses() { + public void testBoundaryPointFloatIsValidPasses() throws ValidationException, InvalidTypeException { // boundary point float is valid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java index f44118876b0..7aa925b9e6c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java @@ -18,7 +18,7 @@ public class MaxitemsValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() { + public void testShorterIsValidPasses() throws ValidationException, InvalidTypeException { // shorter is valid final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( @@ -30,7 +30,7 @@ public void testShorterIsValidPasses() { } @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { // exact length is valid final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( @@ -62,7 +62,7 @@ public void testTooLongIsInvalidFails() { } @Test - public void testIgnoresNonArraysPasses() { + public void testIgnoresNonArraysPasses() throws ValidationException, InvalidTypeException { // ignores non-arrays final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java index 441f220cf30..9fbfd1a6f13 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java @@ -18,7 +18,7 @@ public class MaxlengthValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() { + public void testShorterIsValidPasses() throws ValidationException, InvalidTypeException { // shorter is valid final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testShorterIsValidPasses() { } @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { // exact length is valid final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testTooLongIsInvalidFails() { } @Test - public void testIgnoresNonStringsPasses() { + public void testIgnoresNonStringsPasses() throws ValidationException, InvalidTypeException { // ignores non-strings final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -63,7 +63,7 @@ public void testIgnoresNonStringsPasses() { } @Test - public void testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() { + public void testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() throws ValidationException, InvalidTypeException { // two supplementary Unicode code points is long enough final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java index 203eab6db9a..8d5d7793a9a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java @@ -38,7 +38,7 @@ public void testOnePropertyIsInvalidFails() { } @Test - public void testNoPropertiesIsValidPasses() { + public void testNoPropertiesIsValidPasses() throws ValidationException, InvalidTypeException { // no properties is valid final var schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java index f0fae897e64..43c7dd65a0f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java @@ -18,7 +18,7 @@ public class MaxpropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() { + public void testShorterIsValidPasses() throws ValidationException, InvalidTypeException { // shorter is valid final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testShorterIsValidPasses() { } @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { // exact length is valid final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -80,7 +80,7 @@ public void testTooLongIsInvalidFails() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException, InvalidTypeException { // ignores other non-objects final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -90,7 +90,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeException { // ignores arrays final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -104,7 +104,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException, InvalidTypeException { // ignores strings final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java index 938de6c0c23..d7ac04c36d4 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java @@ -18,7 +18,7 @@ public class MinimumValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBoundaryPointIsValidPasses() { + public void testBoundaryPointIsValidPasses() throws ValidationException, InvalidTypeException { // boundary point is valid final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testBelowTheMinimumIsInvalidFails() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException, InvalidTypeException { // ignores non-numbers final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testIgnoresNonNumbersPasses() { } @Test - public void testAboveTheMinimumIsValidPasses() { + public void testAboveTheMinimumIsValidPasses() throws ValidationException, InvalidTypeException { // above the minimum is valid final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java index e5252c6c48a..9d8f90c5a54 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java @@ -18,7 +18,7 @@ public class MinimumValidationWithSignedIntegerTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBoundaryPointWithFloatIsValidPasses() { + public void testBoundaryPointWithFloatIsValidPasses() throws ValidationException, InvalidTypeException { // boundary point with float is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testBoundaryPointWithFloatIsValidPasses() { } @Test - public void testBoundaryPointIsValidPasses() { + public void testBoundaryPointIsValidPasses() throws ValidationException, InvalidTypeException { // boundary point is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testIntBelowTheMinimumIsInvalidFails() { } @Test - public void testPositiveAboveTheMinimumIsValidPasses() { + public void testPositiveAboveTheMinimumIsValidPasses() throws ValidationException, InvalidTypeException { // positive above the minimum is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -63,7 +63,7 @@ public void testPositiveAboveTheMinimumIsValidPasses() { } @Test - public void testNegativeAboveTheMinimumIsValidPasses() { + public void testNegativeAboveTheMinimumIsValidPasses() throws ValidationException, InvalidTypeException { // negative above the minimum is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -73,7 +73,7 @@ public void testNegativeAboveTheMinimumIsValidPasses() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException, InvalidTypeException { // ignores non-numbers final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java index fe973599a5f..7dc3192e63f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java @@ -18,7 +18,7 @@ public class MinitemsValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { // exact length is valid final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( @@ -30,7 +30,7 @@ public void testExactLengthIsValidPasses() { } @Test - public void testIgnoresNonArraysPasses() { + public void testIgnoresNonArraysPasses() throws ValidationException, InvalidTypeException { // ignores non-arrays final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( @@ -40,7 +40,7 @@ public void testIgnoresNonArraysPasses() { } @Test - public void testLongerIsValidPasses() { + public void testLongerIsValidPasses() throws ValidationException, InvalidTypeException { // longer is valid final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java index 8a0b2faf8f5..adc647c165d 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java @@ -18,7 +18,7 @@ public class MinlengthValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { // exact length is valid final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testExactLengthIsValidPasses() { } @Test - public void testLongerIsValidPasses() { + public void testLongerIsValidPasses() throws ValidationException, InvalidTypeException { // longer is valid final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testLongerIsValidPasses() { } @Test - public void testIgnoresNonStringsPasses() { + public void testIgnoresNonStringsPasses() throws ValidationException, InvalidTypeException { // ignores non-strings final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java index 109b3b7fbfd..5b71a8cbc5b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java @@ -18,7 +18,7 @@ public class MinpropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { // exact length is valid final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testExactLengthIsValidPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException, InvalidTypeException { // ignores other non-objects final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testLongerIsValidPasses() { + public void testLongerIsValidPasses() throws ValidationException, InvalidTypeException { // longer is valid final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -62,7 +62,7 @@ public void testLongerIsValidPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeException { // ignores arrays final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -89,7 +89,7 @@ public void testTooShortIsInvalidFails() { } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException, InvalidTypeException { // ignores strings final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java index 7f0e5197f48..a17f8c6c618 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java @@ -18,7 +18,7 @@ public class NestedAllofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() { + public void testNullIsValidPasses() throws ValidationException, InvalidTypeException { // null is valid final var schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java index 40c68fea595..f50fda5def8 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java @@ -18,7 +18,7 @@ public class NestedAnyofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() { + public void testNullIsValidPasses() throws ValidationException, InvalidTypeException { // null is valid final var schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java index a730cd66895..0dc4caa8617 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java @@ -100,7 +100,7 @@ public void testNotDeepEnoughFails() { } @Test - public void testValidNestedArrayPasses() { + public void testValidNestedArrayPasses() throws ValidationException, InvalidTypeException { // valid nested array final var schema = NestedItems.NestedItems1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java index e16c8bc3373..45f46052c93 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java @@ -18,7 +18,7 @@ public class NestedOneofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() { + public void testNullIsValidPasses() throws ValidationException, InvalidTypeException { // null is valid final var schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java index d3fbe75257c..b01c6a87295 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java @@ -18,7 +18,7 @@ public class NotMoreComplexSchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testOtherMatchPasses() { + public void testOtherMatchPasses() throws ValidationException, InvalidTypeException { // other match final var schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testMismatchFails() { } @Test - public void testMatchPasses() { + public void testMatchPasses() throws ValidationException, InvalidTypeException { // match final var schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java index bc2bc52984c..30f4486244c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java @@ -33,7 +33,7 @@ public void testDisallowedFails() { } @Test - public void testAllowedPasses() { + public void testAllowedPasses() throws ValidationException, InvalidTypeException { // allowed final var schema = Not.Not1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java index fb754a14c5f..06120d515d1 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java @@ -18,7 +18,7 @@ public class NulCharactersInStringsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMatchStringWithNulPasses() { + public void testMatchStringWithNulPasses() throws ValidationException, InvalidTypeException { // match string with nul final var schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java index 637d7878b59..fafa1dc6e12 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java @@ -95,7 +95,7 @@ public void testFalseIsNotNullFails() { } @Test - public void testNullIsNullPasses() { + public void testNullIsNullPasses() throws ValidationException, InvalidTypeException { // null is null final var schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java index 7158fd026db..07d3da67368 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java @@ -18,7 +18,7 @@ public class NumberTypeMatchesNumbersTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAFloatIsANumberPasses() { + public void testAFloatIsANumberPasses() throws ValidationException, InvalidTypeException { // a float is a number final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAFloatIsANumberPasses() { } @Test - public void testAnIntegerIsANumberPasses() { + public void testAnIntegerIsANumberPasses() throws ValidationException, InvalidTypeException { // an integer is a number final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( @@ -68,7 +68,7 @@ public void testABooleanIsNotANumberFails() { } @Test - public void testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() { + public void testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() throws ValidationException, InvalidTypeException { // a float with zero fractional part is a number (and an integer) final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java index 46aef85c136..17a2f31c1bb 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java @@ -18,7 +18,7 @@ public class ObjectPropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBothPropertiesPresentAndValidIsValidPasses() { + public void testBothPropertiesPresentAndValidIsValidPasses() throws ValidationException, InvalidTypeException { // both properties present and valid is valid final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -37,7 +37,7 @@ public void testBothPropertiesPresentAndValidIsValidPasses() { } @Test - public void testDoesnTInvalidateOtherPropertiesPasses() { + public void testDoesnTInvalidateOtherPropertiesPasses() throws ValidationException, InvalidTypeException { // doesn't invalidate other properties final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testDoesnTInvalidateOtherPropertiesPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException, InvalidTypeException { // ignores other non-objects final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -89,7 +89,7 @@ public void testBothPropertiesInvalidIsInvalidFails() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeException { // ignores arrays final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java index 0d4f932b859..2fbb12b14d9 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java @@ -18,7 +18,7 @@ public class ObjectTypeMatchesObjectsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnObjectIsAnObjectPasses() { + public void testAnObjectIsAnObjectPasses() throws ValidationException, InvalidTypeException { // an object is an object final var schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java index 46cabdaf335..4a7e08e1a28 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java @@ -18,7 +18,7 @@ public class OneofComplexTypesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testSecondOneofValidComplexPasses() { + public void testSecondOneofValidComplexPasses() throws ValidationException, InvalidTypeException { // second oneOf valid (complex) final var schema = OneofComplexTypes.OneofComplexTypes1.getInstance(); schema.validate( @@ -57,7 +57,7 @@ public void testBothOneofValidComplexFails() { } @Test - public void testFirstOneofValidComplexPasses() { + public void testFirstOneofValidComplexPasses() throws ValidationException, InvalidTypeException { // first oneOf valid (complex) final var schema = OneofComplexTypes.OneofComplexTypes1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java index 4aafad49183..db67a5b31a2 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java @@ -48,7 +48,7 @@ public void testNeitherOneofValidFails() { } @Test - public void testSecondOneofValidPasses() { + public void testSecondOneofValidPasses() throws ValidationException, InvalidTypeException { // second oneOf valid final var schema = Oneof.Oneof1.getInstance(); schema.validate( @@ -58,7 +58,7 @@ public void testSecondOneofValidPasses() { } @Test - public void testFirstOneofValidPasses() { + public void testFirstOneofValidPasses() throws ValidationException, InvalidTypeException { // first oneOf valid final var schema = Oneof.Oneof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java index 2dfe72cd7fa..dd0add55868 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java @@ -33,7 +33,7 @@ public void testMismatchBaseSchemaFails() { } @Test - public void testOneOneofValidPasses() { + public void testOneOneofValidPasses() throws ValidationException, InvalidTypeException { // one oneOf valid final var schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java index 4500ca75474..a685ce3ea0e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java @@ -18,7 +18,7 @@ public class OneofWithEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testOneValidValidPasses() { + public void testOneValidValidPasses() throws ValidationException, InvalidTypeException { // one valid - valid final var schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java index fed6deab27e..151b27da32a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java @@ -18,7 +18,7 @@ public class OneofWithRequiredTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testFirstValidValidPasses() { + public void testFirstValidValidPasses() throws ValidationException, InvalidTypeException { // first valid - valid final var schema = OneofWithRequired.OneofWithRequired1.getInstance(); schema.validate( @@ -65,7 +65,7 @@ public void testBothValidInvalidFails() { } @Test - public void testSecondValidValidPasses() { + public void testSecondValidValidPasses() throws ValidationException, InvalidTypeException { // second valid - valid final var schema = OneofWithRequired.OneofWithRequired1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java index 70153cd7cb5..02e105b9128 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java @@ -18,7 +18,7 @@ public class PatternIsNotAnchoredTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMatchesASubstringPasses() { + public void testMatchesASubstringPasses() throws ValidationException, InvalidTypeException { // matches a substring final var schema = PatternIsNotAnchored.PatternIsNotAnchored1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java index fc5ff8000e3..acfb4a826b7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java @@ -18,7 +18,7 @@ public class PatternValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testIgnoresBooleansPasses() { + public void testIgnoresBooleansPasses() throws ValidationException, InvalidTypeException { // ignores booleans final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testIgnoresBooleansPasses() { } @Test - public void testIgnoresFloatsPasses() { + public void testIgnoresFloatsPasses() throws ValidationException, InvalidTypeException { // ignores floats final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testANonMatchingPatternIsInvalidFails() { } @Test - public void testIgnoresIntegersPasses() { + public void testIgnoresIntegersPasses() throws ValidationException, InvalidTypeException { // ignores integers final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -63,7 +63,7 @@ public void testIgnoresIntegersPasses() { } @Test - public void testAMatchingPatternIsValidPasses() { + public void testAMatchingPatternIsValidPasses() throws ValidationException, InvalidTypeException { // a matching pattern is valid final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -73,7 +73,7 @@ public void testAMatchingPatternIsValidPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeException { // ignores arrays final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -84,7 +84,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testIgnoresObjectsPasses() { + public void testIgnoresObjectsPasses() throws ValidationException, InvalidTypeException { // ignores objects final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -95,7 +95,7 @@ public void testIgnoresObjectsPasses() { } @Test - public void testIgnoresNullPasses() { + public void testIgnoresNullPasses() throws ValidationException, InvalidTypeException { // ignores null final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java index d394de1e6ed..434f09a6c7b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java @@ -18,7 +18,7 @@ public class PropertiesWithEscapedCharactersTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testObjectWithAllNumbersIsValidPasses() { + public void testObjectWithAllNumbersIsValidPasses() throws ValidationException, InvalidTypeException { // object with all numbers is valid final var schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java index 70412b8ca3f..26cca29286e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java @@ -18,7 +18,7 @@ public class PropertyNamedRefThatIsNotAReferenceTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { // property named $ref valid final var schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java index 3fc09b3946b..53810dd8a3a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java @@ -18,7 +18,7 @@ public class RefInAdditionalpropertiesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { // property named $ref valid final var schema = RefInAdditionalproperties.RefInAdditionalproperties1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java index 2f49c75fa81..650c5d98617 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java @@ -18,7 +18,7 @@ public class RefInAllofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { // property named $ref valid final var schema = RefInAllof.RefInAllof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java index c4199877c08..3959a9f661b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java @@ -18,7 +18,7 @@ public class RefInAnyofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { // property named $ref valid final var schema = RefInAnyof.RefInAnyof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java index 239677fb66b..1c8c483563c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java @@ -18,7 +18,7 @@ public class RefInItemsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { // property named $ref valid final var schema = RefInItems.RefInItems1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java index 7a68dc4be5f..9c105e56e4b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java @@ -18,7 +18,7 @@ public class RefInNotTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { // property named $ref valid final var schema = RefInNot.RefInNot1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java index e8555cad3f3..4ea515462ce 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java @@ -18,7 +18,7 @@ public class RefInOneofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { // property named $ref valid final var schema = RefInOneof.RefInOneof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java index 65cfaad0251..6ede003a62e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java @@ -18,7 +18,7 @@ public class RefInPropertyTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { // property named $ref valid final var schema = RefInProperty.RefInProperty1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java index b439c59a44b..1b33c60e367 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java @@ -18,7 +18,7 @@ public class RequiredDefaultValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNotRequiredByDefaultPasses() { + public void testNotRequiredByDefaultPasses() throws ValidationException, InvalidTypeException { // not required by default final var schema = RequiredDefaultValidation.RequiredDefaultValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java index 3757ebf8c49..de98dacf49f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java @@ -18,7 +18,7 @@ public class RequiredValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPresentRequiredPropertyIsValidPasses() { + public void testPresentRequiredPropertyIsValidPasses() throws ValidationException, InvalidTypeException { // present required property is valid final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testPresentRequiredPropertyIsValidPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException, InvalidTypeException { // ignores other non-objects final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeException { // ignores arrays final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -54,7 +54,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException, InvalidTypeException { // ignores strings final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java index d6a8add1e4c..b527397fdce 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java @@ -18,7 +18,7 @@ public class RequiredWithEmptyArrayTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNotRequiredPasses() { + public void testPropertyNotRequiredPasses() throws ValidationException, InvalidTypeException { // property not required final var schema = RequiredWithEmptyArray.RequiredWithEmptyArray1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java index a2c05a6f22e..3361ccc1a36 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java @@ -42,7 +42,7 @@ public void testObjectWithSomePropertiesMissingIsInvalidFails() { } @Test - public void testObjectWithAllPropertiesPresentIsValidPasses() { + public void testObjectWithAllPropertiesPresentIsValidPasses() throws ValidationException, InvalidTypeException { // object with all properties present is valid final var schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java index 53f95f8e48e..19e9e40b9f1 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java @@ -33,7 +33,7 @@ public void testSomethingElseIsInvalidFails() { } @Test - public void testOneOfTheEnumIsValidPasses() { + public void testOneOfTheEnumIsValidPasses() throws ValidationException, InvalidTypeException { // one of the enum is valid final var schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java index 226c06bc19f..f7eb3fb217b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java @@ -18,7 +18,7 @@ public class StringTypeMatchesStringsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() { + public void testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() throws ValidationException, InvalidTypeException { // a string is still a string, even if it looks like a number final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( @@ -58,7 +58,7 @@ public void testABooleanIsNotAStringFails() { } @Test - public void testAnEmptyStringIsStillAStringPasses() { + public void testAnEmptyStringIsStillAStringPasses() throws ValidationException, InvalidTypeException { // an empty string is still a string final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( @@ -115,7 +115,7 @@ public void testNullIsNotAStringFails() { } @Test - public void testAStringIsAStringPasses() { + public void testAStringIsAStringPasses() throws ValidationException, InvalidTypeException { // a string is a string final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java index 6b63fd753ce..0ebbc544fb7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java @@ -18,7 +18,7 @@ public class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMissingPropertiesAreNotFilledInWithTheDefaultPasses() { + public void testMissingPropertiesAreNotFilledInWithTheDefaultPasses() throws ValidationException, InvalidTypeException { // missing properties are not filled in with the default final var schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance(); schema.validate( @@ -29,7 +29,7 @@ public void testMissingPropertiesAreNotFilledInWithTheDefaultPasses() { } @Test - public void testAnExplicitPropertyValueIsCheckedAgainstMaximumPassingPasses() { + public void testAnExplicitPropertyValueIsCheckedAgainstMaximumPassingPasses() throws ValidationException, InvalidTypeException { // an explicit property value is checked against maximum (passing) final var schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java index 5c0b5aaaeea..b52fabfb93c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java @@ -18,7 +18,7 @@ public class UniqueitemsFalseValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNumbersAreUniqueIfMathematicallyUnequalPasses() { + public void testNumbersAreUniqueIfMathematicallyUnequalPasses() throws ValidationException, InvalidTypeException { // numbers are unique if mathematically unequal final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -32,7 +32,7 @@ public void testNumbersAreUniqueIfMathematicallyUnequalPasses() { } @Test - public void testNonUniqueArrayOfIntegersIsValidPasses() { + public void testNonUniqueArrayOfIntegersIsValidPasses() throws ValidationException, InvalidTypeException { // non-unique array of integers is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -45,7 +45,7 @@ public void testNonUniqueArrayOfIntegersIsValidPasses() { } @Test - public void testNonUniqueArrayOfObjectsIsValidPasses() { + public void testNonUniqueArrayOfObjectsIsValidPasses() throws ValidationException, InvalidTypeException { // non-unique array of objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -68,7 +68,7 @@ public void testNonUniqueArrayOfObjectsIsValidPasses() { } @Test - public void testNonUniqueArrayOfArraysIsValidPasses() { + public void testNonUniqueArrayOfArraysIsValidPasses() throws ValidationException, InvalidTypeException { // non-unique array of arrays is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -85,7 +85,7 @@ public void testNonUniqueArrayOfArraysIsValidPasses() { } @Test - public void test1AndTrueAreUniquePasses() { + public void test1AndTrueAreUniquePasses() throws ValidationException, InvalidTypeException { // 1 and true are unique final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -98,7 +98,7 @@ public void test1AndTrueAreUniquePasses() { } @Test - public void testUniqueArrayOfNestedObjectsIsValidPasses() { + public void testUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException, InvalidTypeException { // unique array of nested objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -141,7 +141,7 @@ public void testUniqueArrayOfNestedObjectsIsValidPasses() { } @Test - public void testUniqueArrayOfArraysIsValidPasses() { + public void testUniqueArrayOfArraysIsValidPasses() throws ValidationException, InvalidTypeException { // unique array of arrays is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -158,7 +158,7 @@ public void testUniqueArrayOfArraysIsValidPasses() { } @Test - public void testTrueIsNotEqualToOnePasses() { + public void testTrueIsNotEqualToOnePasses() throws ValidationException, InvalidTypeException { // true is not equal to one final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -171,7 +171,7 @@ public void testTrueIsNotEqualToOnePasses() { } @Test - public void testNonUniqueHeterogeneousTypesAreValidPasses() { + public void testNonUniqueHeterogeneousTypesAreValidPasses() throws ValidationException, InvalidTypeException { // non-unique heterogeneous types are valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -192,7 +192,7 @@ public void testNonUniqueHeterogeneousTypesAreValidPasses() { } @Test - public void testFalseIsNotEqualToZeroPasses() { + public void testFalseIsNotEqualToZeroPasses() throws ValidationException, InvalidTypeException { // false is not equal to zero final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -205,7 +205,7 @@ public void testFalseIsNotEqualToZeroPasses() { } @Test - public void testUniqueArrayOfIntegersIsValidPasses() { + public void testUniqueArrayOfIntegersIsValidPasses() throws ValidationException, InvalidTypeException { // unique array of integers is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -218,7 +218,7 @@ public void testUniqueArrayOfIntegersIsValidPasses() { } @Test - public void test0AndFalseAreUniquePasses() { + public void test0AndFalseAreUniquePasses() throws ValidationException, InvalidTypeException { // 0 and false are unique final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -231,7 +231,7 @@ public void test0AndFalseAreUniquePasses() { } @Test - public void testUniqueHeterogeneousTypesAreValidPasses() { + public void testUniqueHeterogeneousTypesAreValidPasses() throws ValidationException, InvalidTypeException { // unique heterogeneous types are valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -250,7 +250,7 @@ public void testUniqueHeterogeneousTypesAreValidPasses() { } @Test - public void testUniqueArrayOfObjectsIsValidPasses() { + public void testUniqueArrayOfObjectsIsValidPasses() throws ValidationException, InvalidTypeException { // unique array of objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -273,7 +273,7 @@ public void testUniqueArrayOfObjectsIsValidPasses() { } @Test - public void testNonUniqueArrayOfNestedObjectsIsValidPasses() { + public void testNonUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException, InvalidTypeException { // non-unique array of nested objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java index 6f6fba93a47..33712c9160f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java @@ -65,7 +65,7 @@ public void testNonUniqueArrayOfObjectsIsInvalidFails() { } @Test - public void testATrueAndA1AreUniquePasses() { + public void testATrueAndA1AreUniquePasses() throws ValidationException, InvalidTypeException { // {\\\"a\\\": true} and {\\\"a\\\": 1} are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -88,7 +88,7 @@ public void testATrueAndA1AreUniquePasses() { } @Test - public void test1AndTrueAreUniquePasses() { + public void test1AndTrueAreUniquePasses() throws ValidationException, InvalidTypeException { // [1] and [true] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -123,7 +123,7 @@ public void testNonUniqueArrayOfIntegersIsInvalidFails() { } @Test - public void testNested0AndFalseAreUniquePasses() { + public void testNested0AndFalseAreUniquePasses() throws ValidationException, InvalidTypeException { // nested [0] and [false] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -204,7 +204,7 @@ public void testNonUniqueArrayOfArraysIsInvalidFails() { } @Test - public void testAFalseAndA0AreUniquePasses() { + public void testAFalseAndA0AreUniquePasses() throws ValidationException, InvalidTypeException { // {\\\"a\\\": false} and {\\\"a\\\": 0} are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -252,7 +252,7 @@ public void testNonUniqueArrayOfMoreThanTwoArraysIsInvalidFails() { } @Test - public void test0AndFalseAreUniquePasses() { + public void test0AndFalseAreUniquePasses() throws ValidationException, InvalidTypeException { // [0] and [false] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -355,7 +355,7 @@ public void testNonUniqueArrayOfStringsIsInvalidFails() { } @Test - public void testUniqueArrayOfNestedObjectsIsValidPasses() { + public void testUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException, InvalidTypeException { // unique array of nested objects is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -398,7 +398,7 @@ public void testUniqueArrayOfNestedObjectsIsValidPasses() { } @Test - public void testUniqueArrayOfArraysIsValidPasses() { + public void testUniqueArrayOfArraysIsValidPasses() throws ValidationException, InvalidTypeException { // unique array of arrays is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -415,7 +415,7 @@ public void testUniqueArrayOfArraysIsValidPasses() { } @Test - public void testTrueIsNotEqualToOnePasses() { + public void testTrueIsNotEqualToOnePasses() throws ValidationException, InvalidTypeException { // true is not equal to one final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -428,7 +428,7 @@ public void testTrueIsNotEqualToOnePasses() { } @Test - public void testNested1AndTrueAreUniquePasses() { + public void testNested1AndTrueAreUniquePasses() throws ValidationException, InvalidTypeException { // nested [1] and [true] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -451,7 +451,7 @@ public void testNested1AndTrueAreUniquePasses() { } @Test - public void testUniqueArrayOfStringsIsValidPasses() { + public void testUniqueArrayOfStringsIsValidPasses() throws ValidationException, InvalidTypeException { // unique array of strings is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -465,7 +465,7 @@ public void testUniqueArrayOfStringsIsValidPasses() { } @Test - public void testFalseIsNotEqualToZeroPasses() { + public void testFalseIsNotEqualToZeroPasses() throws ValidationException, InvalidTypeException { // false is not equal to zero final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -478,7 +478,7 @@ public void testFalseIsNotEqualToZeroPasses() { } @Test - public void testUniqueArrayOfIntegersIsValidPasses() { + public void testUniqueArrayOfIntegersIsValidPasses() throws ValidationException, InvalidTypeException { // unique array of integers is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -491,7 +491,7 @@ public void testUniqueArrayOfIntegersIsValidPasses() { } @Test - public void testDifferentObjectsAreUniquePasses() { + public void testDifferentObjectsAreUniquePasses() throws ValidationException, InvalidTypeException { // different objects are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -522,7 +522,7 @@ public void testDifferentObjectsAreUniquePasses() { } @Test - public void testUniqueHeterogeneousTypesAreValidPasses() { + public void testUniqueHeterogeneousTypesAreValidPasses() throws ValidationException, InvalidTypeException { // unique heterogeneous types are valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -542,7 +542,7 @@ public void testUniqueHeterogeneousTypesAreValidPasses() { } @Test - public void testUniqueArrayOfObjectsIsValidPasses() { + public void testUniqueArrayOfObjectsIsValidPasses() throws ValidationException, InvalidTypeException { // unique array of objects is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java index 14ce5c09bd2..e78d2a5c5e9 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java @@ -18,7 +18,7 @@ public class UriFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { // all string formats ignore integers final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore nulls final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore objects final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore floats final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { // all string formats ignore arrays final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { // all string formats ignore booleans final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java index 9ae84cd3823..a6fb6102555 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java @@ -18,7 +18,7 @@ public class UriReferenceFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { // all string formats ignore integers final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore nulls final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore objects final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore floats final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { // all string formats ignore arrays final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { // all string formats ignore booleans final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java index cb29e46630f..fb76276fef6 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java @@ -18,7 +18,7 @@ public class UriTemplateFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { // all string formats ignore integers final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore nulls final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore objects final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { // all string formats ignore floats final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { // all string formats ignore arrays final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { // all string formats ignore booleans final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java index 990f21a1148..c47e21d3fc6 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java @@ -5,6 +5,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -22,7 +25,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java index b0eaf780b2e..c0f3191d7e8 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java @@ -6,6 +6,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.ListJsonSchema; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -28,7 +30,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -126,7 +128,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserialization() { + public void testDeserialization() throws ValidationException, NotImplementedException, InvalidTypeException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java index a19ea8c1007..a81758ecc82 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java @@ -2,6 +2,8 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +34,7 @@ protected CookieParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java index 63f3159bf0a..164fbd74f9e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java @@ -2,6 +2,8 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -33,7 +35,7 @@ protected HeaderParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java index bef110af08d..aca8385652d 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java @@ -2,6 +2,8 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +34,7 @@ protected PathParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java index ed5aae7e580..fe1f132e766 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java @@ -2,6 +2,8 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +34,7 @@ protected QueryParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws OpenapiDocumentException, NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java index 871d4f073f3..ea3baa96711 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java @@ -4,6 +4,7 @@ import org.junit.Assert; import org.junit.Test; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +27,7 @@ public HeaderParameter(@Nullable Boolean explode) { } @Test - public void testHeaderSerialization() { + public void testHeaderSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -104,7 +105,7 @@ public PathParameter(@Nullable Boolean explode) { } @Test - public void testPathSerialization() { + public void testPathSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -182,7 +183,7 @@ public CookieParameter(@Nullable Boolean explode) { } @Test - public void testCookieSerialization() { + public void testCookieSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -260,7 +261,7 @@ public PathMatrixParameter(@Nullable Boolean explode) { } @Test - public void testPathMatrixSerialization() { + public void testPathMatrixSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -331,7 +332,7 @@ public PathLabelParameter(@Nullable Boolean explode) { } @Test - public void testPathLabelSerialization() { + public void testPathLabelSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java index f4ea29fccb3..c10b33587ba 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java @@ -4,6 +4,7 @@ import org.junit.Assert; import org.junit.Test; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +27,7 @@ public QueryParameterNoStyle(@Nullable Boolean explode) { } @Test - public void testQueryParameterNoStyleSerialization() { + public void testQueryParameterNoStyleSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -104,7 +105,7 @@ public QueryParameterSpaceDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterSpaceDelimitedSerialization() { + public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -151,7 +152,7 @@ public QueryParameterPipeDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterPipeDelimitedSerialization() { + public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java index 9f0c86ec5c4..880ad7749b3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java @@ -3,6 +3,9 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -47,7 +50,7 @@ public MyRequestBodySerializer() { true); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { @@ -93,7 +96,7 @@ private String getJsonBody(SerializedRequestBody requestBody) { } @Test - public void testSerializeApplicationJson() { + public void testSerializeApplicationJson() throws ValidationException, InvalidTypeException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); String jsonBody; @@ -164,7 +167,7 @@ public void testSerializeApplicationJson() { } @Test - public void testSerializeTextPlain() { + public void testSerializeTextPlain() throws ValidationException, InvalidTypeException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); SerializedRequestBody requestBody = serializer.serialize( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java index 408f04582a8..d4ba032bc5f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java @@ -8,6 +8,10 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -64,7 +68,7 @@ public MyResponseDeserializer() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, InvalidTypeException { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); @@ -152,7 +156,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserializeApplicationJsonNull() { + public void testDeserializeApplicationJsonNull() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(null).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -168,7 +172,7 @@ public void testDeserializeApplicationJsonNull() { } @Test - public void testDeserializeApplicationJsonTrue() { + public void testDeserializeApplicationJsonTrue() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(true).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -184,7 +188,7 @@ public void testDeserializeApplicationJsonTrue() { } @Test - public void testDeserializeApplicationJsonFalse() { + public void testDeserializeApplicationJsonFalse() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(false).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -200,7 +204,7 @@ public void testDeserializeApplicationJsonFalse() { } @Test - public void testDeserializeApplicationJsonInt() { + public void testDeserializeApplicationJsonInt() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(1).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -216,7 +220,7 @@ public void testDeserializeApplicationJsonInt() { } @Test - public void testDeserializeApplicationJsonFloat() { + public void testDeserializeApplicationJsonFloat() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(3.14).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -232,7 +236,7 @@ public void testDeserializeApplicationJsonFloat() { } @Test - public void testDeserializeApplicationJsonString() { + public void testDeserializeApplicationJsonString() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson("a").getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java index 9b76ff56c45..3a066958ffe 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java @@ -5,6 +5,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -26,13 +28,13 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testValidateNull() { + public void testValidateNull() throws ValidationException, InvalidTypeException { Void validatedValue = schema.validate((Void) null, configuration); assertNull(validatedValue); } @Test - public void testValidateBoolean() { + public void testValidateBoolean() throws ValidationException, InvalidTypeException { boolean trueValue = schema.validate(true, configuration); Assert.assertTrue(trueValue); @@ -41,49 +43,49 @@ public void testValidateBoolean() { } @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException, InvalidTypeException { int validatedValue = schema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException, InvalidTypeException { long validatedValue = schema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException, InvalidTypeException { float validatedValue = schema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException, InvalidTypeException { double validatedValue = schema.validate(70.6458763d, configuration); Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); } @Test - public void testValidateString() { + public void testValidateString() throws ValidationException, InvalidTypeException { String validatedValue = schema.validate("a", configuration); Assert.assertEquals(validatedValue, "a"); } @Test - public void testValidateZonedDateTime() { + public void testValidateZonedDateTime() throws ValidationException, InvalidTypeException { String validatedValue = schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration); Assert.assertEquals(validatedValue, "2017-07-21T17:32:28Z"); } @Test - public void testValidateLocalDate() { + public void testValidateLocalDate() throws ValidationException, InvalidTypeException { String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); Assert.assertEquals(validatedValue, "2017-07-21"); } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException, InvalidTypeException { LinkedHashMap inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap validatedValue = schema.validate(inMap, configuration); @@ -93,7 +95,7 @@ public void testValidateMap() { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException, InvalidTypeException { ArrayList inList = new ArrayList<>(); inList.add(LocalDate.of(2017, 7, 21)); FrozenList validatedValue = schema.validate(inList, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index 42dfcabf0d0..2d26f1563d4 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -53,12 +53,12 @@ public FrozenList getNewInstance(List arg, List pathToItem, P itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -86,7 +86,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -111,7 +111,7 @@ protected ArrayWithOutputClsSchemaList(FrozenList m) { super(m); } - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) { + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return new ArrayWithOutputClsSchema().validate(arg, configuration); } } @@ -138,12 +138,12 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -172,7 +172,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -202,7 +202,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateArrayWithItemsSchema() { + public void testValidateArrayWithItemsSchema() throws ValidationException, InvalidTypeException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); @@ -227,7 +227,7 @@ public void testValidateArrayWithItemsSchema() { } @Test - public void testValidateArrayWithOutputClsSchema() { + public void testValidateArrayWithOutputClsSchema() throws ValidationException, InvalidTypeException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java index 0b4261a7ef0..a989ca41eb2 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java @@ -4,9 +4,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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; @@ -24,13 +24,13 @@ public class BooleanSchemaTest { ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException, InvalidTypeException { boolean validatedValue = booleanJsonSchema.validate(true, configuration); Assert.assertTrue(validatedValue); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException, InvalidTypeException { boolean validatedValue = booleanJsonSchema.validate(false, configuration); Assert.assertFalse(validatedValue); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java index cb4aa60f4a8..b0417274fe5 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java @@ -5,9 +5,10 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -35,7 +36,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException, InvalidTypeException { List inList = new ArrayList<>(); inList.add("today"); FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java index 85afb15a068..2b3e4231fe4 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java @@ -5,9 +5,10 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenMap; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -37,7 +38,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException, InvalidTypeException { Map inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap<@Nullable Object> validatedValue = mapJsonSchema.validate(inMap, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java index d566f15a69e..afcc5996893 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java @@ -4,9 +4,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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; @@ -26,7 +26,7 @@ public class NullSchemaTest { @Test @SuppressWarnings("nullness") - public void testValidateNull() { + public void testValidateNull() throws ValidationException, InvalidTypeException { Void validatedValue = nullJsonSchema.validate(null, configuration); Assert.assertNull(validatedValue); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java index 2ab8d8a8121..92698dee479 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java @@ -4,8 +4,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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; @@ -23,25 +24,25 @@ public class NumberSchemaTest { ); @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException, InvalidTypeException { int validatedValue = numberJsonSchema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException, InvalidTypeException { long validatedValue = numberJsonSchema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException, InvalidTypeException { float validatedValue = numberJsonSchema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException, InvalidTypeException { double validatedValue = numberJsonSchema.validate(3.14d, configuration); Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index 02729b0f046..c1f9e5de4df 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -6,13 +6,13 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.PropertyEntry; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -62,7 +62,7 @@ public static ObjectWithPropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -70,7 +70,7 @@ public static ObjectWithPropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -99,7 +99,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -146,7 +146,7 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -154,12 +154,12 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(castValue instanceof String)) { - throw new InvalidTypeException("Invalid type for property value"); + throw new RuntimeException("Invalid type for property value"); } properties.put(propertyName, (String) castValue); } @@ -202,7 +202,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -235,7 +235,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -243,7 +243,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -288,7 +288,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -297,7 +297,7 @@ protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { super(m); } - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) { + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); } } @@ -330,7 +330,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -338,7 +338,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -383,7 +383,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -398,7 +398,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateObjectWithPropsSchema() { + public void testValidateObjectWithPropsSchema() throws ValidationException, InvalidTypeException { ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); // map with only property works @@ -429,7 +429,7 @@ public void testValidateObjectWithPropsSchema() { } @Test - public void testValidateObjectWithAddpropsSchema() { + public void testValidateObjectWithAddpropsSchema() throws ValidationException, InvalidTypeException { ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); // map with only property works @@ -460,7 +460,7 @@ public void testValidateObjectWithAddpropsSchema() { } @Test - public void testValidateObjectWithPropsAndAddpropsSchema() { + public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException, InvalidTypeException { ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); // map with only property works @@ -499,7 +499,7 @@ public void testValidateObjectWithPropsAndAddpropsSchema() { } @Test - public void testValidateObjectWithOutputTypeSchema() { + public void testValidateObjectWithOutputTypeSchema() throws ValidationException, InvalidTypeException { ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); // map with only property works diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java index c8079ef632a..92c61870552 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java @@ -4,9 +4,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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; @@ -28,13 +28,13 @@ public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchem ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException, InvalidTypeException { Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); Assert.assertEquals(validatedValue, Boolean.TRUE); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException, InvalidTypeException { Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); Assert.assertEquals(validatedValue, Boolean.FALSE); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java index 40a01c9983d..a48a2c742f0 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java @@ -6,6 +6,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; @@ -46,7 +47,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -70,7 +71,7 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -105,7 +106,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java index 1481f312f6a..cb03bcf8f5b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java @@ -34,7 +34,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testIntFormatSucceedsWithFloat() { + public void testIntFormatSucceedsWithFloat() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -59,7 +59,7 @@ public void testIntFormatFailsWithFloat() { } @Test - public void testIntFormatSucceedsWithInt() { + public void testIntFormatSucceedsWithInt() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -84,7 +84,7 @@ public void testInt32UnderMinFails() { } @Test - public void testInt32InclusiveMinSucceeds() { + public void testInt32InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -97,7 +97,7 @@ public void testInt32InclusiveMinSucceeds() { } @Test - public void testInt32InclusiveMaxSucceeds() { + public void testInt32InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -135,7 +135,7 @@ public void testInt64UnderMinFails() { } @Test - public void testInt64InclusiveMinSucceeds() { + public void testInt64InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -148,7 +148,7 @@ public void testInt64InclusiveMinSucceeds() { } @Test - public void testInt64InclusiveMaxSucceeds() { + public void testInt64InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -186,7 +186,7 @@ public void testFloatUnderMinFails() { } @Test - public void testFloatInclusiveMinSucceeds() { + public void testFloatInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -199,7 +199,7 @@ public void testFloatInclusiveMinSucceeds() { } @Test - public void testFloatInclusiveMaxSucceeds() { + public void testFloatInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -236,7 +236,7 @@ public void testDoubleUnderMinFails() { } @Test - public void testDoubleInclusiveMinSucceeds() { + public void testDoubleInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -249,7 +249,7 @@ public void testDoubleInclusiveMinSucceeds() { } @Test - public void testDoubleInclusiveMaxSucceeds() { + public void testDoubleInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -286,7 +286,7 @@ public void testInvalidNumberStringFails() { } @Test - public void testValidFloatNumberStringSucceeds() { + public void testValidFloatNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -299,7 +299,7 @@ public void testValidFloatNumberStringSucceeds() { } @Test - public void testValidIntNumberStringSucceeds() { + public void testValidIntNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -324,7 +324,7 @@ public void testInvalidDateStringFails() { } @Test - public void testValidDateStringSucceeds() { + public void testValidDateStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -349,7 +349,7 @@ public void testInvalidDateTimeStringFails() { } @Test - public void testValidDateTimeStringSucceeds() { + public void testValidDateTimeStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java index e0e4a0c859e..6299f5e6ef2 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java @@ -37,7 +37,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List listArg) { return getNewInstance(listArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -55,7 +55,7 @@ public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConf } @Test - public void testCorrectItemsSucceeds() { + public void testCorrectItemsSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -89,7 +89,7 @@ public void testCorrectItemsSucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java index 8a14df7edd6..7a8578bae93 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java @@ -40,7 +40,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof String) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -58,7 +58,7 @@ public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java index 492f45af0c7..19d8a475edd 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java @@ -36,7 +36,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -59,7 +59,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( @@ -92,7 +92,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java index 65ff030d74b..221050d9e82 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java @@ -32,7 +32,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -55,7 +55,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -78,7 +78,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java index ebc8bbff1f5..c31855af4ff 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java @@ -18,7 +18,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { final TypeValidator validator = new TypeValidator(); ValidationMetadata validationMetadata = new ValidationMetadata( new ArrayList<>(), diff --git a/src/main/resources/java/src/test/java/packagename/components/schemas/Schema_test.hbs b/src/main/resources/java/src/test/java/packagename/components/schemas/Schema_test.hbs index ace20373ef1..a1155141793 100644 --- a/src/main/resources/java/src/test/java/packagename/components/schemas/Schema_test.hbs +++ b/src/main/resources/java/src/test/java/packagename/components/schemas/Schema_test.hbs @@ -21,7 +21,7 @@ public class {{containerJsonPathPiece.pascalCase}}Test { {{#with this }} @Test - public void test{{@key}}{{#if valid}}Passes{{else}}Fails{{/if}}() { + public void test{{@key}}{{#if valid}}Passes() throws ValidationException, InvalidTypeException{{else}}Fails(){{/if}} { // {{description.codeEscaped}} final var schema = {{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(); {{#if valid}} From 0a09a03e49f3c481d964361b66fedbd309d1ff34 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 15:43:18 -0700 Subject: [PATCH 35/53] Fixes java tests --- .../client/header/Rfc6570Serializer.java | 4 +++- .../client/header/SchemaHeaderTest.java | 2 +- .../client/parameter/SchemaNonQueryParameterTest.java | 6 +++--- .../client/parameter/SchemaQueryParameterTest.java | 2 +- .../src/main/java/packagename/header/Rfc6570Serializer.hbs | 4 ++-- .../src/test/java/packagename/header/SchemaHeaderTest.hbs | 2 +- .../packagename/parameter/SchemaNonQueryParameterTest.hbs | 6 +++--- .../java/packagename/parameter/SchemaQueryParameterTest.hbs | 2 +- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java index 79220e47cbf..fac752561ed 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java @@ -7,9 +7,11 @@ import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TreeMap; import java.util.stream.Collectors; public class Rfc6570Serializer { @@ -117,7 +119,7 @@ private static String rfc6570MapExpansion( String varNamePiece, boolean namedParameterExpansion ) throws NotImplementedException { - Map inDataMap = new HashMap<>(); + Map inDataMap = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { @Nullable String value = rfc6570ItemValue(entry.getValue(), percentEncode); if (value == null) { diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java index c0f3191d7e8..536188dd45c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java @@ -107,7 +107,7 @@ public void testSerialization() throws ValidationException, NotImplementedExcept ); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value, "color", false, configuration) ); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java index ea3baa96711..9a6dd9726e3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java @@ -92,7 +92,7 @@ public void testHeaderSerialization() throws NotImplementedException { var boolHeader = new HeaderParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value) ); } @@ -170,7 +170,7 @@ public void testPathSerialization() throws NotImplementedException { var pathParameter = new PathParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> pathParameter.serialize(value) ); } @@ -248,7 +248,7 @@ public void testCookieSerialization() throws NotImplementedException { var cookieParameter = new CookieParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> cookieParameter.serialize(value) ); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java index c10b33587ba..83b9469a24d 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java @@ -92,7 +92,7 @@ public void testQueryParameterNoStyleSerialization() throws NotImplementedExcept var parameter = new QueryParameterNoStyle(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> parameter.serialize(value) ); } diff --git a/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs b/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs index f40bb005918..93dbfab9980 100644 --- a/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/Rfc6570Serializer.hbs @@ -6,7 +6,7 @@ import {{{packageName}}}.exceptions.NotImplementedException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -117,7 +117,7 @@ public class Rfc6570Serializer { String varNamePiece, boolean namedParameterExpansion ) throws NotImplementedException { - Map inDataMap = new HashMap<>(); + Map inDataMap = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { @Nullable String value = rfc6570ItemValue(entry.getValue(), percentEncode); if (value == null) { diff --git a/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs b/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs index 8b55d24ce61..a9ef7a5df2d 100644 --- a/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs @@ -107,7 +107,7 @@ public class SchemaHeaderTest { ); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value, "color", false, configuration) ); } diff --git a/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs index 2d46ca26c4a..7739dd22e74 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs @@ -92,7 +92,7 @@ public class SchemaNonQueryParameterTest { var boolHeader = new HeaderParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value) ); } @@ -170,7 +170,7 @@ public class SchemaNonQueryParameterTest { var pathParameter = new PathParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> pathParameter.serialize(value) ); } @@ -248,7 +248,7 @@ public class SchemaNonQueryParameterTest { var cookieParameter = new CookieParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> cookieParameter.serialize(value) ); } diff --git a/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs index 65067feca82..115b36b037d 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs @@ -92,7 +92,7 @@ public class SchemaQueryParameterTest { var parameter = new QueryParameterNoStyle(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> parameter.serialize(value) ); } From 81565d538abea128802cd3d689bc1d365d22447a Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 15:59:26 -0700 Subject: [PATCH 36/53] Fixes java tests --- .../client/header/Rfc6570Serializer.java | 4 ++-- .../client/header/ContentHeaderTest.java | 2 +- .../client/header/SchemaHeaderTest.java | 4 ++-- .../client/parameter/CookieSerializerTest.java | 2 +- .../client/parameter/HeadersSerializerTest.java | 2 +- .../client/parameter/PathSerializerTest.java | 2 +- .../client/parameter/QuerySerializerTest.java | 2 +- .../client/parameter/SchemaNonQueryParameterTest.java | 6 +++--- .../client/parameter/SchemaQueryParameterTest.java | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java index 79220e47cbf..11707301d30 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java @@ -6,7 +6,7 @@ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -117,7 +117,7 @@ private static String rfc6570MapExpansion( String varNamePiece, boolean namedParameterExpansion ) throws NotImplementedException { - Map inDataMap = new HashMap<>(); + Map inDataMap = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { @Nullable String value = rfc6570ItemValue(entry.getValue(), percentEncode); if (value == null) { diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java index 64a34d3a6a2..c47e21d3fc6 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java @@ -6,8 +6,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java index 8dcb9715353..536188dd45c 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java @@ -6,8 +6,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.ListJsonSchema; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -107,7 +107,7 @@ public void testSerialization() throws ValidationException, NotImplementedExcept ); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value, "color", false, configuration) ); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java index 1c4f61300c1..a81758ecc82 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java @@ -2,8 +2,8 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java index e1ba3eebdcf..164fbd74f9e 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java @@ -2,8 +2,8 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java index 516c5617cea..aca8385652d 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java @@ -2,8 +2,8 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java index 6231807a5e9..fe1f132e766 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java @@ -2,8 +2,8 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java index ea3baa96711..9a6dd9726e3 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java @@ -92,7 +92,7 @@ public void testHeaderSerialization() throws NotImplementedException { var boolHeader = new HeaderParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value) ); } @@ -170,7 +170,7 @@ public void testPathSerialization() throws NotImplementedException { var pathParameter = new PathParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> pathParameter.serialize(value) ); } @@ -248,7 +248,7 @@ public void testCookieSerialization() throws NotImplementedException { var cookieParameter = new CookieParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> cookieParameter.serialize(value) ); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java index c10b33587ba..83b9469a24d 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java @@ -92,7 +92,7 @@ public void testQueryParameterNoStyleSerialization() throws NotImplementedExcept var parameter = new QueryParameterNoStyle(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> parameter.serialize(value) ); } From 834544d6f38487e0da5b32f46c67fb428dee73c2 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 16:13:02 -0700 Subject: [PATCH 37/53] Imports request body schema when it is required --- .../java/docs/paths/anotherfakedummy/Patch.md | 2 +- .../client/petstore/java/docs/paths/fake/Get.md | 1 + .../petstore/java/docs/paths/fake/Patch.md | 2 +- .../client/petstore/java/docs/paths/fake/Post.md | 1 + .../Get.md | 1 + .../docs/paths/fakebodywithfileschema/Put.md | 2 +- .../docs/paths/fakebodywithqueryparams/Put.md | 2 +- .../java/docs/paths/fakeclassnametest/Patch.md | 2 +- .../paths/fakeinlineadditionalproperties/Post.md | 2 +- .../docs/paths/fakeinlinecomposition/Post.md | 1 + .../java/docs/paths/fakejsonformdata/Get.md | 1 + .../java/docs/paths/fakejsonpatch/Patch.md | 1 + .../java/docs/paths/fakejsonwithcharset/Post.md | 1 + .../fakemultiplerequestbodycontenttypes/Post.md | 1 + .../java/docs/paths/fakepemcontenttype/Get.md | 1 + .../java/docs/paths/fakerefsarraymodel/Post.md | 1 + .../java/docs/paths/fakerefsarrayofenums/Post.md | 1 + .../java/docs/paths/fakerefsboolean/Post.md | 1 + .../Post.md | 1 + .../java/docs/paths/fakerefsenum/Post.md | 1 + .../java/docs/paths/fakerefsmammal/Post.md | 2 +- .../java/docs/paths/fakerefsnumber/Post.md | 1 + .../fakerefsobjectmodelwithrefprops/Post.md | 1 + .../java/docs/paths/fakerefsstring/Post.md | 1 + .../docs/paths/fakeuploaddownloadfile/Post.md | 2 +- .../java/docs/paths/fakeuploadfile/Post.md | 1 + .../java/docs/paths/fakeuploadfiles/Post.md | 1 + .../client/petstore/java/docs/paths/pet/Post.md | 2 +- .../client/petstore/java/docs/paths/pet/Put.md | 2 +- .../petstore/java/docs/paths/storeorder/Post.md | 2 +- .../client/petstore/java/docs/paths/user/Post.md | 2 +- .../java/docs/paths/usercreatewitharray/Post.md | 2 +- .../java/docs/paths/usercreatewithlist/Post.md | 2 +- .../petstore/java/docs/paths/userusername/Put.md | 2 +- .../paths/path/verb/_OperationDocCodeSample.hbs | 16 +++++++++++++++- 35 files changed, 49 insertions(+), 16 deletions(-) diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 20b17135851..59b8aa99185 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -26,6 +26,7 @@ a class that allows one to call the endpoint using a method named patch ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.RequestBody; +import org.openapijsonschematools.client.components.schemas.Client; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -58,7 +59,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); -// todo add this import Client1BoxedMap requestBodyPayload = Client.Client1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index 4ddb62855d0..ead787b2542 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.paths.fake.get.RequestBody; +import org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; import org.openapijsonschematools.client.paths.fake.get.HeaderParameters; import org.openapijsonschematools.client.paths.fake.get.QueryParameters; import org.openapijsonschematools.client.RootServerInfo; diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index eb2ec1e00be..6ec0b841c15 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -26,6 +26,7 @@ a class that allows one to call the endpoint using a method named patch ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.patch.RequestBody; +import org.openapijsonschematools.client.components.schemas.Client; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -58,7 +59,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); -// todo add this import Client1BoxedMap requestBodyPayload = Client.Client1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index 5f533a5cdc4..0b9d6083c71 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fake.post.RequestBody; +import org.openapijsonschematools.client.paths.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; import org.openapijsonschematools.client.servers.Server0; diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index 6f136de0d69..42aa5df84c2 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.RequestBody; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index eb7221822b0..0d034b54135 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -26,6 +26,7 @@ a class that allows one to call the endpoint using a method named put ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.RequestBody; +import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -58,7 +59,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); -// todo add this import FileSchemaTestClass1BoxedMap requestBodyPayload = FileSchemaTestClass.FileSchemaTestClass1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index 431f52cc529..5f8b874ee60 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -28,6 +28,7 @@ a class that allows one to call the endpoint using a method named put ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.RequestBody; +import org.openapijsonschematools.client.components.schemas.User; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.QueryParameters; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; @@ -61,7 +62,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); -// todo add this import User1BoxedMap requestBodyPayload = User.User1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index 9ad224b4702..dfef3d9c934 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -27,6 +27,7 @@ a class that allows one to call the endpoint using a method named patch import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.RequestBody; +import org.openapijsonschematools.client.components.schemas.Client; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -69,7 +70,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); -// todo add this import Client1BoxedMap requestBodyPayload = Client.Client1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index 2d878ebb16a..1e04d3bfa4b 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -26,6 +26,7 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -58,7 +59,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import ApplicationjsonSchema1BoxedMap requestBodyPayload = ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 2567faafc1c..d1af832e9a6 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.QueryParameters; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index 9f58f37b727..043e723eb12 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.paths.fakejsonformdata.get.RequestBody; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index 6847b1c00c1..c4a34ded372 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named patch ### Code Sample ``` import org.openapijsonschematools.client.paths.fakejsonpatch.patch.RequestBody; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index ec626fcd765..b8e99d37676 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.RequestBody; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 76df904bffe..ce2c3930cdd 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.RequestBody; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index ec8f40c44dc..4c8944c3b93 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` import org.openapijsonschematools.client.paths.fakepemcontenttype.get.RequestBody; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile.ApplicationxpemfileSchema; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index 00a1a55f74d..acae872d7c9 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.AnimalFarm; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index d0053d163fe..15d8b7cf473 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index 8f0ac00363d..f6b5af1b0b8 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakerefsboolean.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.BooleanSchema; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index a51633064eb..c922a70eaa0 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index 005c18e18ad..00ca4979cc7 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakerefsenum.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.StringEnum; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index d3f78dc1da2..8823683af05 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -26,6 +26,7 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsmammal.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.Mammal; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -58,7 +59,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); var request = new PostRequestBuilder() diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index 0d3e071ed71..a5525ba27b2 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakerefsnumber.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.NumberWithValidations; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 9745c78a642..5ded6da8e72 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 171ec9b3282..e33c016de53 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakerefsstring.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.StringSchema; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index 71fcc504e0e..fff2e305cd2 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -26,6 +26,7 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream.ApplicationoctetstreamSchema; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -58,7 +59,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import ApplicationoctetstreamSchema1BoxedString requestBodyPayload = ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1.validateAndBox( "a", diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index aeeffb50866..2d75be3d510 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakeuploadfile.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index ee9ea0873db..121eaa5ec6f 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -23,6 +23,7 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` import org.openapijsonschematools.client.paths.fakeuploadfiles.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index f50cfb338a1..b19518e7dd4 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -27,6 +27,7 @@ a class that allows one to call the endpoint using a method named post import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; import org.openapijsonschematools.client.paths.pet.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.Pet; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -71,7 +72,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import Pet1BoxedMap requestBodyPayload = Pet.Pet1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index fd27b03f291..638cdef4274 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -27,6 +27,7 @@ a class that allows one to call the endpoint using a method named put import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.pet.put.PetPutSecurityInfo; import org.openapijsonschematools.client.paths.pet.put.RequestBody; +import org.openapijsonschematools.client.components.schemas.Pet; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -67,7 +68,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); -// todo add this import Pet1BoxedMap requestBodyPayload = Pet.Pet1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index 5f3151768c3..a38889cd2a8 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -26,6 +26,7 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.storeorder.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.Order; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -58,7 +59,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import Order1BoxedMap requestBodyPayload = Order.Order1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index 56711a5e2d2..91f61a3753e 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -26,6 +26,7 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.user.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.User; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -58,7 +59,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import User1BoxedMap requestBodyPayload = User.User1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index fb61b7a6327..c55457c9bda 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -26,6 +26,7 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.usercreatewitharray.post.RequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -58,7 +59,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import ApplicationjsonSchema1BoxedList requestBodyPayload = ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index 92712bc5dc9..b6fd44be6b2 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -26,6 +26,7 @@ a class that allows one to call the endpoint using a method named post ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.usercreatewithlist.post.RequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -58,7 +59,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); -// todo add this import ApplicationjsonSchema1BoxedList requestBodyPayload = ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index ecc51e4e52b..fced134be8c 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -28,6 +28,7 @@ a class that allows one to call the endpoint using a method named put ``` import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.userusername.put.RequestBody; +import org.openapijsonschematools.client.components.schemas.User; import org.openapijsonschematools.client.paths.userusername.put.PathParameters; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; @@ -61,7 +62,6 @@ ApiConfiguration apiConfiguration = new ApiConfiguration( SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); -// todo add this import User1BoxedMap requestBodyPayload = User.User1.validateAndBox( diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index b4340f479b5..fa2d4efa6e5 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -15,6 +15,21 @@ 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}} @@ -150,7 +165,6 @@ SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeyw {{#each content}} {{#if @first}} {{#with schema}} -// todo add this import {{#with getSelfOrDeepestRef}} {{> src/main/java/packagename/components/schemas/validateAndBoxSchemaCodeSample payloadVarName="requestBodyPayload" configVarName="schemaConfiguration" }} {{/with}} From 57ae4a3052070b33c5e210eee4d11a4d573358f4 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 16:37:41 -0700 Subject: [PATCH 38/53] Adds general exception types to operation invocation --- .../java/docs/paths/anotherfakedummy/Patch.md | 21 +++++++++++++++---- .../docs/paths/commonparamsubdir/Delete.md | 21 +++++++++++++++---- .../java/docs/paths/commonparamsubdir/Get.md | 21 +++++++++++++++---- .../java/docs/paths/commonparamsubdir/Post.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/fake/Delete.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/fake/Get.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/fake/Patch.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/fake/Post.md | 21 +++++++++++++++---- .../Get.md | 21 +++++++++++++++---- .../docs/paths/fakebodywithfileschema/Put.md | 21 +++++++++++++++---- .../docs/paths/fakebodywithqueryparams/Put.md | 21 +++++++++++++++---- .../docs/paths/fakecasesensitiveparams/Put.md | 21 +++++++++++++++---- .../docs/paths/fakeclassnametest/Patch.md | 21 +++++++++++++++---- .../docs/paths/fakedeletecoffeeid/Delete.md | 21 +++++++++++++++---- .../java/docs/paths/fakehealth/Get.md | 21 +++++++++++++++---- .../fakeinlineadditionalproperties/Post.md | 21 +++++++++++++++---- .../docs/paths/fakeinlinecomposition/Post.md | 21 +++++++++++++++---- .../java/docs/paths/fakejsonformdata/Get.md | 21 +++++++++++++++---- .../java/docs/paths/fakejsonpatch/Patch.md | 21 +++++++++++++++---- .../docs/paths/fakejsonwithcharset/Post.md | 21 +++++++++++++++---- .../Post.md | 21 +++++++++++++++---- .../paths/fakemultipleresponsebodies/Get.md | 21 +++++++++++++++---- .../docs/paths/fakemultiplesecurities/Get.md | 21 +++++++++++++++---- .../java/docs/paths/fakeobjinquery/Get.md | 21 +++++++++++++++---- .../Post.md | 21 +++++++++++++++---- .../java/docs/paths/fakepemcontenttype/Get.md | 21 +++++++++++++++---- .../Post.md | 21 +++++++++++++++---- .../fakequeryparamwithjsoncontenttype/Get.md | 21 +++++++++++++++---- .../java/docs/paths/fakeredirection/Get.md | 21 +++++++++++++++---- .../java/docs/paths/fakerefobjinquery/Get.md | 21 +++++++++++++++---- .../docs/paths/fakerefsarraymodel/Post.md | 21 +++++++++++++++---- .../docs/paths/fakerefsarrayofenums/Post.md | 21 +++++++++++++++---- .../java/docs/paths/fakerefsboolean/Post.md | 21 +++++++++++++++---- .../Post.md | 21 +++++++++++++++---- .../java/docs/paths/fakerefsenum/Post.md | 21 +++++++++++++++---- .../java/docs/paths/fakerefsmammal/Post.md | 21 +++++++++++++++---- .../java/docs/paths/fakerefsnumber/Post.md | 21 +++++++++++++++---- .../fakerefsobjectmodelwithrefprops/Post.md | 21 +++++++++++++++---- .../java/docs/paths/fakerefsstring/Post.md | 21 +++++++++++++++---- .../paths/fakeresponsewithoutschema/Get.md | 21 +++++++++++++++---- .../docs/paths/faketestqueryparamters/Put.md | 21 +++++++++++++++---- .../docs/paths/fakeuploaddownloadfile/Post.md | 21 +++++++++++++++---- .../java/docs/paths/fakeuploadfile/Post.md | 21 +++++++++++++++---- .../java/docs/paths/fakeuploadfiles/Post.md | 21 +++++++++++++++---- .../docs/paths/fakewildcardresponses/Get.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/foo/Get.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/pet/Post.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/pet/Put.md | 21 +++++++++++++++---- .../java/docs/paths/petfindbystatus/Get.md | 21 +++++++++++++++---- .../java/docs/paths/petfindbytags/Get.md | 21 +++++++++++++++---- .../java/docs/paths/petpetid/Delete.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/petpetid/Get.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/petpetid/Post.md | 21 +++++++++++++++---- .../docs/paths/petpetiduploadimage/Post.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/solidus/Get.md | 21 +++++++++++++++---- .../java/docs/paths/storeinventory/Get.md | 21 +++++++++++++++---- .../java/docs/paths/storeorder/Post.md | 21 +++++++++++++++---- .../docs/paths/storeorderorderid/Delete.md | 21 +++++++++++++++---- .../java/docs/paths/storeorderorderid/Get.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/user/Post.md | 21 +++++++++++++++---- .../docs/paths/usercreatewitharray/Post.md | 21 +++++++++++++++---- .../docs/paths/usercreatewithlist/Post.md | 21 +++++++++++++++---- .../petstore/java/docs/paths/userlogin/Get.md | 21 +++++++++++++++---- .../java/docs/paths/userlogout/Get.md | 21 +++++++++++++++---- .../java/docs/paths/userusername/Delete.md | 21 +++++++++++++++---- .../java/docs/paths/userusername/Get.md | 21 +++++++++++++++---- .../java/docs/paths/userusername/Put.md | 21 +++++++++++++++---- .../path/verb/_OperationDocCodeSample.hbs | 21 +++++++++++++++---- 68 files changed, 1156 insertions(+), 272 deletions(-) diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 59b8aa99185..48e35d83c4b 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.anotherfakedummy.Patch; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -76,11 +82,18 @@ var request = new PatchRequestBuilder() try { Responses.EndpointResponse response = apiClient.patch(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index 96c6c730cc6..1a692e8b2c0 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.commonparamsubdir.Delete; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -76,11 +82,18 @@ var request = new DeleteRequestBuilder() try { Responses.EndpointResponse response = apiClient.delete(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index 1fd7d542083..78879e29bc2 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.commonparamsubdir.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -76,11 +82,18 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index cebd6984d74..47c33fdbfac 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.commonparamsubdir.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -76,11 +82,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index 8a7081793c6..3849509d5fc 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -38,11 +38,17 @@ import org.openapijsonschematools.client.components.securityschemes.BearerTest; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fake.Delete; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -108,11 +114,18 @@ var request = new DeleteRequestBuilder() try { Responses.EndpointResponse response = apiClient.delete(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index ead787b2542..ca189571bd8 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fake.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -64,11 +70,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index 6ec0b841c15..e4189ee5dc1 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fake.Patch; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -76,11 +82,18 @@ var request = new PatchRequestBuilder() try { Responses.EndpointResponse response = apiClient.patch(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index 0b9d6083c71..e1131eaf8eb 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -34,11 +34,17 @@ import org.openapijsonschematools.client.components.securityschemes.HttpBasicTes import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fake.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -73,11 +79,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index 42aa5df84c2..c3b13732366 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeadditionalpropertieswitharrayofenums.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index 0d034b54135..835111bec16 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakebodywithfileschema.Put; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -78,11 +84,18 @@ var request = new PutRequestBuilder() try { Responses.EndpointResponse response = apiClient.put(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index 5f8b874ee60..9ee13fb7964 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -36,11 +36,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakebodywithqueryparams.Put; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -106,11 +112,18 @@ var request = new PutRequestBuilder() try { Responses.EndpointResponse response = apiClient.put(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index e0e5a69148c..f1753c26996 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -32,11 +32,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakecasesensitiveparams.Put; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -79,11 +85,18 @@ var request = new PutRequestBuilder() try { Responses.EndpointResponse response = apiClient.put(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index dfef3d9c934..e3c3d308f10 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -36,11 +36,17 @@ import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeclassnametest.Patch; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -87,11 +93,18 @@ var request = new PatchRequestBuilder() try { Responses.EndpointResponse response = apiClient.patch(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index d357865b4a9..072760d23d9 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -32,11 +32,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakedeletecoffeeid.Delete; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -75,11 +81,18 @@ var request = new DeleteRequestBuilder() try { Responses.EndpointResponse response = apiClient.delete(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index cf95e4875bb..038f9a3f740 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -29,11 +29,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakehealth.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -60,11 +66,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index 1e04d3bfa4b..d4b430cd5e2 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeinlineadditionalproperties.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -76,11 +82,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index d1af832e9a6..06211e68c0a 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -32,11 +32,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeinlinecomposition.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -63,11 +69,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index 043e723eb12..559485d3078 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakejsonformdata.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index c4a34ded372..76d83e6a6c8 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakejsonpatch.Patch; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PatchRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.patch(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index b8e99d37676..3e79edd8cae 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakejsonwithcharset.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index ce2c3930cdd..824d6466370 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakemultiplerequestbodycontenttypes.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index ae6cb301945..1cd01fc9787 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -29,11 +29,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakemultipleresponsebodies.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -60,11 +66,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index 7facab804f9..1a1f9e63f8c 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -34,11 +34,17 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakemultiplesecurities.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -76,11 +82,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index f1f0c201c3c..56639b176c3 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -30,11 +30,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeobjinquery.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -61,11 +67,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index a0cc65cb357..13ea3d435be 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -36,11 +36,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeparametercollisions1ababselfab.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -87,11 +93,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index 4c8944c3b93..7ba4dafaf9b 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakepemcontenttype.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index 25d941df316..54f194ed11e 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -36,11 +36,17 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakepetiduploadimagewithrequiredfile.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -84,11 +90,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index e17289d1fb1..36238230be9 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -32,11 +32,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakequeryparamwithjsoncontenttype.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -73,11 +79,18 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index e7948db0117..f106c88fef8 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -29,11 +29,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeredirection.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -60,11 +66,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index 5b6ef0cf4fa..6c8ead4e417 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -30,11 +30,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefobjinquery.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -61,11 +67,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index acae872d7c9..30cc642c90e 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsarraymodel.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index 15d8b7cf473..66115d73053 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsarrayofenums.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index f6b5af1b0b8..2896b2a1e6f 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsboolean.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index c922a70eaa0..f07a1af86b7 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefscomposedoneofnumberwithvalidations.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index 00ca4979cc7..4d25c2b9311 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsenum.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index 8823683af05..16e8b8caad8 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsmammal.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -67,11 +73,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index a5525ba27b2..5c2c4db37e8 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsnumber.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 5ded6da8e72..0fdfd815a20 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsobjectmodelwithrefprops.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index e33c016de53..90e1c449bc6 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsstring.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index a60aee7b298..6d9482fd413 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -29,11 +29,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeresponsewithoutschema.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -60,11 +66,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index 77d8d046f50..ea8aa64a558 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -32,11 +32,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.faketestqueryparamters.Put; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -100,11 +106,18 @@ var request = new PutRequestBuilder() try { Responses.EndpointResponse response = apiClient.put(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index fff2e305cd2..5d03a4e2437 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeuploaddownloadfile.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -72,11 +78,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index 2d75be3d510..8dae444fa5c 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeuploadfile.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index 121eaa5ec6f..ef741272f51 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -31,11 +31,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeuploadfiles.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -62,11 +68,18 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index 6ee9a9cd69e..6b740e78934 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -29,11 +29,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakewildcardresponses.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -60,11 +66,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index cde10f5fbf7..2481fa62193 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -28,11 +28,17 @@ import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer1; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.foo.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -58,11 +64,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index b19518e7dd4..3c1fdfc8e8f 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -38,11 +38,17 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.pet.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -120,11 +126,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index 638cdef4274..ad51dad45a5 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -37,11 +37,17 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.pet.Put; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -116,11 +122,18 @@ var request = new PutRequestBuilder() try { Void response = apiClient.put(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index fd4f1988669..82e707e9751 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -36,11 +36,17 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.petfindbystatus.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -89,11 +95,18 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index 136c5e2783d..93a063f9f64 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -36,11 +36,17 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.petfindbytags.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -87,11 +93,18 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index 051c55bfaf1..eb9c36f7696 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -37,11 +37,17 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.petpetid.Delete; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -88,11 +94,18 @@ var request = new DeleteRequestBuilder() try { Void response = apiClient.delete(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index 650fa3afc3f..65eeeb92c0e 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -35,11 +35,17 @@ import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.petpetid.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -86,11 +92,18 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index 5d225590744..523417e2062 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -37,11 +37,17 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.petpetid.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -88,11 +94,18 @@ var request = new PostRequestBuilder() try { Void response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index 443cc7ef17a..9c0c76b2499 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -36,11 +36,17 @@ import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.petpetiduploadimage.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -84,11 +90,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index efeeb014d47..a5df7f362a7 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -29,11 +29,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.solidus.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -60,11 +66,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index 51eb3785217..ee57e0f9110 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -32,11 +32,17 @@ import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.storeinventory.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -71,11 +77,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index a38889cd2a8..b7ed44d4002 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.storeorder.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -86,11 +92,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index ae2e56de8f0..fc3d22a2f48 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -32,11 +32,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.storeorderorderid.Delete; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -75,11 +81,18 @@ var request = new DeleteRequestBuilder() try { Void response = apiClient.delete(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index c0b1dc52f9d..b33b42e7118 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -32,11 +32,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.storeorderorderid.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -75,11 +81,18 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index 91f61a3753e..1283287e038 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.user.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -92,11 +98,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index c55457c9bda..a48a262bd63 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.usercreatewitharray.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -114,11 +120,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index b6fd44be6b2..c96dac5029c 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -33,11 +33,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.usercreatewithlist.Post; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -114,11 +120,18 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index aa2c3763341..4e3feb61f42 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -32,11 +32,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.userlogin.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -77,11 +83,18 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index 973147966c2..6c2e3ea1f39 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -29,11 +29,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.userlogout.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -60,11 +66,18 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index 7ffaa0b1639..d671c8693de 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -32,11 +32,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.userusername.Delete; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -75,11 +81,18 @@ var request = new DeleteRequestBuilder() try { Responses.EndpointResponse response = apiClient.delete(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index c2457c24c34..f9879baa415 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -32,11 +32,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.userusername.Get; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -75,11 +81,18 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index fced134be8c..c204ee3a717 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -36,11 +36,17 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.userusername.Put; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -106,11 +112,18 @@ var request = new PutRequestBuilder() try { Void response = apiClient.put(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } ``` diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index fa2d4efa6e5..c6d4918dfd2 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -65,11 +65,17 @@ import {{packageName}}.components.securityschemes.{{jsonPathPiece.pascalCase}}; import {{packageName}}.configurations.ApiConfiguration; import {{packageName}}.configurations.SchemaConfiguration; import {{packageName}}.configurations.JsonSchemaKeywordFlags; +import {{packageName}}.exceptions.ValidationException; +import {{packageName}}.exceptions.OpenapiDocumentException; +import {{packageName}}.exceptions.NotImplementedException; +import {{packageName}}.exceptions.InvalidTypeException; +import {{packageName}}.exceptions.ApiException; import {{{packageName}}}.schemas.validation.MapUtils; import {{{packageName}}}.schemas.validation.FrozenList; import {{{packageName}}}.schemas.validation.FrozenMap; import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.AbstractMap; @@ -201,11 +207,18 @@ var request = new {{className.pascalCase}}() try { {{#if nonErrorResponses }}{{responses.jsonPathPiece.pascalCase}}.EndpointResponse{{else}}Void{{/if}} response = apiClient.{{jsonPathPiece.camelCase}}(request); -} catch (ApiException e) { - // server returned a response not defined in the openapi document +} catch (ApiException | OpenapiDocumentException e) { + // server returned a response/contentType not defined in the openapi document throw e; -} catch (RuntimeException e) { - // +} catch (ValidationException | InvalidTypeException 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; } {{/with}} From 5398c982fa34f9b4a4feedd18291b36547c77306 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 2 Apr 2024 17:56:23 -0700 Subject: [PATCH 39/53] Upses SimpleEntry for header and parameter content info --- .../packagename/components/headers/Header.hbs | 4 +-- .../components/headers/HeaderDoc.hbs | 2 +- .../components/parameter/Parameter.hbs | 4 +-- .../components/parameter/ParameterDoc.hbs | 2 +- .../java/packagename/header/ContentHeader.hbs | 35 ++++++++----------- .../parameter/ContentParameter.hbs | 19 +++++----- 6 files changed, 27 insertions(+), 39 deletions(-) diff --git a/src/main/resources/java/src/main/java/packagename/components/headers/Header.hbs b/src/main/resources/java/src/main/java/packagename/components/headers/Header.hbs index 2caecbebe3a..26fc5769942 100644 --- a/src/main/resources/java/src/main/java/packagename/components/headers/Header.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/headers/Header.hbs @@ -61,11 +61,9 @@ public class {{jsonPathPiece.pascalCase}} { {{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}} ); {{else}} - Map.ofEntries( {{#each content}} - new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()){{#unless @last}},{{/unless}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()) {{/each}} - ) ); {{/if}} } diff --git a/src/main/resources/java/src/main/java/packagename/components/headers/HeaderDoc.hbs b/src/main/resources/java/src/main/java/packagename/components/headers/HeaderDoc.hbs index 8a1217bbacf..6f7f3ef3bc5 100644 --- a/src/main/resources/java/src/main/java/packagename/components/headers/HeaderDoc.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/headers/HeaderDoc.hbs @@ -79,7 +79,7 @@ a class that deserializes a header value | @Nullable Boolean explode | {{explode}} | | @Nullable Boolean allowReserved | null | {{#each content}} -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new [{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)())
)
the contentType to schema info | +| 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}} diff --git a/src/main/resources/java/src/main/java/packagename/components/parameter/Parameter.hbs b/src/main/resources/java/src/main/java/packagename/components/parameter/Parameter.hbs index 690e0bb9160..3a7dca06d8f 100644 --- a/src/main/resources/java/src/main/java/packagename/components/parameter/Parameter.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/parameter/Parameter.hbs @@ -67,11 +67,9 @@ public class {{jsonPathPiece.pascalCase}} { {{#if schema}} {{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}} {{else}} - Map.ofEntries( {{#each content}} - new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()){{#unless @last}},{{/unless}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()) {{/each}} - ) {{/if}} ); } diff --git a/src/main/resources/java/src/main/java/packagename/components/parameter/ParameterDoc.hbs b/src/main/resources/java/src/main/java/packagename/components/parameter/ParameterDoc.hbs index 96dd8f01983..0161690fd53 100644 --- a/src/main/resources/java/src/main/java/packagename/components/parameter/ParameterDoc.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/parameter/ParameterDoc.hbs @@ -81,7 +81,7 @@ a class that deserializes a parameter value | @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}} -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new [{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)())
)
the contentType to schema info | +| 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}} diff --git a/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs b/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs index d831b327b8b..632a882cf1b 100644 --- a/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs @@ -14,12 +14,13 @@ 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 Map> content; + public final AbstractMap.SimpleEntry> content; - public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, Map> content) { + public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, AbstractMap.SimpleEntry> content) { super(required, ParameterStyle.SIMPLE, explode, allowReserved); this.content = content; } @@ -32,17 +33,14 @@ public class ContentHeader extends HeaderBase implements Header { @Override public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { - for (Map.Entry> entry: content.entrySet()) { - var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; - String contentType = entry.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"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override @@ -50,15 +48,12 @@ public class ContentHeader extends HeaderBase implements Header { String inDataJoined = String.join(",", inData); // unsure if this is needed @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); if (validate) { - for (Map.Entry> entry: content.entrySet()) { - String contentType = entry.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - return entry.getValue().schema().validate(deserializedJson, configuration); - } else { - throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } return deserializedJson; } diff --git a/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs b/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs index 2902dd97a54..0edc01f1a97 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs @@ -11,24 +11,21 @@ import java.util.Map; import java.util.AbstractMap; public class ContentParameter extends ParameterBase implements Parameter { - public final Map> content; + public final AbstractMap.SimpleEntry> content; - public ContentParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, Map> 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, OpenapiDocumentException { - for (Map.Entry> entry: content.entrySet()) { - String contentType = entry.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"); - } + 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"); } - throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); } } \ No newline at end of file From 7c813c8d3728e014bd90b4977ecd1e5476d895e1 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 3 Apr 2024 01:59:37 -0700 Subject: [PATCH 40/53] Replaces header and parameter content map with SimpleEntry --- .../headers/Int32JsonContentTypeHeader.md | 2 +- .../headers/RefContentSchemaHeader.md | 2 +- .../ComponentRefSchemaStringWithValidation.md | 2 +- .../headers/Int32JsonContentTypeHeader.java | 4 +-- .../headers/RefContentSchemaHeader.java | 4 +-- ...omponentRefSchemaStringWithValidation.java | 4 +-- .../client/header/ContentHeader.java | 35 ++++++++----------- .../client/parameter/ContentParameter.java | 19 +++++----- .../get/parameters/Parameter0.java | 4 +-- .../code200response/headers/XRateLimit.java | 4 +-- .../client/header/ContentHeaderTest.java | 3 +- .../packagename/components/headers/Header.hbs | 1 - .../components/parameter/Parameter.hbs | 1 - .../packagename/header/ContentHeaderTest.hbs | 3 +- 14 files changed, 35 insertions(+), 53 deletions(-) diff --git a/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md b/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md index 0719e44d623..0a6ef69c824 100644 --- a/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md +++ b/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md @@ -48,7 +48,7 @@ a class that deserializes a header value | @Nullable ParameterStyle | ParameterStyle.SIMPLE | | @Nullable Boolean explode | false | | @Nullable Boolean allowReserved | null | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | +| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
the contentType to schema info | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md b/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md index dbb069c6ae6..f267518fd67 100644 --- a/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md +++ b/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md @@ -48,7 +48,7 @@ a class that deserializes a header value | @Nullable ParameterStyle | ParameterStyle.SIMPLE | | @Nullable Boolean explode | false | | @Nullable Boolean allowReserved | null | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | +| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
the contentType to schema info | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md b/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md index 882379fc131..2d4bf3bc54c 100644 --- a/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md +++ b/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md @@ -50,7 +50,7 @@ a class that deserializes a parameter value | @Nullable Boolean explode | null | | @Nullable ParameterStyle | null | | @Nullable Boolean allowReserved | false | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | +| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
the contentType to schema info | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java index 5d91b356758..ad152c11f72 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java @@ -25,9 +25,7 @@ public Int32JsonContentTypeHeader1() { true, null, false, - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java index 14fb0ea2ef2..d0f3cb63637 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java @@ -25,9 +25,7 @@ public RefContentSchemaHeader1() { true, null, false, - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java index be499256cb1..62c84a70fa1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java @@ -29,9 +29,7 @@ public ComponentRefSchemaStringWithValidation1() { null, null, false, - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java index 13c8f50bcc9..6ba33b6bb8d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -14,12 +14,13 @@ 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 Map> content; + public final AbstractMap.SimpleEntry> content; - public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, Map> content) { + public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, AbstractMap.SimpleEntry> content) { super(required, ParameterStyle.SIMPLE, explode, allowReserved); this.content = content; } @@ -32,17 +33,14 @@ private static HttpHeaders toHeaders(String name, String value) { @Override public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { - for (Map.Entry> entry: content.entrySet()) { - var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; - String contentType = entry.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"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override @@ -50,15 +48,12 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid String inDataJoined = String.join(",", inData); // unsure if this is needed @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); if (validate) { - for (Map.Entry> entry: content.entrySet()) { - String contentType = entry.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - return entry.getValue().schema().validate(deserializedJson, configuration); - } else { - throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } return deserializedJson; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java index 431fa2c90da..11b75bd399c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java @@ -11,24 +11,21 @@ import java.util.AbstractMap; public class ContentParameter extends ParameterBase implements Parameter { - public final Map> content; + public final AbstractMap.SimpleEntry> content; - public ContentParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, Map> 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, OpenapiDocumentException { - for (Map.Entry> entry: content.entrySet()) { - String contentType = entry.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"); - } + 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"); } - throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java index 0195dc24e67..bb130bbd611 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java @@ -29,9 +29,7 @@ public Parameter01() { null, null, false, - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java index 0bc9ca1d34c..4ab8688571a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java @@ -25,9 +25,7 @@ public XRateLimit1() { true, null, false, - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) ); } } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java index c47e21d3fc6..48b1e4632ef 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java @@ -12,6 +12,7 @@ import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.net.http.HttpHeaders; +import java.util.AbstractMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -103,7 +104,7 @@ public Void encoding() { return null; } } - Map> content = Map.of( + AbstractMap.SimpleEntry> content = new AbstractMap.SimpleEntry<>( "application/json", new ApplicationJsonMediaType() ); for (ParamTestCase testCase: testCases) { diff --git a/src/main/resources/java/src/main/java/packagename/components/headers/Header.hbs b/src/main/resources/java/src/main/java/packagename/components/headers/Header.hbs index 26fc5769942..f1519266544 100644 --- a/src/main/resources/java/src/main/java/packagename/components/headers/Header.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/headers/Header.hbs @@ -34,7 +34,6 @@ import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; {{/each}} import java.util.AbstractMap; -import java.util.Map; {{/if}} public class {{jsonPathPiece.pascalCase}} { diff --git a/src/main/resources/java/src/main/java/packagename/components/parameter/Parameter.hbs b/src/main/resources/java/src/main/java/packagename/components/parameter/Parameter.hbs index 3a7dca06d8f..62629839e15 100644 --- a/src/main/resources/java/src/main/java/packagename/components/parameter/Parameter.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/parameter/Parameter.hbs @@ -38,7 +38,6 @@ import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; {{/each}} import java.util.AbstractMap; -import java.util.Map; {{/if}} public class {{jsonPathPiece.pascalCase}} { diff --git a/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs b/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs index 8eab87ca449..270bd752c0c 100644 --- a/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs @@ -12,6 +12,7 @@ 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; @@ -103,7 +104,7 @@ public class ContentHeaderTest { return null; } } - Map> content = Map.of( + AbstractMap.SimpleEntry> content = new AbstractMap.SimpleEntry<>( "application/json", new ApplicationJsonMediaType() ); for (ParamTestCase testCase: testCases) { From 330cb31dd19e50b5bc56a0186171328f857c64c9 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 3 Apr 2024 11:02:25 -0700 Subject: [PATCH 41/53] Replaces OpenapiDocumentException with ApiException --- .../petstore/java/.openapi-generator/FILES | 1 - .../java/docs/paths/anotherfakedummy/Patch.md | 3 +- .../docs/paths/commonparamsubdir/Delete.md | 3 +- .../java/docs/paths/commonparamsubdir/Get.md | 3 +- .../java/docs/paths/commonparamsubdir/Post.md | 3 +- .../petstore/java/docs/paths/fake/Delete.md | 3 +- .../petstore/java/docs/paths/fake/Get.md | 3 +- .../petstore/java/docs/paths/fake/Patch.md | 3 +- .../petstore/java/docs/paths/fake/Post.md | 3 +- .../Get.md | 3 +- .../docs/paths/fakebodywithfileschema/Put.md | 3 +- .../docs/paths/fakebodywithqueryparams/Put.md | 3 +- .../docs/paths/fakecasesensitiveparams/Put.md | 3 +- .../docs/paths/fakeclassnametest/Patch.md | 3 +- .../docs/paths/fakedeletecoffeeid/Delete.md | 3 +- .../java/docs/paths/fakehealth/Get.md | 3 +- .../fakeinlineadditionalproperties/Post.md | 3 +- .../docs/paths/fakeinlinecomposition/Post.md | 3 +- .../java/docs/paths/fakejsonformdata/Get.md | 3 +- .../java/docs/paths/fakejsonpatch/Patch.md | 3 +- .../docs/paths/fakejsonwithcharset/Post.md | 3 +- .../Post.md | 3 +- .../paths/fakemultipleresponsebodies/Get.md | 3 +- .../docs/paths/fakemultiplesecurities/Get.md | 3 +- .../java/docs/paths/fakeobjinquery/Get.md | 3 +- .../Post.md | 3 +- .../java/docs/paths/fakepemcontenttype/Get.md | 3 +- .../Post.md | 3 +- .../fakequeryparamwithjsoncontenttype/Get.md | 3 +- .../java/docs/paths/fakeredirection/Get.md | 3 +- .../java/docs/paths/fakerefobjinquery/Get.md | 3 +- .../docs/paths/fakerefsarraymodel/Post.md | 3 +- .../docs/paths/fakerefsarrayofenums/Post.md | 3 +- .../java/docs/paths/fakerefsboolean/Post.md | 3 +- .../Post.md | 3 +- .../java/docs/paths/fakerefsenum/Post.md | 3 +- .../java/docs/paths/fakerefsmammal/Post.md | 3 +- .../java/docs/paths/fakerefsnumber/Post.md | 3 +- .../fakerefsobjectmodelwithrefprops/Post.md | 3 +- .../java/docs/paths/fakerefsstring/Post.md | 3 +- .../paths/fakeresponsewithoutschema/Get.md | 3 +- .../docs/paths/faketestqueryparamters/Put.md | 3 +- .../docs/paths/fakeuploaddownloadfile/Post.md | 3 +- .../java/docs/paths/fakeuploadfile/Post.md | 3 +- .../java/docs/paths/fakeuploadfiles/Post.md | 3 +- .../docs/paths/fakewildcardresponses/Get.md | 3 +- .../petstore/java/docs/paths/foo/Get.md | 3 +- .../petstore/java/docs/paths/pet/Post.md | 3 +- .../petstore/java/docs/paths/pet/Put.md | 3 +- .../java/docs/paths/petfindbystatus/Get.md | 3 +- .../java/docs/paths/petfindbytags/Get.md | 3 +- .../java/docs/paths/petpetid/Delete.md | 3 +- .../petstore/java/docs/paths/petpetid/Get.md | 3 +- .../petstore/java/docs/paths/petpetid/Post.md | 3 +- .../docs/paths/petpetiduploadimage/Post.md | 3 +- .../petstore/java/docs/paths/solidus/Get.md | 3 +- .../java/docs/paths/storeinventory/Get.md | 3 +- .../java/docs/paths/storeorder/Post.md | 3 +- .../docs/paths/storeorderorderid/Delete.md | 3 +- .../java/docs/paths/storeorderorderid/Get.md | 3 +- .../petstore/java/docs/paths/user/Post.md | 3 +- .../docs/paths/usercreatewitharray/Post.md | 3 +- .../docs/paths/usercreatewithlist/Post.md | 3 +- .../petstore/java/docs/paths/userlogin/Get.md | 3 +- .../java/docs/paths/userlogout/Get.md | 3 +- .../java/docs/paths/userusername/Delete.md | 3 +- .../java/docs/paths/userusername/Get.md | 3 +- .../java/docs/paths/userusername/Put.md | 3 +- .../headers/Int32JsonContentTypeHeader.java | 1 - .../headers/RefContentSchemaHeader.java | 1 - ...omponentRefSchemaStringWithValidation.java | 1 - .../responses/HeadersWithNoBody.java | 3 +- .../responses/SuccessDescriptionOnly.java | 3 +- .../SuccessInlineContentAndHeader.java | 15 +++------ .../responses/SuccessWithJsonApiResponse.java | 15 +++------ .../SuccessfulXmlAndJsonArrayOfPet.java | 11 ++----- .../client/parameter/ContentParameter.java | 3 +- .../client/parameter/CookieSerializer.java | 3 +- .../client/parameter/HeadersSerializer.java | 3 +- .../client/parameter/Parameter.java | 3 +- .../client/parameter/PathSerializer.java | 3 +- .../client/parameter/QuerySerializer.java | 3 +- .../client/paths/anotherfakedummy/Patch.java | 5 ++- .../anotherfakedummy/patch/Responses.java | 3 +- .../patch/responses/Code200Response.java | 15 +++------ .../paths/commonparamsubdir/Delete.java | 5 ++- .../client/paths/commonparamsubdir/Get.java | 5 ++- .../client/paths/commonparamsubdir/Post.java | 5 ++- .../commonparamsubdir/delete/Responses.java | 3 +- .../commonparamsubdir/get/Responses.java | 3 +- .../commonparamsubdir/post/Responses.java | 3 +- .../client/paths/fake/Delete.java | 5 ++- .../client/paths/fake/Get.java | 5 ++- .../client/paths/fake/Patch.java | 5 ++- .../client/paths/fake/Post.java | 5 ++- .../client/paths/fake/delete/Responses.java | 3 +- .../client/paths/fake/get/Responses.java | 3 +- .../fake/get/responses/Code404Response.java | 15 +++------ .../client/paths/fake/patch/Responses.java | 3 +- .../fake/patch/responses/Code200Response.java | 15 +++------ .../client/paths/fake/post/Responses.java | 3 +- .../fake/post/responses/Code404Response.java | 3 +- .../Get.java | 5 ++- .../get/Responses.java | 3 +- .../get/responses/Code200Response.java | 15 +++------ .../paths/fakebodywithfileschema/Put.java | 5 ++- .../fakebodywithfileschema/put/Responses.java | 3 +- .../paths/fakebodywithqueryparams/Put.java | 5 ++- .../put/Responses.java | 3 +- .../paths/fakecasesensitiveparams/Put.java | 5 ++- .../put/Responses.java | 3 +- .../client/paths/fakeclassnametest/Patch.java | 5 ++- .../fakeclassnametest/patch/Responses.java | 3 +- .../patch/responses/Code200Response.java | 15 +++------ .../paths/fakedeletecoffeeid/Delete.java | 5 ++- .../fakedeletecoffeeid/delete/Responses.java | 3 +- .../delete/responses/CodedefaultResponse.java | 3 +- .../client/paths/fakehealth/Get.java | 5 ++- .../paths/fakehealth/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 15 +++------ .../fakeinlineadditionalproperties/Post.java | 5 ++- .../post/Responses.java | 3 +- .../paths/fakeinlinecomposition/Post.java | 5 ++- .../fakeinlinecomposition/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 11 ++----- .../client/paths/fakejsonformdata/Get.java | 5 ++- .../paths/fakejsonformdata/get/Responses.java | 3 +- .../client/paths/fakejsonpatch/Patch.java | 5 ++- .../paths/fakejsonpatch/patch/Responses.java | 3 +- .../paths/fakejsonwithcharset/Post.java | 5 ++- .../fakejsonwithcharset/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../Post.java | 5 ++- .../post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../paths/fakemultipleresponsebodies/Get.java | 5 ++- .../get/Responses.java | 3 +- .../get/responses/Code200Response.java | 15 +++------ .../get/responses/Code202Response.java | 15 +++------ .../paths/fakemultiplesecurities/Get.java | 5 ++- .../fakemultiplesecurities/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 15 +++------ .../client/paths/fakeobjinquery/Get.java | 5 ++- .../paths/fakeobjinquery/get/Responses.java | 3 +- .../Post.java | 5 ++- .../post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../client/paths/fakepemcontenttype/Get.java | 5 ++- .../fakepemcontenttype/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 15 +++------ .../Post.java | 5 ++- .../post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../Get.java | 5 ++- .../get/Responses.java | 3 +- .../get/parameters/Parameter0.java | 1 - .../get/responses/Code200Response.java | 15 +++------ .../client/paths/fakeredirection/Get.java | 5 ++- .../paths/fakeredirection/get/Responses.java | 3 +- .../get/responses/Code303Response.java | 3 +- .../get/responses/Code3XXResponse.java | 3 +- .../client/paths/fakerefobjinquery/Get.java | 5 ++- .../fakerefobjinquery/get/Responses.java | 3 +- .../client/paths/fakerefsarraymodel/Post.java | 5 ++- .../fakerefsarraymodel/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../paths/fakerefsarrayofenums/Post.java | 5 ++- .../fakerefsarrayofenums/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../client/paths/fakerefsboolean/Post.java | 5 ++- .../paths/fakerefsboolean/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../Post.java | 5 ++- .../post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../client/paths/fakerefsenum/Post.java | 5 ++- .../paths/fakerefsenum/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../client/paths/fakerefsmammal/Post.java | 5 ++- .../paths/fakerefsmammal/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../client/paths/fakerefsnumber/Post.java | 5 ++- .../paths/fakerefsnumber/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../fakerefsobjectmodelwithrefprops/Post.java | 5 ++- .../post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../client/paths/fakerefsstring/Post.java | 5 ++- .../paths/fakerefsstring/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../paths/fakeresponsewithoutschema/Get.java | 5 ++- .../get/Responses.java | 3 +- .../get/responses/Code200Response.java | 3 +- .../paths/faketestqueryparamters/Put.java | 5 ++- .../faketestqueryparamters/put/Responses.java | 3 +- .../paths/fakeuploaddownloadfile/Post.java | 5 ++- .../post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../client/paths/fakeuploadfile/Post.java | 5 ++- .../paths/fakeuploadfile/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../client/paths/fakeuploadfiles/Post.java | 5 ++- .../paths/fakeuploadfiles/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 15 +++------ .../paths/fakewildcardresponses/Get.java | 5 ++- .../fakewildcardresponses/get/Responses.java | 3 +- .../get/responses/Code1XXResponse.java | 15 +++------ .../get/responses/Code200Response.java | 15 +++------ .../get/responses/Code2XXResponse.java | 15 +++------ .../get/responses/Code3XXResponse.java | 15 +++------ .../get/responses/Code4XXResponse.java | 15 +++------ .../get/responses/Code5XXResponse.java | 15 +++------ .../client/paths/foo/Get.java | 5 ++- .../client/paths/foo/get/Responses.java | 3 +- .../get/responses/CodedefaultResponse.java | 15 +++------ .../client/paths/pet/Post.java | 5 ++- .../client/paths/pet/Put.java | 5 ++- .../client/paths/pet/post/Responses.java | 3 +- .../pet/post/responses/Code405Response.java | 3 +- .../client/paths/pet/put/Responses.java | 3 +- .../pet/put/responses/Code400Response.java | 3 +- .../pet/put/responses/Code404Response.java | 3 +- .../pet/put/responses/Code405Response.java | 3 +- .../client/paths/petfindbystatus/Get.java | 5 ++- .../paths/petfindbystatus/get/Responses.java | 3 +- .../get/responses/Code400Response.java | 3 +- .../client/paths/petfindbytags/Get.java | 5 ++- .../paths/petfindbytags/get/Responses.java | 3 +- .../get/responses/Code400Response.java | 3 +- .../client/paths/petpetid/Delete.java | 5 ++- .../client/paths/petpetid/Get.java | 5 ++- .../client/paths/petpetid/Post.java | 5 ++- .../paths/petpetid/delete/Responses.java | 3 +- .../delete/responses/Code400Response.java | 3 +- .../client/paths/petpetid/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 11 ++----- .../get/responses/Code400Response.java | 3 +- .../get/responses/Code404Response.java | 3 +- .../client/paths/petpetid/post/Responses.java | 3 +- .../post/responses/Code405Response.java | 3 +- .../paths/petpetiduploadimage/Post.java | 5 ++- .../petpetiduploadimage/post/Responses.java | 3 +- .../client/paths/solidus/Get.java | 5 ++- .../client/paths/solidus/get/Responses.java | 3 +- .../client/paths/storeinventory/Get.java | 5 ++- .../paths/storeinventory/get/Responses.java | 3 +- .../client/paths/storeorder/Post.java | 5 ++- .../paths/storeorder/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 11 ++----- .../post/responses/Code400Response.java | 3 +- .../paths/storeorderorderid/Delete.java | 5 ++- .../client/paths/storeorderorderid/Get.java | 5 ++- .../storeorderorderid/delete/Responses.java | 3 +- .../delete/responses/Code400Response.java | 3 +- .../delete/responses/Code404Response.java | 3 +- .../storeorderorderid/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 11 ++----- .../get/responses/Code400Response.java | 3 +- .../get/responses/Code404Response.java | 3 +- .../client/paths/user/Post.java | 5 ++- .../client/paths/user/post/Responses.java | 3 +- .../post/responses/CodedefaultResponse.java | 3 +- .../paths/usercreatewitharray/Post.java | 5 ++- .../usercreatewitharray/post/Responses.java | 3 +- .../post/responses/CodedefaultResponse.java | 3 +- .../client/paths/usercreatewithlist/Post.java | 5 ++- .../usercreatewithlist/post/Responses.java | 3 +- .../post/responses/CodedefaultResponse.java | 3 +- .../client/paths/userlogin/Get.java | 5 ++- .../client/paths/userlogin/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 11 ++----- .../get/responses/Code400Response.java | 3 +- .../code200response/headers/XRateLimit.java | 1 - .../client/paths/userlogout/Get.java | 5 ++- .../paths/userlogout/get/Responses.java | 3 +- .../client/paths/userusername/Delete.java | 5 ++- .../client/paths/userusername/Get.java | 5 ++- .../client/paths/userusername/Put.java | 5 ++- .../paths/userusername/delete/Responses.java | 3 +- .../delete/responses/Code404Response.java | 3 +- .../paths/userusername/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 11 ++----- .../get/responses/Code400Response.java | 3 +- .../get/responses/Code404Response.java | 3 +- .../paths/userusername/put/Responses.java | 3 +- .../put/responses/Code400Response.java | 3 +- .../put/responses/Code404Response.java | 3 +- .../client/response/ResponseDeserializer.java | 23 ++++++++----- .../response/ResponsesDeserializer.java | 3 +- .../parameter/CookieSerializerTest.java | 3 +- .../parameter/HeadersSerializerTest.java | 3 +- .../client/parameter/PathSerializerTest.java | 3 +- .../client/parameter/QuerySerializerTest.java | 3 +- .../response/ResponseDeserializerTest.java | 20 +++++------ .../generators/JavaClientGenerator.java | 1 - .../components/responses/Response.hbs | 33 +++++++++++-------- .../exceptions/OpenapiDocumentException.hbs | 8 ----- .../parameter/ContentParameter.hbs | 3 +- .../parameter/CookieSerializer.hbs | 3 +- .../parameter/HeadersSerializer.hbs | 3 +- .../java/packagename/parameter/Parameter.hbs | 3 +- .../packagename/parameter/PathSerializer.hbs | 3 +- .../packagename/parameter/QuerySerializer.hbs | 3 +- .../packagename/paths/path/verb/Operation.hbs | 5 ++- .../packagename/paths/path/verb/Responses.hbs | 3 +- .../path/verb/_OperationDocCodeSample.hbs | 3 +- .../response/ResponseDeserializer.hbs | 23 ++++++++----- .../response/ResponsesDeserializer.hbs | 3 +- .../parameter/CookieSerializerTest.hbs | 3 +- .../parameter/HeadersSerializerTest.hbs | 3 +- .../parameter/PathSerializerTest.hbs | 3 +- .../parameter/QuerySerializerTest.hbs | 3 +- .../response/ResponseDeserializerTest.hbs | 20 +++++------ 313 files changed, 554 insertions(+), 1104 deletions(-) delete mode 100644 src/main/resources/java/src/main/java/packagename/exceptions/OpenapiDocumentException.hbs diff --git a/samples/client/petstore/java/.openapi-generator/FILES b/samples/client/petstore/java/.openapi-generator/FILES index 66dbdce1926..347f366fc35 100644 --- a/samples/client/petstore/java/.openapi-generator/FILES +++ b/samples/client/petstore/java/.openapi-generator/FILES @@ -898,7 +898,6 @@ src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidTypeException.java src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java -src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java src/main/java/org/openapijsonschematools/client/exceptions/UnsetPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/ValidationException.java src/main/java/org/openapijsonschematools/client/header/ContentHeader.java diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 48e35d83c4b..a72da50a8f8 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -82,7 +81,7 @@ var request = new PatchRequestBuilder() try { Responses.EndpointResponse response = apiClient.patch(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index 1a692e8b2c0..01232545217 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -82,7 +81,7 @@ var request = new DeleteRequestBuilder() try { Responses.EndpointResponse response = apiClient.delete(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index 78879e29bc2..2cc504350ac 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -82,7 +81,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index 47c33fdbfac..72532675f24 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -82,7 +81,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index 3849509d5fc..164c58d4be4 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -39,7 +39,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -114,7 +113,7 @@ var request = new DeleteRequestBuilder() try { Responses.EndpointResponse response = apiClient.delete(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index ca189571bd8..04e6515a258 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -70,7 +69,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index e4189ee5dc1..c975e27f35c 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -82,7 +81,7 @@ var request = new PatchRequestBuilder() try { Responses.EndpointResponse response = apiClient.patch(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index e1131eaf8eb..d2bb06972f2 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -79,7 +78,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index c3b13732366..10df23b5477 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index 835111bec16..9cfb815230c 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -84,7 +83,7 @@ var request = new PutRequestBuilder() try { Responses.EndpointResponse response = apiClient.put(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index 9ee13fb7964..eb8b6171799 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -37,7 +37,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -112,7 +111,7 @@ var request = new PutRequestBuilder() try { Responses.EndpointResponse response = apiClient.put(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index f1753c26996..b707d73467f 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -85,7 +84,7 @@ var request = new PutRequestBuilder() try { Responses.EndpointResponse response = apiClient.put(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index e3c3d308f10..5d4e49c5137 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -37,7 +37,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -93,7 +92,7 @@ var request = new PatchRequestBuilder() try { Responses.EndpointResponse response = apiClient.patch(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index 072760d23d9..58c964c77b3 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -81,7 +80,7 @@ var request = new DeleteRequestBuilder() try { Responses.EndpointResponse response = apiClient.delete(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index 038f9a3f740..e42593b80b7 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -30,7 +30,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -66,7 +65,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index d4b430cd5e2..e9feef5c115 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -82,7 +81,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 06211e68c0a..20f9d35e90b 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -69,7 +68,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index 559485d3078..d01afeb15d7 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index 76d83e6a6c8..b624f98a247 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PatchRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.patch(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index 3e79edd8cae..493985aa66e 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 824d6466370..4e0a00f6ae0 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index 1cd01fc9787..fdcc9635be2 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -30,7 +30,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -66,7 +65,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index 1a1f9e63f8c..51d052d9a18 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -82,7 +81,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index 56639b176c3..edccccde894 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -31,7 +31,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -67,7 +66,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index 13ea3d435be..00b04a041ce 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -37,7 +37,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -93,7 +92,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index 7ba4dafaf9b..2e5c5c2a6cd 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index 54f194ed11e..8dd57a8d0a3 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -37,7 +37,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -90,7 +89,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index 36238230be9..7fea499684d 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -79,7 +78,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index f106c88fef8..f8546f29e06 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -30,7 +30,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -66,7 +65,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index 6c8ead4e417..371c9e2d29d 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -31,7 +31,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -67,7 +66,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index 30cc642c90e..497b1f05730 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index 66115d73053..d5e2b6f6328 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index 2896b2a1e6f..083fc031eca 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index f07a1af86b7..fec0cfa9656 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index 4d25c2b9311..4bba4cc41d0 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index 16e8b8caad8..3cce194c142 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -73,7 +72,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index 5c2c4db37e8..e7af26a04ee 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 0fdfd815a20..17f5b7ed59a 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 90e1c449bc6..3ce9f64d99e 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index 6d9482fd413..7da88623e15 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -30,7 +30,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -66,7 +65,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index ea8aa64a558..7849fc9414e 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -106,7 +105,7 @@ var request = new PutRequestBuilder() try { Responses.EndpointResponse response = apiClient.put(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index 5d03a4e2437..7afab535737 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -78,7 +77,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index 8dae444fa5c..7e2d58ff495 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index ef741272f51..b698c2bd53d 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -68,7 +67,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index 6b740e78934..592eb183fce 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -30,7 +30,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -66,7 +65,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index 2481fa62193..5057a4e6e04 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -29,7 +29,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -64,7 +63,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index 3c1fdfc8e8f..67e5b82a477 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -39,7 +39,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -126,7 +125,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index ad51dad45a5..b784c839d7b 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -38,7 +38,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -122,7 +121,7 @@ var request = new PutRequestBuilder() try { Void response = apiClient.put(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 82e707e9751..4457c7d8dd9 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -37,7 +37,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -95,7 +94,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index 93a063f9f64..34bfe46f04d 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -37,7 +37,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -93,7 +92,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index eb9c36f7696..064ad811024 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -38,7 +38,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -94,7 +93,7 @@ var request = new DeleteRequestBuilder() try { Void response = apiClient.delete(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index 65eeeb92c0e..1f64cb42208 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -36,7 +36,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -92,7 +91,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index 523417e2062..d34f5d01e6c 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -38,7 +38,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -94,7 +93,7 @@ var request = new PostRequestBuilder() try { Void response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index 9c0c76b2499..72ee8df3ebd 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -37,7 +37,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -90,7 +89,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index a5df7f362a7..aea8f3e8823 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -30,7 +30,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -66,7 +65,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index ee57e0f9110..0c43b54a041 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -77,7 +76,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index b7ed44d4002..4b4d3bebd11 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -92,7 +91,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index fc3d22a2f48..048b668d64f 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -81,7 +80,7 @@ var request = new DeleteRequestBuilder() try { Void response = apiClient.delete(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index b33b42e7118..62b977eb4b0 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -81,7 +80,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index 1283287e038..87a684c148e 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -98,7 +97,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index a48a262bd63..73b0e5a0ab0 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -120,7 +119,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index c96dac5029c..bbe37daa960 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -120,7 +119,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index 4e3feb61f42..c305bc105fc 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -83,7 +82,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index 6c2e3ea1f39..e7df4b8af98 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -30,7 +30,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -66,7 +65,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index d671c8693de..5708c91be7e 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -81,7 +80,7 @@ var request = new DeleteRequestBuilder() try { Responses.EndpointResponse response = apiClient.delete(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index f9879baa415..4d2ad7388b2 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -81,7 +80,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index c204ee3a717..6ede69774f6 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -37,7 +37,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -112,7 +111,7 @@ var request = new PutRequestBuilder() try { Void response = apiClient.put(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java index ad152c11f72..2a240c51127 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.components.headers.int32jsoncontenttypeheader.content.applicationjson.Int32JsonContentTypeHeaderSchema; import java.util.AbstractMap; -import java.util.Map; public class Int32JsonContentTypeHeader { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java index d0f3cb63637..7f46cc4b68c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.components.headers.refcontentschemaheader.content.applicationjson.RefContentSchemaHeaderSchema; import java.util.AbstractMap; -import java.util.Map; public class RefContentSchemaHeader { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java index 62c84a70fa1..f26059d9b43 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java @@ -6,7 +6,6 @@ import org.openapijsonschematools.client.components.parameters.componentrefschemastringwithvalidation.content.applicationjson.ApplicationjsonSchema; import java.util.AbstractMap; -import java.util.Map; public class ComponentRefSchemaStringWithValidation { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java index 627877c03a1..4de459ce112 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.components.responses.headerswithnobody.HeadersWithNoBodyHeadersSchema; import org.openapijsonschematools.client.components.responses.headerswithnobody.Headers; @@ -27,7 +26,7 @@ public HeadersWithNoBody1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java index 10ef764abd8..126ad114344 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public SuccessDescriptionOnly1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java index 243f228c124..db98ac394c4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; @@ -43,16 +42,10 @@ public SuccessInlineContentAndHeader1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java index 74a9998500a..90ff7c9ddb4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; @@ -43,16 +42,10 @@ public SuccessWithJsonApiResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java index 6e0731f41da..8a6bec98564 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationjson.ApplicationjsonSchema; @@ -54,19 +53,15 @@ public SuccessfulXmlAndJsonArrayOfPet1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java index 11b75bd399c..d5e00cc2fa9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import java.util.Map; @@ -19,7 +18,7 @@ public ContentParameter(String name, ParameterInType inType, boolean required, @ } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { String contentType = content.getKey(); if (ContentTypeDetector.contentTypeIsJson(contentType)) { var value = ContentTypeSerializer.toJson(inData); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java index 4b8ff010aed..dcd3b6faf6b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java @@ -2,7 +2,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -15,7 +14,7 @@ protected CookieSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { + public String serialize(Map inData) throws NotImplementedException { String result = ""; Map sortedData = new TreeMap<>(inData); for (Map.Entry entry: sortedData.entrySet()) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java index b9d6fb008bb..1969f2c0b21 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java @@ -2,7 +2,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.LinkedHashMap; @@ -16,7 +15,7 @@ protected HeadersSerializer(Map parameters) { this.parameters = parameters; } - public Map> serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { + public Map> serialize(Map inData) throws NotImplementedException { Map> results = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java index 2d9c85b603d..adf3896d557 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java @@ -2,10 +2,9 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException; + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java index 4e1858f88f8..78015037211 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java @@ -2,7 +2,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -14,7 +13,7 @@ protected PathSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException, OpenapiDocumentException { + public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException { String result = pathWithPlaceholders; for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java index c5f39d81aff..880151ed144 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java @@ -2,7 +2,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.HashMap; @@ -16,7 +15,7 @@ protected QuerySerializer(Map parameters) { this.parameters = parameters; } - public Map getQueryMap(Map inData) throws NotImplementedException, OpenapiDocumentException { + public Map getQueryMap(Map inData) throws NotImplementedException { Map results = new HashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java index fa595ce5f0c..c0ee0aa2552 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +63,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java index 11b1cd3ef4b..f3d1a4c9c88 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java index 87b69013da2..23be67ef64f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java index b04b10cab42..d399d737436 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -67,7 +66,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java index f3d0c2e297b..fbcec1deec8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -68,7 +67,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java index 8cb71a257b2..8597436d355 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java index bd962c80e48..86eecd81c6f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java index 309976d0f1a..41528d925e3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java index 9488c04f64e..b0e5e86f225 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java index a0c7d279720..960b1659b6b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -36,7 +35,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -79,7 +78,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java index 88eb21c43ee..10569298a1d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -36,7 +35,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -84,7 +83,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java index 1ee826cef96..60f5f954579 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +63,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java index ca74851bc52..4da2bae68c0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -36,7 +35,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -81,7 +80,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java index 161f8f97b0c..c67d698847f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fake.delete.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java index c3c8d1c2911..cf26ab00125 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.fake.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -42,7 +41,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java index cf1c4c0a8ad..ead22eaf4b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fake.get.responses.code404response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code404Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java index 7d9e028de8e..d6ad76d4229 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fake.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java index fba72bfa412..a5dc33043b3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fake.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java index 93082530aeb..713a77d0b6d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.fake.post.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -42,7 +41,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java index 1704da10f83..bf6bdfef7bc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java index 958f0d225a0..29428395e7a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java index 94ce1d4e48c..a1a6558ff46 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java index 27ffd230815..63aa0097bea 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java index 3397d455538..087bca2e097 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +63,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java index 8585100f835..facc5c9d5cd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java index 26e67157ca5..ae426076e95 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -35,7 +34,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -70,7 +69,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java index acebb6831c8..47cb64a34d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java index 350f248f67e..5834c52bde6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -61,7 +60,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java index 3fa734ac3af..1f55adc41c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java index eca529b843e..27e33d07e95 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -36,7 +35,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -77,7 +76,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java index 5a774e0ae86..1550b533cf8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java index 046f8316375..20ec0e0f539 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java index 49df8ea08a6..8351af2e5bc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -60,7 +59,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java index 6df2c1517f0..a3d4538aacc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -48,7 +47,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java index c6d646b785b..3baf5feab2a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java index f70415e9a57..9be4c625bed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -30,7 +29,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -55,7 +54,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java index 13910952871..07e95d11d13 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakehealth.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java index 0cb22d4aebe..c0b16aeb80b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakehealth.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java index 33049224e3a..dbfd04a0a0f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java index ceac702edf7..4479a0fc1d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java index 1585a0bca86..c5408571af2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -35,7 +34,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -77,7 +76,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java index ccfeec4aa9f..28c02844de2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java index 655c528658e..f581d9c5a25 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.multipartformdata.MultipartformdataSchema; @@ -54,19 +53,15 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); - } else if (mediaType instanceof MultipartformdataMediaType thisMediaType) { + } else { + MultipartformdataMediaType thisMediaType = (MultipartformdataMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new MultipartformdataResponseBody(deserializedBody); } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java index b912128ecc4..1e94f899e16 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java index ed2d2b2799f..62abcd15f19 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java index 5216b18abc9..af3c446126b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java index 50083b56307..ee2ece51011 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java index 138c018480d..06cbd2da4b7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java index dabd059a41e..8ae07ef27c3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java index c59e409cd48..9b7afb9998d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.code200response.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof Applicationjsoncharsetutf8MediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new Applicationjsoncharsetutf8ResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + Applicationjsoncharsetutf8MediaType thisMediaType = (Applicationjsoncharsetutf8MediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new Applicationjsoncharsetutf8ResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java index 14bab549e5c..a4d6e976d8f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java index db0083a37eb..db0147ab306 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java index aa08f387330..cbb82ae131a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java index 83dc48706f6..8c64746e29d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -30,7 +29,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -55,7 +54,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java index 96b3fd0521b..373ccad7971 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.Code202Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -49,7 +48,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java index b94bf11bf4b..6043aa1edeb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java index f027383e13d..fcce76ef9cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code202response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code202Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java index 2024bfa4761..3c8238bde96 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -68,7 +67,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java index 2babf85d987..796036a87ae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java index 75fd6e4cfce..faeb00a825a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java index f4adefc073a..8117d757cff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -64,7 +63,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java index 1c2e2b77971..41b43464d15 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java index fa872dffd7f..7f154f0901e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -38,7 +37,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -96,7 +95,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java index 8abb1aec4f2..9f06472df14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java index 4554077d2d7..4e0667e9eb9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java index d45cf3996e5..e8f428c1e2e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java index 1f59baa33e7..c546986c419 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java index b6132066731..9ea03b2b36a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.code200response.content.applicationxpemfile.ApplicationxpemfileSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationxpemfileMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationxpemfileResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationxpemfileMediaType thisMediaType = (ApplicationxpemfileMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationxpemfileResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java index 6b7e2f16837..ed37398b126 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -38,7 +37,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -86,7 +85,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java index c468353ae78..9eddc5a2d15 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java index cd637f27504..0f6bf6c64d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java index 56de93ce963..3890a98c04b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -61,7 +60,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java index 5e4e840eafd..3fa5ce2e6a4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java index bb130bbd611..ac6cbea3c13 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java @@ -6,7 +6,6 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson.Schema0; import java.util.AbstractMap; -import java.util.Map; public class Parameter0 { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java index 437d457c9fb..04bfc3d9134 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java index 8b92c70f23e..dfb5d3fdddd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -30,7 +29,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -55,7 +54,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java index 7c9e7ed78ce..da82930d54d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.fakeredirection.get.responses.Code3XXResponse; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -54,7 +53,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java index aab99099649..5e200656719 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code303Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java index 24bfa9b52e0..454b6e7947c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code3XXResponse1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java index cf165202d3d..f9dbc60a250 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -64,7 +63,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java index 1019f08f017..3e8158b527e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java index 8a6de0be95a..93a7b5975ff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java index 659650a21cf..7b8ea36efd5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java index 6f5a77c39f9..63eb944c1cb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java index c2fde1446c0..89242e2d4c0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java index b6d3bfa2680..32d76ef966e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java index 9005bb2ff7d..15be766f42d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java index b42758aaabc..ada45acb5ce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java index fc4fe65bc8a..74ce65b7258 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java index 465c04ce56b..13f2508c3de 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java index 5eda1bae7e5..ce59f14897c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java index 0cc76733324..59f328b3436 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java index b240fa7b152..ffde6c64e13 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java index 31982e5c338..30bd665a405 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java index a1c29d1d38c..04737b6a945 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java index 4c5a01f045d..43657448da3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java index 4f00c55e695..71576e55171 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java index 23048783a6a..a62bef5028e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java index 2198324418d..758993678dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java index cf1b8564b3d..c42b1daa0a0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java index 03d11419797..5c619f2615f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java index b97e97c057e..b20ec46379e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java index 1901daedca9..371e89bd77e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java index 368baedff08..805be560b86 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java index da2929fe0aa..a68e6a31fb7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java index 66eb0110fa2..3798f955bf6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java index f5a4b5e50a5..796169823ad 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java index 60b10445f57..63ac9182ca2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java index 370e6f83a23..2df81dfbde5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -30,7 +29,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -55,7 +54,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java index cfb98029a5d..a435d216366 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java index 639e613c2e9..797bc568bdb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.AbstractMap; @@ -28,7 +27,7 @@ public Code200Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java index 67c8ac34840..9e5b9b621a5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -61,7 +60,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java index 1a34e2be8c8..fbea3022d59 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java index c75a2256ce4..034b36f6c09 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java index 9cbc8eab195..1fb9ed96fe3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java index d728392ae0b..bc70432957e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.code200response.content.applicationoctetstream.ApplicationoctetstreamSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationoctetstreamMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationoctetstreamResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationoctetstreamMediaType thisMediaType = (ApplicationoctetstreamMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationoctetstreamResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java index a6443ffbf7a..10ff3668b11 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java index b88f2d0ce02..9af74e296f1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java index 609c7e34de3..fda56d8d98b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java index 7061d029997..039190ef90c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -68,7 +67,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java index 331cc4d351b..8c20a8f2354 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java index 47da82b38a7..63eb6225408 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java index 6153b15d0a3..f6153f8bd79 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -30,7 +29,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -55,7 +54,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java index 02fc753b272..b11902474b6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code5XXResponse; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -84,7 +83,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java index ef26145bfc0..e6ffd9a14e2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code1xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code1XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java index 7e764120108..45f6f05a1bf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java index 6286b242a77..ada58f1ca6f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code2xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code2XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java index 45f9a55d442..fbde66ac240 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code3xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code3XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java index 639aa5d76dd..6282c0777bb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code4xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code4XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java index 6a39809e89e..86807d6916f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code5xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public Code5XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java index d49f9a8f558..a40b0912b2c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -30,7 +29,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -55,7 +54,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java index b18746e1213..1bad88482dc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.foo.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -31,7 +30,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java index d8b09eea4f6..fc0399186e9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.foo.get.responses.codedefaultresponse.content.applicationjson.ApplicationjsonSchema; @@ -41,16 +40,10 @@ public CodedefaultResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java index e459c0f28be..38644fb2297 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -36,7 +35,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -77,7 +76,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java index 6c3a11a8f23..72777735bd7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -36,7 +35,7 @@ public static Void put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -77,7 +76,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java index 1a088bc9cec..f489228252d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.pet.post.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -42,7 +41,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java index 76d076c684c..fa949dd06c9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code405Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java index f207b7e4f76..6b6d8741ac7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.paths.pet.put.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; @@ -37,7 +36,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java index a209dd91ef0..895a0c711c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java index c57bce97020..783c844b050 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java index 99e0f2ccaf2..0764ab97ba6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code405Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java index 01b6ea926f4..35c64dd335e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -35,7 +34,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -74,7 +73,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java index 6f130a2316d..39f93fe6169 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -42,7 +41,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java index aa652f743aa..a2fa568b81b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java index 935fa5b01dc..cac84c76738 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -35,7 +34,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -74,7 +73,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java index a44c8e36c8b..55e1353d90b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.petfindbytags.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -42,7 +41,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java index bfbb2cec968..ecf1d521147 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java index 2c4371e278e..2af7e68d326 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -36,7 +35,7 @@ public static Void delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -80,7 +79,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java index 67ba39f8633..f54abe64bc6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -35,7 +34,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -73,7 +72,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java index fe9309edebd..b03b8858661 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -38,7 +37,7 @@ public static Void post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -86,7 +85,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Void post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java index 226b54a700e..33379e74309 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.petpetid.delete.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; @@ -29,7 +28,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java index 07abfcf7327..228a15165e7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java index c4b4695f3f7..dc6d70600c1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.paths.petpetid.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -46,7 +45,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java index 6291c822bd8..6d7f5caeb25 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -54,19 +53,15 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java index e86d9681af5..3c6472aa971 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java index a7f1f99fa40..f1e9aac2176 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java index dd24a00cdcf..329a163abd6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.petpetid.post.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; @@ -29,7 +28,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java index 69c58e5c20f..16810be9dd9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code405Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java index 0a2d4e20eed..ad98ca897bf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -38,7 +37,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -86,7 +85,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java index 66437d62436..a6a929bb919 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -39,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java index e05d3d1eeb7..89b72d247eb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -30,7 +29,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -55,7 +54,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java index 20265bce469..284af850fac 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.solidus.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java index 276946aed60..7bd2f7b8194 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -68,7 +67,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java index 69da9e199ce..70f0fe2d50c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -39,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java index 549869042f5..5a0c05d3300 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java index a1d5acc6e3c..ea3370b1621 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.storeorder.post.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -42,7 +41,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java index 77c4d74c6c6..cf6301f20cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -54,19 +53,15 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java index b552d927076..74c9668aa25 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java index a2e71466728..aa5ebac564b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -32,7 +31,7 @@ public static Void delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -60,7 +59,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java index 9b3ab245e88..8cea573fe40 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -60,7 +59,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java index 8da935c8aa0..29a3e1766f4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; @@ -33,7 +32,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java index cff0f34e78e..5407a07ffe8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java index 536bc0eea73..24985b372b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java index 154fd8f52fa..418c6fb4b88 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -46,7 +45,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java index 9ad13287f16..d356148fabd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -54,19 +53,15 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java index 15c5366170d..72846a731c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java index 5670fc3eea5..a50cc84f941 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java index 8d38fe6b95f..5da53d22478 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java index 66d84ae53de..4abec218764 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.user.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -31,7 +30,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java index 14c5ef9c248..b580db6b5e1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java index c5682a94fd1..3c7bfbe2c01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java index 11a54b0d107..397d3835a1a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -31,7 +30,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java index ab94c4b0dd3..4ce485764ed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java index 04d12cb2cb7..1f20af95fa2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -33,7 +32,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java index 545775f23de..8a532eb3e89 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -31,7 +30,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java index 03540f9a4fb..ae83348ddcb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java index 5645f9d9bf6..7426dc6d2ef 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -61,7 +60,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java index 2cf0634d92f..6b4e717f4a0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.paths.userlogin.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -43,7 +42,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java index 6c1e7c38b27..9eef5825f29 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -56,19 +55,15 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java index bcd151def0e..6c6a6c19d9f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java index 4ab8688571a..f7e9a714406 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xratelimit.content.applicationjson.XRateLimitSchema; import java.util.AbstractMap; -import java.util.Map; public class XRateLimit { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java index 6485a3f0dad..801cac1ac3f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -30,7 +29,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -55,7 +54,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java index 05f8f6d1898..761922e6336 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.userlogout.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -31,7 +30,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java index 2343e93a002..6494d9f4258 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -60,7 +59,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java index 8037416e271..a9238ea9579 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -60,7 +59,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java index 73715adbc04..4cf81f66373 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -35,7 +34,7 @@ public static Void put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -69,7 +68,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java index d6740bbea1e..fc6ff86235a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.userusername.delete.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -42,7 +41,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java index e7e3f346f1b..5b4efd75bd6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java index 79876c30d6c..5898e98526e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.paths.userusername.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -46,7 +45,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java index cbb3458c896..4f666f798b0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -54,19 +53,15 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java index ab72dcaf396..cd1e5881c77 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java index e0ff71588ba..bb3e8a1c549 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java index f730c6bf297..10141999654 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.userusername.put.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; @@ -33,7 +32,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java index ecc049b512f..e5c690d292d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java index 1c89fe1f4e5..d5619116676 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -25,7 +24,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java index 17b0895e57c..1d8be2229d0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java @@ -13,9 +13,9 @@ import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.header.Header; public abstract class ResponseDeserializer { @@ -27,7 +27,7 @@ public ResponseDeserializer(Map content) { this.headers = null; } - protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException; + protected abstract SealedBodyClass getBody(String contentType, SealedMediaTypeClass mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException; protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException; protected @Nullable Object deserializeJson(byte[] body) { @@ -50,20 +50,25 @@ protected T deserializeBody(String contentType, byte[] body, JsonSchema s throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); } - public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { - throw new OpenapiDocumentException("Invalid response returned, Content-Type header is missing and it must be included"); + throw new ApiException( + "Invalid response returned, Content-Type header is missing and it must be included", + response + ); } String contentType = contentTypeInfo.get(); - if (content != null && !content.containsKey(contentType)) { - throw new OpenapiDocumentException( - "Invalid contentType returned. contentType="+contentType+" was returned "+ - "when only "+content.keySet()+" are defined for statusCode="+response.statusCode() + @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, bodyBytes, configuration); + SealedBodyClass body = getBody(contentType, mediaType, bodyBytes, configuration); HeaderClass headers = getHeaders(response.headers(), configuration); return new DeserializedHttpResponse<>(body, headers); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java index 26204003e31..58e1bc55d70 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java @@ -3,11 +3,10 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import java.net.http.HttpResponse; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException; + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java index a81758ecc82..a46f7fbb5f7 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java @@ -2,7 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -34,7 +33,7 @@ protected CookieParametersSerializer() { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java index 164fbd74f9e..2a9acf14219 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java @@ -2,7 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -35,7 +34,7 @@ protected HeaderParametersSerializer() { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java index aca8385652d..3ff2ac5ed88 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java @@ -2,7 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -34,7 +33,7 @@ protected PathParametersSerializer() { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java index fe1f132e766..7cb559fef3c 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java @@ -2,7 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -34,7 +33,7 @@ protected QueryParametersSerializer() { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java index d4ba032bc5f..16ee04ec220 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java @@ -10,7 +10,7 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -68,11 +68,7 @@ public MyResponseDeserializer() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, InvalidTypeException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, InvalidTypeException { if (mediaType instanceof ApplicationjsonMediatype thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonBody(deserializedBody); @@ -156,7 +152,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserializeApplicationJsonNull() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonNull() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(null).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -172,7 +168,7 @@ public void testDeserializeApplicationJsonNull() throws ValidationException, Ope } @Test - public void testDeserializeApplicationJsonTrue() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonTrue() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(true).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -188,7 +184,7 @@ public void testDeserializeApplicationJsonTrue() throws ValidationException, Ope } @Test - public void testDeserializeApplicationJsonFalse() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonFalse() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(false).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -204,7 +200,7 @@ public void testDeserializeApplicationJsonFalse() throws ValidationException, Op } @Test - public void testDeserializeApplicationJsonInt() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonInt() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(1).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -220,7 +216,7 @@ public void testDeserializeApplicationJsonInt() throws ValidationException, Open } @Test - public void testDeserializeApplicationJsonFloat() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonFloat() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(3.14).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -236,7 +232,7 @@ public void testDeserializeApplicationJsonFloat() throws ValidationException, Op } @Test - public void testDeserializeApplicationJsonString() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonString() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson("a").getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java index d79170e0661..c1ea881c0de 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java @@ -731,7 +731,6 @@ public void processOpts() { exceptionClasses.add("InvalidAdditionalPropertyException"); exceptionClasses.add("InvalidTypeException"); exceptionClasses.add("NotImplementedException"); - exceptionClasses.add("OpenapiDocumentException"); exceptionClasses.add("UnsetPropertyException"); exceptionClasses.add("ValidationException"); for (String exceptionClass: exceptionClasses) { diff --git a/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs b/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs index e77fd8f4551..7823b594fc3 100644 --- a/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs @@ -17,7 +17,6 @@ import {{packageName}}.exceptions.ApiException; import {{packageName}}.exceptions.InvalidTypeException; import {{packageName}}.exceptions.ValidationException; import {{packageName}}.exceptions.NotImplementedException; -import {{packageName}}.exceptions.OpenapiDocumentException; {{#if hasContentSchema}} import {{packageName}}.mediatype.MediaType; {{else}} @@ -84,26 +83,34 @@ public class {{jsonPathPiece.pascalCase}} { {{#if hasContentSchema}} @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new OpenapiDocumentException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - {{#each content}} - {{#if @first}} + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, 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}} + {{else}} + {{#if @last}} + } else { + {{@key.pascalCase}}MediaType thisMediaType = ({{@key.pascalCase}}MediaType) mediaType; + {{else}} } else if (mediaType instanceof {{@key.pascalCase}}MediaType thisMediaType) { - {{/if}} + {{/if}} + {{/if}} var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new {{@key.pascalCase}}ResponseBody(deserializedBody); - {{/each}} + {{/each}} } - throw new OpenapiDocumentException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + {{/eq}} } {{else}} @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } {{/if}} diff --git a/src/main/resources/java/src/main/java/packagename/exceptions/OpenapiDocumentException.hbs b/src/main/resources/java/src/main/java/packagename/exceptions/OpenapiDocumentException.hbs deleted file mode 100644 index 6514551b1f5..00000000000 --- a/src/main/resources/java/src/main/java/packagename/exceptions/OpenapiDocumentException.hbs +++ /dev/null @@ -1,8 +0,0 @@ -package {{{packageName}}}.exceptions; - -@SuppressWarnings("serial") -public class OpenapiDocumentException extends BaseException { - public OpenapiDocumentException(String s) { - super(s); - } -} \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs b/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs index 0edc01f1a97..ba1ab60208d 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/ContentParameter.hbs @@ -4,7 +4,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.contenttype.ContentTypeDetector; import {{{packageName}}}.contenttype.ContentTypeSerializer; import {{{packageName}}}.exceptions.NotImplementedException; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import {{{packageName}}}.mediatype.MediaType; import java.util.Map; @@ -19,7 +18,7 @@ public class ContentParameter extends ParameterBase implements Parameter { } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { String contentType = content.getKey(); if (ContentTypeDetector.contentTypeIsJson(contentType)) { var value = ContentTypeSerializer.toJson(inData); diff --git a/src/main/resources/java/src/main/java/packagename/parameter/CookieSerializer.hbs b/src/main/resources/java/src/main/java/packagename/parameter/CookieSerializer.hbs index 5a56dc471f5..5c52373a672 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/CookieSerializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/CookieSerializer.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.NotImplementedException; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -15,7 +14,7 @@ public abstract class CookieSerializer { this.parameters = parameters; } - public String serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { + public String serialize(Map inData) throws NotImplementedException { String result = ""; Map sortedData = new TreeMap<>(inData); for (Map.Entry entry: sortedData.entrySet()) { diff --git a/src/main/resources/java/src/main/java/packagename/parameter/HeadersSerializer.hbs b/src/main/resources/java/src/main/java/packagename/parameter/HeadersSerializer.hbs index 1492c5e168c..d2f10e695ef 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/HeadersSerializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/HeadersSerializer.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.NotImplementedException; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.LinkedHashMap; @@ -16,7 +15,7 @@ public abstract class HeadersSerializer { this.parameters = parameters; } - public Map> serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { + public Map> serialize(Map inData) throws NotImplementedException { Map> results = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs b/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs index ec03fa82044..3d2e8abeb95 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/Parameter.hbs @@ -2,10 +2,9 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.NotImplementedException; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException; + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/parameter/PathSerializer.hbs b/src/main/resources/java/src/main/java/packagename/parameter/PathSerializer.hbs index 11d474d71c3..82a778a630f 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/PathSerializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/PathSerializer.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.NotImplementedException; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -14,7 +13,7 @@ public abstract class PathSerializer { this.parameters = parameters; } - public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException, OpenapiDocumentException { + public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException { String result = pathWithPlaceholders; for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/src/main/resources/java/src/main/java/packagename/parameter/QuerySerializer.hbs b/src/main/resources/java/src/main/java/packagename/parameter/QuerySerializer.hbs index 3d6d65f60c0..da5fecd666f 100644 --- a/src/main/resources/java/src/main/java/packagename/parameter/QuerySerializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/parameter/QuerySerializer.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.exceptions.NotImplementedException; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.HashMap; @@ -16,7 +15,7 @@ public abstract class QuerySerializer { this.parameters = parameters; } - public Map getQueryMap(Map inData) throws NotImplementedException, OpenapiDocumentException { + public Map getQueryMap(Map inData) throws NotImplementedException { Map results = new HashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs index 7a915dfb4e0..5d1de439e1b 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs @@ -31,7 +31,6 @@ import {{packageName}}.apiclient.ApiClient; import {{packageName}}.configurations.ApiConfiguration; import {{packageName}}.configurations.SchemaConfiguration; import {{packageName}}.exceptions.ValidationException; -import {{packageName}}.exceptions.OpenapiDocumentException; import {{packageName}}.exceptions.NotImplementedException; import {{packageName}}.exceptions.InvalidTypeException; import {{packageName}}.exceptions.ApiException; @@ -72,7 +71,7 @@ public class {{jsonPathPiece.pascalCase}} { ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); {{#with requestBody}} @@ -198,7 +197,7 @@ public class {{jsonPathPiece.pascalCase}} { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Void{{/if}} {{jsonPathPiece.camelCase}}({{jsonPathPiece.pascalCase}}Request request) throws IOException, InterruptedException, ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException, ApiException { + default {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Void{{/if}} {{jsonPathPiece.camelCase}}({{jsonPathPiece.pascalCase}}Request request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { return {{jsonPathPiece.pascalCase}}Provider.{{jsonPathPiece.camelCase}}(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs index 746605c4da5..281effc2228 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs @@ -10,7 +10,6 @@ import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; {{/each}} import {{{packageName}}}.exceptions.ApiException; import {{{packageName}}}.exceptions.InvalidTypeException; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.exceptions.ValidationException; {{#if nonErrorResponses }} @@ -85,7 +84,7 @@ public class {{responses.jsonPathPiece.pascalCase}} { {{/with}} } - public {{#if nonErrorResponses }}EndpointResponse{{else}}Void{{/if}} deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public {{#if nonErrorResponses }}EndpointResponse{{else}}Void{{/if}} deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { {{#eq defaultResponse null }} String statusCode = String.valueOf(response.statusCode()); {{#and statusCodeResponses wildcardCodeResponses }} diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index c6d4918dfd2..9725a1eeb8e 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -66,7 +66,6 @@ import {{packageName}}.configurations.ApiConfiguration; import {{packageName}}.configurations.SchemaConfiguration; import {{packageName}}.configurations.JsonSchemaKeywordFlags; import {{packageName}}.exceptions.ValidationException; -import {{packageName}}.exceptions.OpenapiDocumentException; import {{packageName}}.exceptions.NotImplementedException; import {{packageName}}.exceptions.InvalidTypeException; import {{packageName}}.exceptions.ApiException; @@ -207,7 +206,7 @@ var request = new {{className.pascalCase}}() try { {{#if nonErrorResponses }}{{responses.jsonPathPiece.pascalCase}}.EndpointResponse{{else}}Void{{/if}} response = apiClient.{{jsonPathPiece.camelCase}}(request); -} catch (ApiException | OpenapiDocumentException e) { +} catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; } catch (ValidationException | InvalidTypeException e) { diff --git a/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs b/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs index 46453bf4e13..0f8c6b7bf84 100644 --- a/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs @@ -13,9 +13,9 @@ import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.contenttype.ContentTypeDetector; import {{{packageName}}}.contenttype.ContentTypeDeserializer; import {{{packageName}}}.exceptions.InvalidTypeException; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ApiException; import {{{packageName}}}.header.Header; public abstract class ResponseDeserializer { @@ -27,7 +27,7 @@ public abstract class ResponseDeserializer deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { - throw new OpenapiDocumentException("Invalid response returned, Content-Type header is missing and it must be included"); + throw new ApiException( + "Invalid response returned, Content-Type header is missing and it must be included", + response + ); } String contentType = contentTypeInfo.get(); - if (content != null && !content.containsKey(contentType)) { - throw new OpenapiDocumentException( - "Invalid contentType returned. contentType="+contentType+" was returned "+ - "when only "+content.keySet()+" are defined for statusCode="+response.statusCode() + @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, bodyBytes, configuration); + SealedBodyClass body = getBody(contentType, mediaType, bodyBytes, configuration); HeaderClass headers = getHeaders(response.headers(), configuration); return new DeserializedHttpResponse<>(body, headers); } diff --git a/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs b/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs index 57e22d4f907..8719d3e9257 100644 --- a/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs @@ -3,11 +3,10 @@ package {{{packageName}}}.response; import {{{packageName}}}.configurations.SchemaConfiguration; import java.net.http.HttpResponse; import {{{packageName}}}.exceptions.InvalidTypeException; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException; + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException; } \ No newline at end of file diff --git a/src/main/resources/java/src/test/java/packagename/parameter/CookieSerializerTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/CookieSerializerTest.hbs index 7f04ccc894d..fae1fcca373 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/CookieSerializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/CookieSerializerTest.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.parameter; import org.junit.Assert; import org.junit.Test; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; @@ -34,7 +33,7 @@ public class CookieSerializerTest { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/src/main/resources/java/src/test/java/packagename/parameter/HeadersSerializerTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/HeadersSerializerTest.hbs index 871d97b52ec..6d3f5c2594c 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/HeadersSerializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/HeadersSerializerTest.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.parameter; import org.junit.Assert; import org.junit.Test; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; @@ -35,7 +34,7 @@ public class HeadersSerializerTest { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/src/main/resources/java/src/test/java/packagename/parameter/PathSerializerTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/PathSerializerTest.hbs index b9db6f5621d..4d69c221e56 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/PathSerializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/PathSerializerTest.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.parameter; import org.junit.Assert; import org.junit.Test; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; @@ -34,7 +33,7 @@ public class PathSerializerTest { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/src/main/resources/java/src/test/java/packagename/parameter/QuerySerializerTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/QuerySerializerTest.hbs index faeb1a36c66..5b7109bd38f 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/QuerySerializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/QuerySerializerTest.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.parameter; import org.junit.Assert; import org.junit.Test; -import {{{packageName}}}.exceptions.OpenapiDocumentException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; @@ -34,7 +33,7 @@ public class QuerySerializerTest { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs b/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs index c0b8734535b..f0439e1423a 100644 --- a/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs @@ -10,7 +10,7 @@ import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.NotImplementedException; -import {{{packageName}}}.exceptions.OpenapiDocumentException; +import {{{packageName}}}.exceptions.ApiException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.mediatype.MediaType; import {{{packageName}}}.schemas.AnyTypeJsonSchema; @@ -68,11 +68,7 @@ public class ResponseDeserializerTest { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, InvalidTypeException { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, InvalidTypeException { if (mediaType instanceof ApplicationjsonMediatype thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonBody(deserializedBody); @@ -156,7 +152,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonNull() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonNull() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(null).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -172,7 +168,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonTrue() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonTrue() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(true).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -188,7 +184,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonFalse() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonFalse() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(false).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -204,7 +200,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonInt() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonInt() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(1).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -220,7 +216,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonFloat() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonFloat() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(3.14).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -236,7 +232,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonString() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonString() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson("a").getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); From ba9aaf0ecb855ebb911ee667c8a401631c46840c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 3 Apr 2024 11:27:02 -0700 Subject: [PATCH 42/53] Removes InvalidTypeException --- .../petstore/java/.openapi-generator/FILES | 1 - .../java/docs/paths/anotherfakedummy/Patch.md | 3 +- .../docs/paths/commonparamsubdir/Delete.md | 3 +- .../java/docs/paths/commonparamsubdir/Get.md | 3 +- .../java/docs/paths/commonparamsubdir/Post.md | 3 +- .../petstore/java/docs/paths/fake/Delete.md | 3 +- .../petstore/java/docs/paths/fake/Get.md | 3 +- .../petstore/java/docs/paths/fake/Patch.md | 3 +- .../petstore/java/docs/paths/fake/Post.md | 3 +- .../Get.md | 3 +- .../docs/paths/fakebodywithfileschema/Put.md | 3 +- .../docs/paths/fakebodywithqueryparams/Put.md | 3 +- .../docs/paths/fakecasesensitiveparams/Put.md | 3 +- .../docs/paths/fakeclassnametest/Patch.md | 3 +- .../docs/paths/fakedeletecoffeeid/Delete.md | 3 +- .../java/docs/paths/fakehealth/Get.md | 3 +- .../fakeinlineadditionalproperties/Post.md | 3 +- .../docs/paths/fakeinlinecomposition/Post.md | 3 +- .../java/docs/paths/fakejsonformdata/Get.md | 3 +- .../java/docs/paths/fakejsonpatch/Patch.md | 3 +- .../docs/paths/fakejsonwithcharset/Post.md | 3 +- .../Post.md | 3 +- .../paths/fakemultipleresponsebodies/Get.md | 3 +- .../docs/paths/fakemultiplesecurities/Get.md | 3 +- .../java/docs/paths/fakeobjinquery/Get.md | 3 +- .../Post.md | 3 +- .../java/docs/paths/fakepemcontenttype/Get.md | 3 +- .../Post.md | 3 +- .../fakequeryparamwithjsoncontenttype/Get.md | 3 +- .../java/docs/paths/fakeredirection/Get.md | 3 +- .../java/docs/paths/fakerefobjinquery/Get.md | 3 +- .../docs/paths/fakerefsarraymodel/Post.md | 3 +- .../docs/paths/fakerefsarrayofenums/Post.md | 3 +- .../java/docs/paths/fakerefsboolean/Post.md | 3 +- .../Post.md | 3 +- .../java/docs/paths/fakerefsenum/Post.md | 3 +- .../java/docs/paths/fakerefsmammal/Post.md | 3 +- .../java/docs/paths/fakerefsnumber/Post.md | 3 +- .../fakerefsobjectmodelwithrefprops/Post.md | 3 +- .../java/docs/paths/fakerefsstring/Post.md | 3 +- .../paths/fakeresponsewithoutschema/Get.md | 3 +- .../docs/paths/faketestqueryparamters/Put.md | 3 +- .../docs/paths/fakeuploaddownloadfile/Post.md | 3 +- .../java/docs/paths/fakeuploadfile/Post.md | 3 +- .../java/docs/paths/fakeuploadfiles/Post.md | 3 +- .../docs/paths/fakewildcardresponses/Get.md | 3 +- .../petstore/java/docs/paths/foo/Get.md | 3 +- .../petstore/java/docs/paths/pet/Post.md | 3 +- .../petstore/java/docs/paths/pet/Put.md | 3 +- .../java/docs/paths/petfindbystatus/Get.md | 3 +- .../java/docs/paths/petfindbytags/Get.md | 3 +- .../java/docs/paths/petpetid/Delete.md | 3 +- .../petstore/java/docs/paths/petpetid/Get.md | 3 +- .../petstore/java/docs/paths/petpetid/Post.md | 3 +- .../docs/paths/petpetiduploadimage/Post.md | 3 +- .../petstore/java/docs/paths/solidus/Get.md | 3 +- .../java/docs/paths/storeinventory/Get.md | 3 +- .../java/docs/paths/storeorder/Post.md | 3 +- .../docs/paths/storeorderorderid/Delete.md | 3 +- .../java/docs/paths/storeorderorderid/Get.md | 3 +- .../petstore/java/docs/paths/user/Post.md | 3 +- .../docs/paths/usercreatewitharray/Post.md | 3 +- .../docs/paths/usercreatewithlist/Post.md | 3 +- .../petstore/java/docs/paths/userlogin/Get.md | 3 +- .../java/docs/paths/userlogout/Get.md | 3 +- .../java/docs/paths/userusername/Delete.md | 3 +- .../java/docs/paths/userusername/Get.md | 3 +- .../java/docs/paths/userusername/Put.md | 3 +- .../ApplicationjsonSchema.java | 15 +- .../responses/HeadersWithNoBody.java | 3 +- .../responses/SuccessDescriptionOnly.java | 1 - .../SuccessInlineContentAndHeader.java | 5 +- .../responses/SuccessWithJsonApiResponse.java | 5 +- .../SuccessfulXmlAndJsonArrayOfPet.java | 3 +- .../HeadersWithNoBodyHeadersSchema.java | 15 +- .../ApplicationjsonSchema.java | 15 +- .../applicationxml/ApplicationxmlSchema.java | 15 +- ...ssInlineContentAndHeaderHeadersSchema.java | 15 +- .../ApplicationjsonSchema.java | 15 +- ...ccessWithJsonApiResponseHeadersSchema.java | 15 +- .../schemas/AbstractStepMessage.java | 15 +- .../schemas/AdditionalPropertiesClass.java | 99 ++-- .../schemas/AdditionalPropertiesSchema.java | 147 +++--- .../AdditionalPropertiesWithArrayOfEnums.java | 29 +- .../client/components/schemas/Address.java | 15 +- .../client/components/schemas/Animal.java | 31 +- .../client/components/schemas/AnimalFarm.java | 15 +- .../components/schemas/AnyTypeAndFormat.java | 429 +++++++++--------- .../components/schemas/AnyTypeNotString.java | 47 +- .../components/schemas/ApiResponseSchema.java | 15 +- .../client/components/schemas/Apple.java | 43 +- .../client/components/schemas/AppleReq.java | 15 +- .../schemas/ArrayHoldingAnyType.java | 15 +- .../schemas/ArrayOfArrayOfNumberOnly.java | 43 +- .../components/schemas/ArrayOfEnums.java | 15 +- .../components/schemas/ArrayOfNumberOnly.java | 29 +- .../client/components/schemas/ArrayTest.java | 85 ++-- .../schemas/ArrayWithValidationsInItems.java | 35 +- .../client/components/schemas/Banana.java | 15 +- .../client/components/schemas/BananaReq.java | 15 +- .../client/components/schemas/Bar.java | 17 +- .../client/components/schemas/BasquePig.java | 29 +- .../components/schemas/BooleanEnum.java | 15 +- .../components/schemas/Capitalization.java | 15 +- .../client/components/schemas/Cat.java | 61 ++- .../client/components/schemas/Category.java | 31 +- .../client/components/schemas/ChildCat.java | 61 ++- .../client/components/schemas/ClassModel.java | 49 +- .../client/components/schemas/Client.java | 15 +- .../schemas/ComplexQuadrilateral.java | 75 ++- ...posedAnyOfDifferentTypesNoValidations.java | 61 ++- .../components/schemas/ComposedArray.java | 15 +- .../components/schemas/ComposedBool.java | 13 +- .../components/schemas/ComposedNone.java | 13 +- .../components/schemas/ComposedNumber.java | 21 +- .../components/schemas/ComposedObject.java | 13 +- .../schemas/ComposedOneOfDifferentTypes.java | 85 ++-- .../components/schemas/ComposedString.java | 13 +- .../client/components/schemas/Currency.java | 15 +- .../client/components/schemas/DanishPig.java | 29 +- .../components/schemas/DateTimeTest.java | 17 +- .../schemas/DateTimeWithValidations.java | 13 +- .../schemas/DateWithValidations.java | 13 +- .../client/components/schemas/Dog.java | 61 ++- .../client/components/schemas/Drawing.java | 29 +- .../client/components/schemas/EnumArrays.java | 57 ++- .../client/components/schemas/EnumClass.java | 19 +- .../client/components/schemas/EnumTest.java | 85 ++-- .../schemas/EquilateralTriangle.java | 75 ++- .../client/components/schemas/File.java | 15 +- .../schemas/FileSchemaTestClass.java | 29 +- .../client/components/schemas/Foo.java | 15 +- .../client/components/schemas/FormatTest.java | 161 ++++--- .../client/components/schemas/FromSchema.java | 15 +- .../client/components/schemas/Fruit.java | 49 +- .../client/components/schemas/FruitReq.java | 47 +- .../client/components/schemas/GmFruit.java | 49 +- .../components/schemas/GrandparentAnimal.java | 15 +- .../components/schemas/HasOnlyReadOnly.java | 15 +- .../components/schemas/HealthCheckResult.java | 31 +- .../components/schemas/IntegerEnum.java | 29 +- .../components/schemas/IntegerEnumBig.java | 29 +- .../schemas/IntegerEnumOneValue.java | 29 +- .../schemas/IntegerEnumWithDefaultValue.java | 29 +- .../components/schemas/IntegerMax10.java | 21 +- .../components/schemas/IntegerMin15.java | 21 +- .../components/schemas/IsoscelesTriangle.java | 75 ++- .../client/components/schemas/Items.java | 15 +- .../components/schemas/JSONPatchRequest.java | 61 ++- .../JSONPatchRequestAddReplaceTest.java | 29 +- .../schemas/JSONPatchRequestMoveCopy.java | 29 +- .../schemas/JSONPatchRequestRemove.java | 29 +- .../client/components/schemas/Mammal.java | 47 +- .../client/components/schemas/MapTest.java | 85 ++-- ...ropertiesAndAdditionalPropertiesClass.java | 29 +- .../client/components/schemas/Money.java | 15 +- .../components/schemas/MyObjectDto.java | 15 +- .../client/components/schemas/Name.java | 49 +- .../schemas/NoAdditionalProperties.java | 15 +- .../components/schemas/NullableClass.java | 307 +++++++------ .../components/schemas/NullableShape.java | 47 +- .../components/schemas/NullableString.java | 17 +- .../client/components/schemas/NumberOnly.java | 15 +- .../schemas/NumberWithExclusiveMinMax.java | 21 +- .../schemas/NumberWithValidations.java | 21 +- .../schemas/ObjWithRequiredProps.java | 15 +- .../schemas/ObjWithRequiredPropsBase.java | 15 +- .../ObjectModelWithArgAndArgsProperties.java | 15 +- .../schemas/ObjectModelWithRefProps.java | 15 +- ...hAllOfWithReqTestPropFromUnsetAddProp.java | 61 ++- .../ObjectWithCollidingProperties.java | 15 +- .../schemas/ObjectWithDecimalProperties.java | 15 +- .../ObjectWithDifficultlyNamedProps.java | 15 +- .../ObjectWithInlineCompositionProperty.java | 73 ++- ...ObjectWithInvalidNamedRefedProperties.java | 15 +- .../ObjectWithNonIntersectingValues.java | 15 +- .../schemas/ObjectWithOnlyOptionalProps.java | 15 +- .../schemas/ObjectWithOptionalTestProp.java | 15 +- .../schemas/ObjectWithValidations.java | 13 +- .../client/components/schemas/Order.java | 29 +- .../schemas/PaginatedResultMyObjectDto.java | 29 +- .../client/components/schemas/ParentPet.java | 13 +- .../client/components/schemas/Pet.java | 57 ++- .../client/components/schemas/Pig.java | 47 +- .../client/components/schemas/Player.java | 15 +- .../client/components/schemas/PublicKey.java | 15 +- .../components/schemas/Quadrilateral.java | 47 +- .../schemas/QuadrilateralInterface.java | 63 ++- .../components/schemas/ReadOnlyFirst.java | 15 +- .../schemas/ReqPropsFromExplicitAddProps.java | 15 +- .../schemas/ReqPropsFromTrueAddProps.java | 15 +- .../schemas/ReqPropsFromUnsetAddProps.java | 15 +- .../components/schemas/ReturnSchema.java | 49 +- .../components/schemas/ScaleneTriangle.java | 75 ++- .../components/schemas/Schema200Response.java | 49 +- .../schemas/SelfReferencingArrayModel.java | 15 +- .../schemas/SelfReferencingObjectModel.java | 15 +- .../client/components/schemas/Shape.java | 47 +- .../components/schemas/ShapeOrNull.java | 47 +- .../schemas/SimpleQuadrilateral.java | 75 ++- .../client/components/schemas/SomeObject.java | 47 +- .../components/schemas/SpecialModelname.java | 15 +- .../components/schemas/StringBooleanMap.java | 15 +- .../client/components/schemas/StringEnum.java | 21 +- .../schemas/StringEnumWithDefaultValue.java | 19 +- .../schemas/StringWithValidation.java | 13 +- .../client/components/schemas/Tag.java | 15 +- .../client/components/schemas/Triangle.java | 47 +- .../components/schemas/TriangleInterface.java | 63 ++- .../client/components/schemas/UUIDString.java | 13 +- .../client/components/schemas/User.java | 77 ++-- .../client/components/schemas/Whale.java | 29 +- .../client/components/schemas/Zebra.java | 43 +- .../client/header/ContentHeader.java | 5 +- .../client/header/Header.java | 5 +- .../client/header/SchemaHeader.java | 5 +- .../client/paths/anotherfakedummy/Patch.java | 5 +- .../anotherfakedummy/patch/Responses.java | 3 +- .../patch/responses/Code200Response.java | 3 +- .../paths/commonparamsubdir/Delete.java | 5 +- .../client/paths/commonparamsubdir/Get.java | 5 +- .../client/paths/commonparamsubdir/Post.java | 5 +- .../delete/HeaderParameters.java | 15 +- .../delete/PathParameters.java | 15 +- .../commonparamsubdir/delete/Responses.java | 3 +- .../delete/parameters/parameter1/Schema1.java | 15 +- .../commonparamsubdir/get/PathParameters.java | 15 +- .../get/QueryParameters.java | 15 +- .../commonparamsubdir/get/Responses.java | 3 +- .../routeparameter0/RouteParamSchema0.java | 15 +- .../post/HeaderParameters.java | 15 +- .../post/PathParameters.java | 15 +- .../commonparamsubdir/post/Responses.java | 3 +- .../client/paths/fake/Delete.java | 5 +- .../client/paths/fake/Get.java | 5 +- .../client/paths/fake/Patch.java | 5 +- .../client/paths/fake/Post.java | 5 +- .../paths/fake/delete/HeaderParameters.java | 15 +- .../paths/fake/delete/QueryParameters.java | 15 +- .../client/paths/fake/delete/Responses.java | 3 +- .../delete/parameters/parameter1/Schema1.java | 15 +- .../delete/parameters/parameter4/Schema4.java | 15 +- .../paths/fake/get/HeaderParameters.java | 15 +- .../paths/fake/get/QueryParameters.java | 15 +- .../client/paths/fake/get/Responses.java | 3 +- .../get/parameters/parameter0/Schema0.java | 33 +- .../get/parameters/parameter1/Schema1.java | 19 +- .../get/parameters/parameter2/Schema2.java | 33 +- .../get/parameters/parameter3/Schema3.java | 19 +- .../get/parameters/parameter4/Schema4.java | 25 +- .../get/parameters/parameter5/Schema5.java | 19 +- .../ApplicationxwwwformurlencodedSchema.java | 65 ++- .../fake/get/responses/Code404Response.java | 3 +- .../client/paths/fake/patch/Responses.java | 3 +- .../fake/patch/responses/Code200Response.java | 3 +- .../client/paths/fake/post/Responses.java | 3 +- .../ApplicationxwwwformurlencodedSchema.java | 151 +++--- .../fake/post/responses/Code404Response.java | 1 - .../Get.java | 5 +- .../get/Responses.java | 3 +- .../get/responses/Code200Response.java | 3 +- .../paths/fakebodywithfileschema/Put.java | 5 +- .../fakebodywithfileschema/put/Responses.java | 3 +- .../paths/fakebodywithqueryparams/Put.java | 5 +- .../put/QueryParameters.java | 15 +- .../put/Responses.java | 3 +- .../paths/fakecasesensitiveparams/Put.java | 5 +- .../put/QueryParameters.java | 15 +- .../put/Responses.java | 3 +- .../client/paths/fakeclassnametest/Patch.java | 5 +- .../fakeclassnametest/patch/Responses.java | 3 +- .../patch/responses/Code200Response.java | 3 +- .../paths/fakedeletecoffeeid/Delete.java | 5 +- .../delete/PathParameters.java | 15 +- .../fakedeletecoffeeid/delete/Responses.java | 3 +- .../delete/responses/CodedefaultResponse.java | 1 - .../client/paths/fakehealth/Get.java | 5 +- .../paths/fakehealth/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 3 +- .../fakeinlineadditionalproperties/Post.java | 5 +- .../post/Responses.java | 3 +- .../ApplicationjsonSchema.java | 15 +- .../paths/fakeinlinecomposition/Post.java | 5 +- .../post/QueryParameters.java | 15 +- .../fakeinlinecomposition/post/Responses.java | 3 +- .../post/parameters/parameter0/Schema0.java | 59 ++- .../post/parameters/parameter1/Schema1.java | 73 ++- .../ApplicationjsonSchema.java | 59 ++- .../MultipartformdataSchema.java | 73 ++- .../post/responses/Code200Response.java | 3 +- .../ApplicationjsonSchema.java | 59 ++- .../MultipartformdataSchema.java | 73 ++- .../client/paths/fakejsonformdata/Get.java | 5 +- .../paths/fakejsonformdata/get/Responses.java | 3 +- .../ApplicationxwwwformurlencodedSchema.java | 15 +- .../client/paths/fakejsonpatch/Patch.java | 5 +- .../paths/fakejsonpatch/patch/Responses.java | 3 +- .../paths/fakejsonwithcharset/Post.java | 5 +- .../fakejsonwithcharset/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../Post.java | 5 +- .../post/Responses.java | 3 +- .../ApplicationjsonSchema.java | 15 +- .../MultipartformdataSchema.java | 15 +- .../post/responses/Code200Response.java | 3 +- .../paths/fakemultipleresponsebodies/Get.java | 5 +- .../get/Responses.java | 3 +- .../get/responses/Code200Response.java | 3 +- .../get/responses/Code202Response.java | 3 +- .../paths/fakemultiplesecurities/Get.java | 5 +- .../fakemultiplesecurities/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 3 +- .../client/paths/fakeobjinquery/Get.java | 5 +- .../fakeobjinquery/get/QueryParameters.java | 15 +- .../paths/fakeobjinquery/get/Responses.java | 3 +- .../get/parameters/parameter0/Schema0.java | 15 +- .../Post.java | 5 +- .../post/CookieParameters.java | 15 +- .../post/HeaderParameters.java | 15 +- .../post/PathParameters.java | 15 +- .../post/QueryParameters.java | 15 +- .../post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../client/paths/fakepemcontenttype/Get.java | 5 +- .../fakepemcontenttype/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 3 +- .../Post.java | 5 +- .../post/PathParameters.java | 15 +- .../post/Responses.java | 3 +- .../MultipartformdataSchema.java | 15 +- .../post/responses/Code200Response.java | 3 +- .../Get.java | 5 +- .../get/QueryParameters.java | 15 +- .../get/Responses.java | 3 +- .../get/responses/Code200Response.java | 3 +- .../client/paths/fakeredirection/Get.java | 5 +- .../paths/fakeredirection/get/Responses.java | 3 +- .../get/responses/Code303Response.java | 1 - .../get/responses/Code3XXResponse.java | 1 - .../client/paths/fakerefobjinquery/Get.java | 5 +- .../get/QueryParameters.java | 15 +- .../fakerefobjinquery/get/Responses.java | 3 +- .../client/paths/fakerefsarraymodel/Post.java | 5 +- .../fakerefsarraymodel/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../paths/fakerefsarrayofenums/Post.java | 5 +- .../fakerefsarrayofenums/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../client/paths/fakerefsboolean/Post.java | 5 +- .../paths/fakerefsboolean/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../Post.java | 5 +- .../post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../client/paths/fakerefsenum/Post.java | 5 +- .../paths/fakerefsenum/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../client/paths/fakerefsmammal/Post.java | 5 +- .../paths/fakerefsmammal/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../client/paths/fakerefsnumber/Post.java | 5 +- .../paths/fakerefsnumber/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../fakerefsobjectmodelwithrefprops/Post.java | 5 +- .../post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../client/paths/fakerefsstring/Post.java | 5 +- .../paths/fakerefsstring/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../paths/fakeresponsewithoutschema/Get.java | 5 +- .../get/Responses.java | 3 +- .../get/responses/Code200Response.java | 1 - .../paths/faketestqueryparamters/Put.java | 5 +- .../put/QueryParameters.java | 15 +- .../faketestqueryparamters/put/Responses.java | 3 +- .../put/parameters/parameter0/Schema0.java | 15 +- .../put/parameters/parameter1/Schema1.java | 15 +- .../put/parameters/parameter2/Schema2.java | 15 +- .../put/parameters/parameter3/Schema3.java | 15 +- .../put/parameters/parameter4/Schema4.java | 15 +- .../paths/fakeuploaddownloadfile/Post.java | 5 +- .../post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../client/paths/fakeuploadfile/Post.java | 5 +- .../paths/fakeuploadfile/post/Responses.java | 3 +- .../MultipartformdataSchema.java | 15 +- .../post/responses/Code200Response.java | 3 +- .../client/paths/fakeuploadfiles/Post.java | 5 +- .../paths/fakeuploadfiles/post/Responses.java | 3 +- .../MultipartformdataSchema.java | 29 +- .../post/responses/Code200Response.java | 3 +- .../paths/fakewildcardresponses/Get.java | 5 +- .../fakewildcardresponses/get/Responses.java | 3 +- .../get/responses/Code1XXResponse.java | 3 +- .../get/responses/Code200Response.java | 3 +- .../get/responses/Code2XXResponse.java | 3 +- .../get/responses/Code3XXResponse.java | 3 +- .../get/responses/Code4XXResponse.java | 3 +- .../get/responses/Code5XXResponse.java | 3 +- .../client/paths/foo/Get.java | 5 +- .../client/paths/foo/get/Responses.java | 3 +- .../get/responses/CodedefaultResponse.java | 3 +- .../ApplicationjsonSchema.java | 15 +- .../paths/foo/get/servers/FooGetServer1.java | 3 +- .../foo/get/servers/server1/Variables.java | 33 +- .../client/paths/pet/Post.java | 5 +- .../client/paths/pet/Put.java | 5 +- .../client/paths/pet/post/Responses.java | 3 +- .../pet/post/responses/Code405Response.java | 1 - .../client/paths/pet/put/Responses.java | 3 +- .../pet/put/responses/Code400Response.java | 1 - .../pet/put/responses/Code404Response.java | 1 - .../pet/put/responses/Code405Response.java | 1 - .../client/paths/petfindbystatus/Get.java | 5 +- .../petfindbystatus/get/QueryParameters.java | 15 +- .../paths/petfindbystatus/get/Responses.java | 3 +- .../get/parameters/parameter0/Schema0.java | 33 +- .../get/responses/Code400Response.java | 1 - .../servers/PetfindbystatusServer1.java | 3 +- .../servers/server1/Variables.java | 33 +- .../client/paths/petfindbytags/Get.java | 5 +- .../petfindbytags/get/QueryParameters.java | 15 +- .../paths/petfindbytags/get/Responses.java | 3 +- .../get/parameters/parameter0/Schema0.java | 15 +- .../get/responses/Code400Response.java | 1 - .../client/paths/petpetid/Delete.java | 5 +- .../client/paths/petpetid/Get.java | 5 +- .../client/paths/petpetid/Post.java | 5 +- .../petpetid/delete/HeaderParameters.java | 15 +- .../paths/petpetid/delete/PathParameters.java | 15 +- .../paths/petpetid/delete/Responses.java | 3 +- .../delete/responses/Code400Response.java | 1 - .../paths/petpetid/get/PathParameters.java | 15 +- .../client/paths/petpetid/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 3 +- .../get/responses/Code400Response.java | 1 - .../get/responses/Code404Response.java | 1 - .../paths/petpetid/post/PathParameters.java | 15 +- .../client/paths/petpetid/post/Responses.java | 3 +- .../ApplicationxwwwformurlencodedSchema.java | 15 +- .../post/responses/Code405Response.java | 1 - .../paths/petpetiduploadimage/Post.java | 5 +- .../post/PathParameters.java | 15 +- .../petpetiduploadimage/post/Responses.java | 3 +- .../MultipartformdataSchema.java | 15 +- .../client/paths/solidus/Get.java | 5 +- .../client/paths/solidus/get/Responses.java | 3 +- .../client/paths/storeinventory/Get.java | 5 +- .../paths/storeinventory/get/Responses.java | 3 +- .../client/paths/storeorder/Post.java | 5 +- .../paths/storeorder/post/Responses.java | 3 +- .../post/responses/Code200Response.java | 3 +- .../post/responses/Code400Response.java | 1 - .../paths/storeorderorderid/Delete.java | 5 +- .../client/paths/storeorderorderid/Get.java | 5 +- .../delete/PathParameters.java | 15 +- .../storeorderorderid/delete/Responses.java | 3 +- .../delete/responses/Code400Response.java | 1 - .../delete/responses/Code404Response.java | 1 - .../storeorderorderid/get/PathParameters.java | 15 +- .../storeorderorderid/get/Responses.java | 3 +- .../get/parameters/parameter0/Schema0.java | 21 +- .../get/responses/Code200Response.java | 3 +- .../get/responses/Code400Response.java | 1 - .../get/responses/Code404Response.java | 1 - .../client/paths/user/Post.java | 5 +- .../client/paths/user/post/Responses.java | 3 +- .../post/responses/CodedefaultResponse.java | 1 - .../paths/usercreatewitharray/Post.java | 5 +- .../usercreatewitharray/post/Responses.java | 3 +- .../post/responses/CodedefaultResponse.java | 1 - .../client/paths/usercreatewithlist/Post.java | 5 +- .../usercreatewithlist/post/Responses.java | 3 +- .../post/responses/CodedefaultResponse.java | 1 - .../client/paths/userlogin/Get.java | 5 +- .../paths/userlogin/get/QueryParameters.java | 15 +- .../client/paths/userlogin/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 5 +- .../get/responses/Code400Response.java | 1 - .../Code200ResponseHeadersSchema.java | 15 +- .../client/paths/userlogout/Get.java | 5 +- .../paths/userlogout/get/Responses.java | 3 +- .../client/paths/userusername/Delete.java | 5 +- .../client/paths/userusername/Get.java | 5 +- .../client/paths/userusername/Put.java | 5 +- .../userusername/delete/PathParameters.java | 15 +- .../paths/userusername/delete/Responses.java | 3 +- .../delete/responses/Code404Response.java | 1 - .../userusername/get/PathParameters.java | 15 +- .../paths/userusername/get/Responses.java | 3 +- .../get/responses/Code200Response.java | 3 +- .../get/responses/Code400Response.java | 1 - .../get/responses/Code404Response.java | 1 - .../userusername/put/PathParameters.java | 15 +- .../paths/userusername/put/Responses.java | 3 +- .../put/responses/Code400Response.java | 1 - .../put/responses/Code404Response.java | 1 - .../client/response/HeadersDeserializer.java | 3 +- .../client/response/ResponseDeserializer.java | 9 +- .../response/ResponsesDeserializer.java | 3 +- .../client/schemas/AnyTypeJsonSchema.java | 47 +- .../client/schemas/BooleanJsonSchema.java | 13 +- .../client/schemas/DateJsonSchema.java | 17 +- .../client/schemas/DateTimeJsonSchema.java | 17 +- .../client/schemas/DecimalJsonSchema.java | 13 +- .../client/schemas/DoubleJsonSchema.java | 15 +- .../client/schemas/FloatJsonSchema.java | 15 +- .../client/schemas/Int32JsonSchema.java | 19 +- .../client/schemas/Int64JsonSchema.java | 23 +- .../client/schemas/IntJsonSchema.java | 23 +- .../client/schemas/ListJsonSchema.java | 15 +- .../client/schemas/MapJsonSchema.java | 15 +- .../client/schemas/NotAnyTypeJsonSchema.java | 47 +- .../client/schemas/NullJsonSchema.java | 13 +- .../client/schemas/NumberJsonSchema.java | 23 +- .../client/schemas/StringJsonSchema.java | 21 +- .../client/schemas/UuidJsonSchema.java | 17 +- .../validation/BooleanEnumValidator.java | 3 +- .../validation/BooleanSchemaValidator.java | 5 +- .../validation/DefaultValueMethod.java | 4 +- .../validation/DoubleEnumValidator.java | 3 +- .../schemas/validation/ElseValidator.java | 1 - .../validation/FloatEnumValidator.java | 3 +- .../validation/IntegerEnumValidator.java | 3 +- .../client/schemas/validation/JsonSchema.java | 17 +- .../validation/ListSchemaValidator.java | 7 +- .../schemas/validation/LongEnumValidator.java | 3 +- .../validation/MapSchemaValidator.java | 7 +- .../schemas/validation/NullEnumValidator.java | 3 +- .../validation/NullSchemaValidator.java | 5 +- .../validation/NumberSchemaValidator.java | 5 +- .../validation/StringEnumValidator.java | 3 +- .../validation/StringSchemaValidator.java | 5 +- .../validation/UnsetAnyTypeJsonSchema.java | 47 +- .../client/servers/Server0.java | 3 +- .../client/servers/Server1.java | 3 +- .../client/servers/server0/Variables.java | 51 +-- .../client/servers/server1/Variables.java | 33 +- .../client/header/ContentHeaderTest.java | 3 +- .../client/header/SchemaHeaderTest.java | 5 +- .../SchemaNonQueryParameterTest.java | 1 - .../parameter/SchemaQueryParameterTest.java | 1 - .../RequestBodySerializerTest.java | 5 +- .../response/ResponseDeserializerTest.java | 15 +- .../client/schemas/AnyTypeSchemaTest.java | 23 +- .../client/schemas/ArrayTypeSchemaTest.java | 33 +- .../client/schemas/BooleanSchemaTest.java | 5 +- .../client/schemas/ListSchemaTest.java | 3 +- .../client/schemas/MapSchemaTest.java | 3 +- .../client/schemas/NullSchemaTest.java | 3 +- .../client/schemas/NumberSchemaTest.java | 9 +- .../client/schemas/ObjectTypeSchemaTest.java | 59 ++- .../client/schemas/RefBooleanSchemaTest.java | 5 +- .../AdditionalPropertiesValidatorTest.java | 7 +- .../validation/ItemsValidatorTest.java | 7 +- .../schemas/validation/JsonSchemaTest.java | 7 +- .../validation/PropertiesValidatorTest.java | 9 +- .../validation/RequiredValidatorTest.java | 7 +- .../generators/JavaClientGenerator.java | 2 - .../components/responses/Response.hbs | 5 +- .../schemas/SchemaClass/_Schema_string.hbs | 4 +- .../schemas/SchemaClass/_validateAndBox.hbs | 8 +- .../SchemaClass/_validateAndBoxBoolean.hbs | 2 +- .../SchemaClass/_validateAndBoxList.hbs | 2 +- .../SchemaClass/_validateAndBoxMap.hbs | 2 +- .../SchemaClass/_validateAndBoxNumber.hbs | 2 +- .../SchemaClass/_validateAndBoxString.hbs | 2 +- .../SchemaClass/_validateAndBoxVoid.hbs | 2 +- .../SchemaClass/_validate_implementor.hbs | 90 ++-- .../components/schemas/_arrayOutputType.hbs | 2 +- .../components/schemas/_objectOutputType.hbs | 4 +- .../exceptions/InvalidTypeException.hbs | 8 - .../java/packagename/header/ContentHeader.hbs | 5 +- .../main/java/packagename/header/Header.hbs | 5 +- .../java/packagename/header/SchemaHeader.hbs | 5 +- .../packagename/paths/path/verb/Operation.hbs | 5 +- .../packagename/paths/path/verb/Responses.hbs | 3 +- .../path/verb/_OperationDocCodeSample.hbs | 3 +- .../response/HeadersDeserializer.hbs | 3 +- .../response/ResponseDeserializer.hbs | 9 +- .../response/ResponsesDeserializer.hbs | 3 +- .../packagename/schemas/AnyTypeJsonSchema.hbs | 47 +- .../packagename/schemas/BooleanJsonSchema.hbs | 13 +- .../packagename/schemas/DateJsonSchema.hbs | 17 +- .../schemas/DateTimeJsonSchema.hbs | 17 +- .../packagename/schemas/DecimalJsonSchema.hbs | 13 +- .../packagename/schemas/DoubleJsonSchema.hbs | 15 +- .../packagename/schemas/FloatJsonSchema.hbs | 15 +- .../packagename/schemas/Int32JsonSchema.hbs | 19 +- .../packagename/schemas/Int64JsonSchema.hbs | 23 +- .../packagename/schemas/IntJsonSchema.hbs | 23 +- .../packagename/schemas/ListJsonSchema.hbs | 15 +- .../packagename/schemas/MapJsonSchema.hbs | 15 +- .../schemas/NotAnyTypeJsonSchema.hbs | 47 +- .../packagename/schemas/NullJsonSchema.hbs | 13 +- .../packagename/schemas/NumberJsonSchema.hbs | 23 +- .../packagename/schemas/StringJsonSchema.hbs | 21 +- .../packagename/schemas/UuidJsonSchema.hbs | 17 +- .../validation/BooleanEnumValidator.hbs | 3 +- .../validation/BooleanSchemaValidator.hbs | 5 +- .../schemas/validation/DefaultValueMethod.hbs | 4 +- .../validation/DoubleEnumValidator.hbs | 3 +- .../schemas/validation/ElseValidator.hbs | 1 - .../schemas/validation/FloatEnumValidator.hbs | 3 +- .../validation/IntegerEnumValidator.hbs | 3 +- .../schemas/validation/JsonSchema.hbs | 17 +- .../validation/ListSchemaValidator.hbs | 7 +- .../schemas/validation/LongEnumValidator.hbs | 3 +- .../schemas/validation/MapSchemaValidator.hbs | 7 +- .../schemas/validation/NullEnumValidator.hbs | 3 +- .../validation/NullSchemaValidator.hbs | 5 +- .../validation/NumberSchemaValidator.hbs | 5 +- .../validation/StringEnumValidator.hbs | 3 +- .../validation/StringSchemaValidator.hbs | 5 +- .../validation/UnsetAnyTypeJsonSchema.hbs | 47 +- .../main/java/packagename/servers/ServerN.hbs | 3 +- .../components/schemas/Schema_test.hbs | 5 +- .../packagename/header/ContentHeaderTest.hbs | 3 +- .../packagename/header/SchemaHeaderTest.hbs | 5 +- .../parameter/SchemaNonQueryParameterTest.hbs | 1 - .../parameter/SchemaQueryParameterTest.hbs | 1 - .../requestbody/RequestBodySerializerTest.hbs | 5 +- .../response/ResponseDeserializerTest.hbs | 15 +- .../packagename/schemas/AnyTypeSchemaTest.hbs | 23 +- .../schemas/ArrayTypeSchemaTest.hbs | 33 +- .../packagename/schemas/BooleanSchemaTest.hbs | 5 +- .../packagename/schemas/ListSchemaTest.hbs | 3 +- .../packagename/schemas/MapSchemaTest.hbs | 3 +- .../packagename/schemas/NullSchemaTest.hbs | 3 +- .../packagename/schemas/NumberSchemaTest.hbs | 9 +- .../schemas/ObjectTypeSchemaTest.hbs | 59 ++- .../schemas/RefBooleanSchemaTest.hbs | 5 +- .../AdditionalPropertiesValidatorTest.hbs | 7 +- .../schemas/validation/ItemsValidatorTest.hbs | 7 +- .../schemas/validation/JsonSchemaTest.hbs | 7 +- .../validation/PropertiesValidatorTest.hbs | 9 +- .../validation/RequiredValidatorTest.hbs | 7 +- 637 files changed, 4495 insertions(+), 5127 deletions(-) delete mode 100644 src/main/resources/java/src/main/java/packagename/exceptions/InvalidTypeException.hbs diff --git a/samples/client/petstore/java/.openapi-generator/FILES b/samples/client/petstore/java/.openapi-generator/FILES index 347f366fc35..75d48d1effe 100644 --- a/samples/client/petstore/java/.openapi-generator/FILES +++ b/samples/client/petstore/java/.openapi-generator/FILES @@ -896,7 +896,6 @@ src/main/java/org/openapijsonschematools/client/contenttype/ContentTypeSerialize src/main/java/org/openapijsonschematools/client/exceptions/ApiException.java src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.java -src/main/java/org/openapijsonschematools/client/exceptions/InvalidTypeException.java src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java src/main/java/org/openapijsonschematools/client/exceptions/UnsetPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/ValidationException.java diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index a72da50a8f8..2b15b83b225 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -84,7 +83,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index 01232545217..1a331dc2358 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -84,7 +83,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index 2cc504350ac..5693cefd4e0 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -84,7 +83,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index 72532675f24..8393342e4d3 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -84,7 +83,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index 164c58d4be4..9c825256fd7 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -40,7 +40,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -116,7 +115,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index 04e6515a258..ab3d0b96b43 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -72,7 +71,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index c975e27f35c..e5558317f07 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -84,7 +83,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index d2bb06972f2..3397d9641e1 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -36,7 +36,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -81,7 +80,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index 10df23b5477..e56f2f652d1 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index 9cfb815230c..94ad2fc1850 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -86,7 +85,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index eb8b6171799..09e3e53e092 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -38,7 +38,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -114,7 +113,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index b707d73467f..d56e914e211 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -87,7 +86,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index 5d4e49c5137..7416464f935 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -38,7 +38,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -95,7 +94,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index 58c964c77b3..8fb4a384faa 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -83,7 +82,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index e42593b80b7..0066f020084 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -31,7 +31,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -68,7 +67,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index e9feef5c115..20d932e19c0 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -84,7 +83,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 20f9d35e90b..3ccb6b9a95f 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -71,7 +70,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index d01afeb15d7..c8f3b63f10b 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index b624f98a247..556aa86f8c4 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index 493985aa66e..b520197c4a4 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 4e0a00f6ae0..db5c9ed1ffa 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index fdcc9635be2..7815b433b2f 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -31,7 +31,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -68,7 +67,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index 51d052d9a18..5eaec1839b0 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -36,7 +36,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -84,7 +83,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index edccccde894..5d69a57ac25 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -69,7 +68,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index 00b04a041ce..7b14516a567 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -38,7 +38,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -95,7 +94,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index 2e5c5c2a6cd..56957c87be7 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index 8dd57a8d0a3..ffad2328057 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -38,7 +38,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -92,7 +91,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index 7fea499684d..98a41007ebd 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -81,7 +80,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index f8546f29e06..9a9d7ee7180 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -31,7 +31,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -68,7 +67,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index 371c9e2d29d..b5f03558e89 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -32,7 +32,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -69,7 +68,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index 497b1f05730..eba2826f61a 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index d5e2b6f6328..b8784714854 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index 083fc031eca..cd6f05d5f39 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index fec0cfa9656..340cd0908fc 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index 4bba4cc41d0..17fbe100933 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index 3cce194c142..e7f56851f63 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -75,7 +74,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index e7af26a04ee..3f0e8edc17c 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 17f5b7ed59a..17fb878b34f 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 3ce9f64d99e..c2da5b72f67 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index 7da88623e15..45a84d29d08 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -31,7 +31,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -68,7 +67,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index 7849fc9414e..6479c0642ba 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -108,7 +107,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index 7afab535737..645873c22ff 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -80,7 +79,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index 7e2d58ff495..147dc01bbe3 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index b698c2bd53d..d317227e802 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -33,7 +33,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -70,7 +69,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index 592eb183fce..5d9315ff60a 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -31,7 +31,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -68,7 +67,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index 5057a4e6e04..582931a2d6c 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -30,7 +30,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -66,7 +65,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index 67e5b82a477..f0eaadd409f 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -40,7 +40,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -128,7 +127,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index b784c839d7b..8cbec2ec85c 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -39,7 +39,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -124,7 +123,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 4457c7d8dd9..6009a4a27f6 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -38,7 +38,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -97,7 +96,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index 34bfe46f04d..fc5b085793a 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -38,7 +38,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -95,7 +94,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index 064ad811024..a3117b65623 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -39,7 +39,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -96,7 +95,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index 1f64cb42208..a1fd16340a5 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -37,7 +37,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -94,7 +93,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index d34f5d01e6c..dfc0d1e7d9e 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -39,7 +39,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -96,7 +95,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index 72ee8df3ebd..d826b72b6fb 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -38,7 +38,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -92,7 +91,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index aea8f3e8823..f82b01da205 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -31,7 +31,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -68,7 +67,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index 0c43b54a041..92d16d5ffbb 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -79,7 +78,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index 4b4d3bebd11..8453fa63514 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -94,7 +93,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index 048b668d64f..9e66a24a4eb 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -83,7 +82,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index 62b977eb4b0..c8267e7ac7e 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -83,7 +82,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index 87a684c148e..e7e762bec9f 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -100,7 +99,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index 73b0e5a0ab0..a17f4ab4f09 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -122,7 +121,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index bbe37daa960..15bb49e8bdd 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -35,7 +35,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -122,7 +121,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index c305bc105fc..43677f438f0 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -85,7 +84,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index e7df4b8af98..8afbea89768 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -31,7 +31,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -68,7 +67,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index 5708c91be7e..e5744a8e325 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -83,7 +82,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index 4d2ad7388b2..5162ba1924b 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -34,7 +34,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -83,7 +82,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index 6ede69774f6..9118a5b6d52 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -38,7 +38,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -114,7 +113,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java index 8af7588a70f..55abb17fdbd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.schemas.User; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -29,7 +28,7 @@ public static class ApplicationjsonSchemaList extends FrozenList { protected ApplicationjsonSchemaList(FrozenList m) { super(m); } - public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } } @@ -110,7 +109,7 @@ public ApplicationjsonSchemaList getNewInstance(List arg, List pathTo return new ApplicationjsonSchemaList(newInstanceItems); } - public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,11 +120,11 @@ public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration confi } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -135,15 +134,15 @@ public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration confi throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java index 4de459ce112..632e56e143c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; @@ -31,7 +30,7 @@ protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaCo } @Override - protected HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException, NotImplementedException { + protected HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java index 126ad114344..d7d943ac519 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java index db98ac394c4..b694d846659 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -42,14 +41,14 @@ public SuccessInlineContentAndHeader1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } @Override - protected SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException, NotImplementedException { + protected SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java index 90ff7c9ddb4..e48fd69140e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -42,14 +41,14 @@ public SuccessWithJsonApiResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } @Override - protected SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException, NotImplementedException { + protected SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java index 8a6bec98564..ab4cafafef3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -53,7 +52,7 @@ public SuccessfulXmlAndJsonArrayOfPet1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java index 9cf67e145ee..f84e00f8370 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.responses.headerswithnobody.headers.location.LocationSchema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -50,7 +49,7 @@ protected HeadersWithNoBodyHeadersSchemaMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "location" ); - public static HeadersWithNoBodyHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static HeadersWithNoBodyHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return HeadersWithNoBodyHeadersSchema1.getInstance().validate(arg, configuration); } @@ -151,7 +150,7 @@ public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeadersWithNoBodyHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,11 +162,11 @@ public HeadersWithNoBodyHeadersSchemaMap validate(Map arg, SchemaConfigura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -177,15 +176,15 @@ public HeadersWithNoBodyHeadersSchemaMap validate(Map arg, SchemaConfigura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeadersWithNoBodyHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeadersWithNoBodyHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeadersWithNoBodyHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public HeadersWithNoBodyHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeadersWithNoBodyHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java index 41648d26c45..2d47eb20745 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.components.schemas.RefPet; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -30,7 +29,7 @@ public static class ApplicationjsonSchemaList extends FrozenList { protected ApplicationjsonSchemaList(FrozenList m) { super(m); } - public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationjsonSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } } @@ -111,7 +110,7 @@ public ApplicationjsonSchemaList getNewInstance(List arg, List pathTo return new ApplicationjsonSchemaList(newInstanceItems); } - public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -122,11 +121,11 @@ public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration confi } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -136,15 +135,15 @@ public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration confi throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java index ccd9ff1c17a..a04441ddc86 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.schemas.Pet; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -29,7 +28,7 @@ public static class ApplicationxmlSchemaList extends FrozenList { protected ApplicationxmlSchemaList(FrozenList m) { super(m); } - public static ApplicationxmlSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationxmlSchemaList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationxmlSchema1.getInstance().validate(arg, configuration); } } @@ -110,7 +109,7 @@ public ApplicationxmlSchemaList getNewInstance(List arg, List pathToI return new ApplicationxmlSchemaList(newInstanceItems); } - public ApplicationxmlSchemaList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ApplicationxmlSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,11 +120,11 @@ public ApplicationxmlSchemaList validate(List arg, SchemaConfiguration config } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -135,15 +134,15 @@ public ApplicationxmlSchemaList validate(List arg, SchemaConfiguration config throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxmlSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxmlSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxmlSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationxmlSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxmlSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java index fa81cb9cef7..2c88c985d14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.headers.someheader.SomeHeaderSchema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -50,7 +49,7 @@ protected SuccessInlineContentAndHeaderHeadersSchemaMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "someHeader" ); - public static SuccessInlineContentAndHeaderHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SuccessInlineContentAndHeaderHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return SuccessInlineContentAndHeaderHeadersSchema1.getInstance().validate(arg, configuration); } @@ -151,7 +150,7 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map ar return new SuccessInlineContentAndHeaderHeadersSchemaMap(castProperties); } - public SuccessInlineContentAndHeaderHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessInlineContentAndHeaderHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,11 +162,11 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap validate(Map arg, Sch @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -177,15 +176,15 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap validate(Map arg, Sch throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SuccessInlineContentAndHeaderHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessInlineContentAndHeaderHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SuccessInlineContentAndHeaderHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public SuccessInlineContentAndHeaderHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessInlineContentAndHeaderHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java index 3c15438127d..a6103068681 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -45,7 +44,7 @@ protected ApplicationjsonSchemaMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } @@ -150,7 +149,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,11 +161,11 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -176,15 +175,15 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java index 248ed6d8006..1c691e76d47 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.components.schemas.StringWithValidation; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -58,7 +57,7 @@ protected SuccessWithJsonApiResponseHeadersSchemaMap(FrozenMap<@Nullable Object> public static final Set optionalKeys = Set.of( "numberHeader" ); - public static SuccessWithJsonApiResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SuccessWithJsonApiResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return SuccessWithJsonApiResponseHeadersSchema1.getInstance().validate(arg, configuration); } @@ -488,7 +487,7 @@ public SuccessWithJsonApiResponseHeadersSchemaMap getNewInstance(Map arg, return new SuccessWithJsonApiResponseHeadersSchemaMap(castProperties); } - public SuccessWithJsonApiResponseHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessWithJsonApiResponseHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -500,11 +499,11 @@ public SuccessWithJsonApiResponseHeadersSchemaMap validate(Map arg, Schema @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -514,15 +513,15 @@ public SuccessWithJsonApiResponseHeadersSchemaMap validate(Map arg, Schema throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SuccessWithJsonApiResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessWithJsonApiResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SuccessWithJsonApiResponseHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public SuccessWithJsonApiResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessWithJsonApiResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java index 9b1a3a1b688..4fbba3d77fb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -50,7 +49,7 @@ protected AbstractStepMessageMap(FrozenMap<@Nullable Object> m) { "sequenceNumber" ); public static final Set optionalKeys = Set.of(); - public static AbstractStepMessageMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AbstractStepMessageMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return AbstractStepMessage1.getInstance().validate(arg, configuration); } @@ -415,7 +414,7 @@ public AbstractStepMessageMap getNewInstance(Map arg, List pathToI return new AbstractStepMessageMap(castProperties); } - public AbstractStepMessageMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AbstractStepMessageMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -427,11 +426,11 @@ public AbstractStepMessageMap validate(Map arg, SchemaConfiguration config @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -441,15 +440,15 @@ public AbstractStepMessageMap validate(Map arg, SchemaConfiguration config throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AbstractStepMessage1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AbstractStepMessage1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AbstractStepMessage1BoxedMap(validate(arg, configuration)); } @Override - public AbstractStepMessage1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AbstractStepMessage1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java index bcd5b0cbf06..3426c014963 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -50,7 +49,7 @@ protected MapPropertyMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MapPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MapProperty.getInstance().validate(arg, configuration); } @@ -148,7 +147,7 @@ public MapPropertyMap getNewInstance(Map arg, List pathToItem, Pat return new MapPropertyMap(castProperties); } - public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -160,11 +159,11 @@ public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -174,15 +173,15 @@ public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapPropertyBoxedMap(validate(arg, configuration)); } @Override - public MapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -204,7 +203,7 @@ protected AdditionalPropertiesMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return AdditionalProperties1.getInstance().validate(arg, configuration); } @@ -302,7 +301,7 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo return new AdditionalPropertiesMap(castProperties); } - public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,11 +313,11 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration confi @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -328,15 +327,15 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration confi throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -347,7 +346,7 @@ protected MapOfMapPropertyMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapOfMapPropertyMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MapOfMapPropertyMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { return MapOfMapProperty.getInstance().validate(arg, configuration); } @@ -445,7 +444,7 @@ public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem return new MapOfMapPropertyMap(castProperties); } - public MapOfMapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfMapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -457,11 +456,11 @@ public MapOfMapPropertyMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -471,15 +470,15 @@ public MapOfMapPropertyMap validate(Map arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapOfMapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfMapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapOfMapPropertyBoxedMap(validate(arg, configuration)); } @Override - public MapOfMapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfMapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -534,7 +533,7 @@ protected MapWithUndeclaredPropertiesAnytype3Map(FrozenMap<@Nullable Object> m) } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapWithUndeclaredPropertiesAnytype3Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MapWithUndeclaredPropertiesAnytype3Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MapWithUndeclaredPropertiesAnytype3.getInstance().validate(arg, configuration); } @@ -685,7 +684,7 @@ public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List return new MapWithUndeclaredPropertiesAnytype3Map(castProperties); } - public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -697,11 +696,11 @@ public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -711,15 +710,15 @@ public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapWithUndeclaredPropertiesAnytype3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesAnytype3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapWithUndeclaredPropertiesAnytype3BoxedMap(validate(arg, configuration)); } @Override - public MapWithUndeclaredPropertiesAnytype3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesAnytype3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -743,7 +742,7 @@ protected EmptyMapMap(FrozenMap<@Nullable Object> m) { public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); // map with no key value pairs - public static EmptyMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static EmptyMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return EmptyMap.getInstance().validate(arg, configuration); } } @@ -815,7 +814,7 @@ public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathTo return new EmptyMapMap(castProperties); } - public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -827,11 +826,11 @@ public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -841,15 +840,15 @@ public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) th throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EmptyMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EmptyMapBoxedMap(validate(arg, configuration)); } @Override - public EmptyMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -871,7 +870,7 @@ protected MapWithUndeclaredPropertiesStringMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapWithUndeclaredPropertiesStringMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MapWithUndeclaredPropertiesStringMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MapWithUndeclaredPropertiesString.getInstance().validate(arg, configuration); } @@ -969,7 +968,7 @@ public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -981,11 +980,11 @@ public MapWithUndeclaredPropertiesStringMap validate(Map arg, SchemaConfig @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -995,15 +994,15 @@ public MapWithUndeclaredPropertiesStringMap validate(Map arg, SchemaConfig throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapWithUndeclaredPropertiesStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapWithUndeclaredPropertiesStringBoxedMap(validate(arg, configuration)); } @Override - public MapWithUndeclaredPropertiesStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1023,7 +1022,7 @@ protected AdditionalPropertiesClassMap(FrozenMap<@Nullable Object> m) { "empty_map", "map_with_undeclared_properties_string" ); - public static AdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return AdditionalPropertiesClass1.getInstance().validate(arg, configuration); } @@ -1365,7 +1364,7 @@ public AdditionalPropertiesClassMap getNewInstance(Map arg, List p return new AdditionalPropertiesClassMap(castProperties); } - public AdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1377,11 +1376,11 @@ public AdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1391,15 +1390,15 @@ public AdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalPropertiesClass1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java index 09ea7e4e3c4..cd38c0e0ee1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -55,7 +54,7 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema0.getInstance().validate(arg, configuration); } @@ -206,7 +205,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,11 +217,11 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -232,15 +231,15 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -309,7 +308,7 @@ public static AdditionalProperties1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -321,7 +320,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -333,7 +332,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -344,24 +343,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -372,15 +371,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -404,7 +403,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -438,7 +437,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -450,7 +449,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -465,7 +464,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -486,31 +485,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedBoolean(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedNumber(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedString(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedList(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -526,7 +525,7 @@ public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -536,7 +535,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } @@ -687,7 +686,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -699,11 +698,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -713,15 +712,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -790,7 +789,7 @@ public static AdditionalProperties2 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -802,7 +801,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -814,7 +813,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -825,24 +824,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -853,15 +852,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -885,7 +884,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -919,7 +918,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -931,7 +930,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -946,7 +945,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -967,31 +966,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedBoolean(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedNumber(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedString(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedList(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1007,7 +1006,7 @@ public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1017,7 +1016,7 @@ protected Schema2Map(FrozenMap<@Nullable Object> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static Schema2Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema2Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema2.getInstance().validate(arg, configuration); } @@ -1168,7 +1167,7 @@ public Schema2Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema2Map(castProperties); } - public Schema2Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1180,11 +1179,11 @@ public Schema2Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1194,15 +1193,15 @@ public Schema2Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema2BoxedMap(validate(arg, configuration)); } @Override - public Schema2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1269,7 +1268,7 @@ public static AdditionalPropertiesSchema1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1281,11 +1280,11 @@ public static AdditionalPropertiesSchema1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1295,15 +1294,15 @@ public static AdditionalPropertiesSchema1 getInstance() { throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalPropertiesSchema1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java index 6e2863a0abf..2ed4a1f0360 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -33,7 +32,7 @@ public static class AdditionalPropertiesList extends FrozenList { protected AdditionalPropertiesList(FrozenList m) { super(m); } - public static AdditionalPropertiesList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AdditionalPropertiesList of(List arg, SchemaConfiguration configuration) throws ValidationException { return AdditionalProperties.getInstance().validate(arg, configuration); } } @@ -119,7 +118,7 @@ public AdditionalPropertiesList getNewInstance(List arg, List pathToI return new AdditionalPropertiesList(newInstanceItems); } - public AdditionalPropertiesList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public AdditionalPropertiesList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,11 +129,11 @@ public AdditionalPropertiesList validate(List arg, SchemaConfiguration config } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -144,15 +143,15 @@ public AdditionalPropertiesList validate(List arg, SchemaConfiguration config throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalPropertiesBoxedList(validate(arg, configuration)); } @Override - public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -162,7 +161,7 @@ protected AdditionalPropertiesWithArrayOfEnumsMap(FrozenMap requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AdditionalPropertiesWithArrayOfEnumsMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AdditionalPropertiesWithArrayOfEnumsMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { return AdditionalPropertiesWithArrayOfEnums1.getInstance().validate(arg, configuration); } @@ -270,7 +269,7 @@ public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(Map arg, Lis return new AdditionalPropertiesWithArrayOfEnumsMap(castProperties); } - public AdditionalPropertiesWithArrayOfEnumsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesWithArrayOfEnumsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -282,11 +281,11 @@ public AdditionalPropertiesWithArrayOfEnumsMap validate(Map arg, SchemaCon @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -296,15 +295,15 @@ public AdditionalPropertiesWithArrayOfEnumsMap validate(Map arg, SchemaCon throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesWithArrayOfEnums1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesWithArrayOfEnums1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalPropertiesWithArrayOfEnums1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesWithArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesWithArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java index 771d9a3dcf0..4a116392673 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -45,7 +44,7 @@ protected AddressMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AddressMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AddressMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Address1.getInstance().validate(arg, configuration); } @@ -170,7 +169,7 @@ public AddressMap getNewInstance(Map arg, List pathToItem, PathToS return new AddressMap(castProperties); } - public AddressMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AddressMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -182,11 +181,11 @@ public AddressMap validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -196,15 +195,15 @@ public AddressMap validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Address1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Address1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Address1BoxedMap(validate(arg, configuration)); } @Override - public Address1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Address1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java index 5251da28fd3..f65e1246b7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -75,7 +74,7 @@ public static Color getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,11 +85,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -99,22 +98,22 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public ColorBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ColorBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ColorBoxedString(validate(arg, configuration)); } @Override - public ColorBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ColorBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -128,7 +127,7 @@ protected AnimalMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "color" ); - public static AnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Animal1.getInstance().validate(arg, configuration); } @@ -283,7 +282,7 @@ public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSc return new AnimalMap(castProperties); } - public AnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -295,11 +294,11 @@ public AnimalMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -309,15 +308,15 @@ public AnimalMap validate(Map arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Animal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Animal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Animal1BoxedMap(validate(arg, configuration)); } @Override - public Animal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Animal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java index 28311a1e5c4..56c1faea7aa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -28,7 +27,7 @@ public static class AnimalFarmList extends FrozenList { protected AnimalFarmList(FrozenList m) { super(m); } - public static AnimalFarmList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AnimalFarmList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return AnimalFarm1.getInstance().validate(arg, configuration); } } @@ -115,7 +114,7 @@ public AnimalFarmList getNewInstance(List arg, List pathToItem, PathT return new AnimalFarmList(newInstanceItems); } - public AnimalFarmList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public AnimalFarmList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -126,11 +125,11 @@ public AnimalFarmList validate(List arg, SchemaConfiguration configuration) t } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -140,15 +139,15 @@ public AnimalFarmList validate(List arg, SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnimalFarm1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnimalFarm1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnimalFarm1BoxedList(validate(arg, configuration)); } @Override - public AnimalFarm1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnimalFarm1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java index 16001bb2b9a..b93b1cd30eb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -101,7 +100,7 @@ public static UuidSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -113,7 +112,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -136,24 +135,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -164,15 +163,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -196,7 +195,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -230,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -257,7 +256,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -278,31 +277,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UuidSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedVoid(validate(arg, configuration)); } @Override - public UuidSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public UuidSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedNumber(validate(arg, configuration)); } @Override - public UuidSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedString(validate(arg, configuration)); } @Override - public UuidSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedList(validate(arg, configuration)); } @Override - public UuidSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedMap(validate(arg, configuration)); } @Override - public UuidSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -318,7 +317,7 @@ public UuidSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -386,7 +385,7 @@ public static Date getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -398,7 +397,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -410,7 +409,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -421,24 +420,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -449,15 +448,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -481,7 +480,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -515,7 +514,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -527,7 +526,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -542,7 +541,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -563,31 +562,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedVoid(validate(arg, configuration)); } @Override - public DateBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedBoolean(validate(arg, configuration)); } @Override - public DateBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedNumber(validate(arg, configuration)); } @Override - public DateBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedString(validate(arg, configuration)); } @Override - public DateBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedList(validate(arg, configuration)); } @Override - public DateBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedMap(validate(arg, configuration)); } @Override - public DateBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -603,7 +602,7 @@ public DateBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -671,7 +670,7 @@ public static Datetime getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -683,7 +682,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -695,7 +694,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -706,24 +705,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -734,15 +733,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -766,7 +765,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -800,7 +799,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -812,7 +811,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -827,7 +826,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -848,31 +847,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DatetimeBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedVoid(validate(arg, configuration)); } @Override - public DatetimeBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedBoolean(validate(arg, configuration)); } @Override - public DatetimeBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedNumber(validate(arg, configuration)); } @Override - public DatetimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedString(validate(arg, configuration)); } @Override - public DatetimeBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedList(validate(arg, configuration)); } @Override - public DatetimeBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedMap(validate(arg, configuration)); } @Override - public DatetimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -888,7 +887,7 @@ public DatetimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -956,7 +955,7 @@ public static NumberSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -968,7 +967,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -980,7 +979,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -991,24 +990,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1019,15 +1018,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -1051,7 +1050,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1085,7 +1084,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1097,7 +1096,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1112,7 +1111,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1133,31 +1132,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedVoid(validate(arg, configuration)); } @Override - public NumberSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedNumber(validate(arg, configuration)); } @Override - public NumberSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedString(validate(arg, configuration)); } @Override - public NumberSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedList(validate(arg, configuration)); } @Override - public NumberSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedMap(validate(arg, configuration)); } @Override - public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1173,7 +1172,7 @@ public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1241,7 +1240,7 @@ public static Binary getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1253,7 +1252,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1265,7 +1264,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1276,24 +1275,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1304,15 +1303,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -1336,7 +1335,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1370,7 +1369,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1382,7 +1381,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1397,7 +1396,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1418,31 +1417,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BinaryBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedVoid(validate(arg, configuration)); } @Override - public BinaryBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedBoolean(validate(arg, configuration)); } @Override - public BinaryBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedNumber(validate(arg, configuration)); } @Override - public BinaryBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedString(validate(arg, configuration)); } @Override - public BinaryBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedList(validate(arg, configuration)); } @Override - public BinaryBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedMap(validate(arg, configuration)); } @Override - public BinaryBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1458,7 +1457,7 @@ public BinaryBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1526,7 +1525,7 @@ public static Int32 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1538,7 +1537,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1550,7 +1549,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1561,24 +1560,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1589,15 +1588,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -1621,7 +1620,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1655,7 +1654,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1667,7 +1666,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1682,7 +1681,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1703,31 +1702,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Int32BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedVoid(validate(arg, configuration)); } @Override - public Int32BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedBoolean(validate(arg, configuration)); } @Override - public Int32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedNumber(validate(arg, configuration)); } @Override - public Int32BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedString(validate(arg, configuration)); } @Override - public Int32BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedList(validate(arg, configuration)); } @Override - public Int32BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedMap(validate(arg, configuration)); } @Override - public Int32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1743,7 +1742,7 @@ public Int32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1811,7 +1810,7 @@ public static Int64 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1823,7 +1822,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1835,7 +1834,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1846,24 +1845,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1874,15 +1873,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -1906,7 +1905,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1940,7 +1939,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1952,7 +1951,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1967,7 +1966,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1988,31 +1987,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Int64BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedVoid(validate(arg, configuration)); } @Override - public Int64BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedBoolean(validate(arg, configuration)); } @Override - public Int64BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedNumber(validate(arg, configuration)); } @Override - public Int64BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedString(validate(arg, configuration)); } @Override - public Int64BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedList(validate(arg, configuration)); } @Override - public Int64BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedMap(validate(arg, configuration)); } @Override - public Int64Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -2028,7 +2027,7 @@ public Int64Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2096,7 +2095,7 @@ public static DoubleSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2108,7 +2107,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2120,7 +2119,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2131,24 +2130,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2159,15 +2158,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -2191,7 +2190,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2225,7 +2224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2237,7 +2236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -2252,7 +2251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -2273,31 +2272,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DoubleSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedVoid(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedNumber(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedString(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedList(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedMap(validate(arg, configuration)); } @Override - public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -2313,7 +2312,7 @@ public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2381,7 +2380,7 @@ public static FloatSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2393,7 +2392,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2405,7 +2404,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2416,24 +2415,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2444,15 +2443,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -2476,7 +2475,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2510,7 +2509,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2522,7 +2521,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -2537,7 +2536,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -2558,31 +2557,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FloatSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedVoid(validate(arg, configuration)); } @Override - public FloatSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedNumber(validate(arg, configuration)); } @Override - public FloatSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedString(validate(arg, configuration)); } @Override - public FloatSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedList(validate(arg, configuration)); } @Override - public FloatSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedMap(validate(arg, configuration)); } @Override - public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -2598,7 +2597,7 @@ public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2618,7 +2617,7 @@ protected AnyTypeAndFormatMap(FrozenMap<@Nullable Object> m) { "double", "float" ); - public static AnyTypeAndFormatMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AnyTypeAndFormatMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return AnyTypeAndFormat1.getInstance().validate(arg, configuration); } @@ -3302,7 +3301,7 @@ public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem return new AnyTypeAndFormatMap(castProperties); } - public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -3314,11 +3313,11 @@ public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -3328,15 +3327,15 @@ public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyTypeAndFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeAndFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeAndFormat1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeAndFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeAndFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java index 7deece9a944..e9ebdac6dd9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -117,7 +116,7 @@ public static AnyTypeNotString1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,7 +140,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,24 +151,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,15 +179,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -212,7 +211,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -273,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -294,31 +293,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyTypeNotString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedString(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedList(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeNotString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -334,7 +333,7 @@ public AnyTypeNotString1Boxed validateAndBox(@Nullable Object arg, SchemaConfigu } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java index ca9bd15cc64..bf0915b5b2d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -73,7 +72,7 @@ protected ApiResponseMap(FrozenMap<@Nullable Object> m) { "type", "message" ); - public static ApiResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApiResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ApiResponseSchema1.getInstance().validate(arg, configuration); } @@ -249,7 +248,7 @@ public ApiResponseMap getNewInstance(Map arg, List pathToItem, Pat return new ApiResponseMap(castProperties); } - public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -261,11 +260,11 @@ public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -275,15 +274,15 @@ public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApiResponseSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApiResponseSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApiResponseSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApiResponseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApiResponseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java index b72bdffcb0d..9903c1e079c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +65,7 @@ public static Cultivar getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -77,11 +76,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -91,15 +90,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public CultivarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CultivarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new CultivarBoxedString(validate(arg, configuration)); } @Override - public CultivarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CultivarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -139,7 +138,7 @@ public static Origin getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -150,11 +149,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -164,15 +163,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OriginBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OriginBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OriginBoxedString(validate(arg, configuration)); } @Override - public OriginBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OriginBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -186,7 +185,7 @@ protected AppleMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "origin" ); - public static AppleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AppleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Apple1.getInstance().validate(arg, configuration); } @@ -329,7 +328,7 @@ public static Apple1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -362,7 +361,7 @@ public AppleMap getNewInstance(Map arg, List pathToItem, PathToSch return new AppleMap(castProperties); } - public AppleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AppleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -374,13 +373,13 @@ public AppleMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -392,22 +391,22 @@ public AppleMap validate(Map arg, SchemaConfiguration configuration) throw throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Apple1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Apple1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Apple1BoxedVoid(validate(arg, configuration)); } @Override - public Apple1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Apple1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Apple1BoxedMap(validate(arg, configuration)); } @Override - public Apple1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Apple1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java index c6b68cc1026..51f1827adc1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -75,7 +74,7 @@ protected AppleReqMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "mealy" ); - public static AppleReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AppleReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return AppleReq1.getInstance().validate(arg, configuration); } @@ -225,7 +224,7 @@ public AppleReqMap getNewInstance(Map arg, List pathToItem, PathTo return new AppleReqMap(castProperties); } - public AppleReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AppleReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -237,11 +236,11 @@ public AppleReqMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -251,15 +250,15 @@ public AppleReqMap validate(Map arg, SchemaConfiguration configuration) th throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AppleReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AppleReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AppleReq1BoxedMap(validate(arg, configuration)); } @Override - public AppleReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AppleReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java index 35e2c0c6459..f103ccb7b11 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -39,7 +38,7 @@ public static class ArrayHoldingAnyTypeList extends FrozenList<@Nullable Object> protected ArrayHoldingAnyTypeList(FrozenList<@Nullable Object> m) { super(m); } - public static ArrayHoldingAnyTypeList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayHoldingAnyTypeList of(List arg, SchemaConfiguration configuration) throws ValidationException { return ArrayHoldingAnyType1.getInstance().validate(arg, configuration); } } @@ -163,7 +162,7 @@ public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToIt return new ArrayHoldingAnyTypeList(newInstanceItems); } - public ArrayHoldingAnyTypeList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayHoldingAnyTypeList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -174,11 +173,11 @@ public ArrayHoldingAnyTypeList validate(List arg, SchemaConfiguration configu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -188,15 +187,15 @@ public ArrayHoldingAnyTypeList validate(List arg, SchemaConfiguration configu throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayHoldingAnyType1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayHoldingAnyType1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayHoldingAnyType1BoxedList(validate(arg, configuration)); } @Override - public ArrayHoldingAnyType1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayHoldingAnyType1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java index de975fd98ca..65ee5a9b86d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -46,7 +45,7 @@ public static class ItemsList extends FrozenList { protected ItemsList(FrozenList m) { super(m); } - public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { return Items.getInstance().validate(arg, configuration); } } @@ -142,7 +141,7 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche return new ItemsList(newInstanceItems); } - public ItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -153,11 +152,11 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -167,15 +166,15 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedList(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -183,7 +182,7 @@ public static class ArrayArrayNumberList extends FrozenList { protected ArrayArrayNumberList(FrozenList m) { super(m); } - public static ArrayArrayNumberList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayArrayNumberList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return ArrayArrayNumber.getInstance().validate(arg, configuration); } } @@ -264,7 +263,7 @@ public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, return new ArrayArrayNumberList(newInstanceItems); } - public ArrayArrayNumberList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayArrayNumberList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -275,11 +274,11 @@ public ArrayArrayNumberList validate(List arg, SchemaConfiguration configurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -289,15 +288,15 @@ public ArrayArrayNumberList validate(List arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayArrayNumberBoxedList(validate(arg, configuration)); } @Override - public ArrayArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -309,7 +308,7 @@ protected ArrayOfArrayOfNumberOnlyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "ArrayArrayNumber" ); - public static ArrayOfArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayOfArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ArrayOfArrayOfNumberOnly1.getInstance().validate(arg, configuration); } @@ -427,7 +426,7 @@ public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pa return new ArrayOfArrayOfNumberOnlyMap(castProperties); } - public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -439,11 +438,11 @@ public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -453,15 +452,15 @@ public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration c throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayOfArrayOfNumberOnly1BoxedMap(validate(arg, configuration)); } @Override - public ArrayOfArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java index 461ab2b731f..d800ee9917b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -26,7 +25,7 @@ public static class ArrayOfEnumsList extends FrozenList<@Nullable String> { protected ArrayOfEnumsList(FrozenList<@Nullable String> m) { super(m); } - public static ArrayOfEnumsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayOfEnumsList of(List arg, SchemaConfiguration configuration) throws ValidationException { return ArrayOfEnums1.getInstance().validate(arg, configuration); } } @@ -128,7 +127,7 @@ public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, Pat return new ArrayOfEnumsList(newInstanceItems); } - public ArrayOfEnumsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayOfEnumsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -139,11 +138,11 @@ public ArrayOfEnumsList validate(List arg, SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -153,15 +152,15 @@ public ArrayOfEnumsList validate(List arg, SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfEnums1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfEnums1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayOfEnums1BoxedList(validate(arg, configuration)); } @Override - public ArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java index 0d813a49f24..60dbea4de6e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -46,7 +45,7 @@ public static class ArrayNumberList extends FrozenList { protected ArrayNumberList(FrozenList m) { super(m); } - public static ArrayNumberList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayNumberList of(List arg, SchemaConfiguration configuration) throws ValidationException { return ArrayNumber.getInstance().validate(arg, configuration); } } @@ -142,7 +141,7 @@ public ArrayNumberList getNewInstance(List arg, List pathToItem, Path return new ArrayNumberList(newInstanceItems); } - public ArrayNumberList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayNumberList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -153,11 +152,11 @@ public ArrayNumberList validate(List arg, SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -167,15 +166,15 @@ public ArrayNumberList validate(List arg, SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayNumberBoxedList(validate(arg, configuration)); } @Override - public ArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -187,7 +186,7 @@ protected ArrayOfNumberOnlyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "ArrayNumber" ); - public static ArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayOfNumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ArrayOfNumberOnly1.getInstance().validate(arg, configuration); } @@ -305,7 +304,7 @@ public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToIte return new ArrayOfNumberOnlyMap(castProperties); } - public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -317,11 +316,11 @@ public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -331,15 +330,15 @@ public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configur throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayOfNumberOnly1BoxedMap(validate(arg, configuration)); } @Override - public ArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java index 5674237c706..bad14500fe5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -47,7 +46,7 @@ public static class ArrayOfStringList extends FrozenList { protected ArrayOfStringList(FrozenList m) { super(m); } - public static ArrayOfStringList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayOfStringList of(List arg, SchemaConfiguration configuration) throws ValidationException { return ArrayOfString.getInstance().validate(arg, configuration); } } @@ -128,7 +127,7 @@ public ArrayOfStringList getNewInstance(List arg, List pathToItem, Pa return new ArrayOfStringList(newInstanceItems); } - public ArrayOfStringList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayOfStringList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -139,11 +138,11 @@ public ArrayOfStringList validate(List arg, SchemaConfiguration configuration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -153,15 +152,15 @@ public ArrayOfStringList validate(List arg, SchemaConfiguration configuration throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfStringBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfStringBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayOfStringBoxedList(validate(arg, configuration)); } @Override - public ArrayOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -180,7 +179,7 @@ public static class ItemsList extends FrozenList { protected ItemsList(FrozenList m) { super(m); } - public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { return Items1.getInstance().validate(arg, configuration); } } @@ -276,7 +275,7 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche return new ItemsList(newInstanceItems); } - public ItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -287,11 +286,11 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -301,15 +300,15 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Items1BoxedList(validate(arg, configuration)); } @Override - public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -317,7 +316,7 @@ public static class ArrayArrayOfIntegerList extends FrozenList { protected ArrayArrayOfIntegerList(FrozenList m) { super(m); } - public static ArrayArrayOfIntegerList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayArrayOfIntegerList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return ArrayArrayOfInteger.getInstance().validate(arg, configuration); } } @@ -398,7 +397,7 @@ public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToIt return new ArrayArrayOfIntegerList(newInstanceItems); } - public ArrayArrayOfIntegerList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayArrayOfIntegerList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -409,11 +408,11 @@ public ArrayArrayOfIntegerList validate(List arg, SchemaConfiguration configu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -423,15 +422,15 @@ public ArrayArrayOfIntegerList validate(List arg, SchemaConfiguration configu throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayArrayOfIntegerBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayOfIntegerBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayArrayOfIntegerBoxedList(validate(arg, configuration)); } @Override - public ArrayArrayOfIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayOfIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -439,7 +438,7 @@ public static class ItemsList1 extends FrozenList m) { super(m); } - public static ItemsList1 of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ItemsList1 of(List> arg, SchemaConfiguration configuration) throws ValidationException { return Items3.getInstance().validate(arg, configuration); } } @@ -520,7 +519,7 @@ public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSch return new ItemsList1(newInstanceItems); } - public ItemsList1 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ItemsList1 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -531,11 +530,11 @@ public ItemsList1 validate(List arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -545,15 +544,15 @@ public ItemsList1 validate(List arg, SchemaConfiguration configuration) throw throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items3BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items3BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Items3BoxedList(validate(arg, configuration)); } @Override - public Items3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -561,7 +560,7 @@ public static class ArrayArrayOfModelList extends FrozenList { protected ArrayArrayOfModelList(FrozenList m) { super(m); } - public static ArrayArrayOfModelList of(List>> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayArrayOfModelList of(List>> arg, SchemaConfiguration configuration) throws ValidationException { return ArrayArrayOfModel.getInstance().validate(arg, configuration); } } @@ -642,7 +641,7 @@ public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem return new ArrayArrayOfModelList(newInstanceItems); } - public ArrayArrayOfModelList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayArrayOfModelList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -653,11 +652,11 @@ public ArrayArrayOfModelList validate(List arg, SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -667,15 +666,15 @@ public ArrayArrayOfModelList validate(List arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayArrayOfModelBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayOfModelBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayArrayOfModelBoxedList(validate(arg, configuration)); } @Override - public ArrayArrayOfModelBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayOfModelBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -689,7 +688,7 @@ protected ArrayTestMap(FrozenMap<@Nullable Object> m) { "array_array_of_integer", "array_array_of_model" ); - public static ArrayTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ArrayTest1.getInstance().validate(arg, configuration); } @@ -859,7 +858,7 @@ public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathT return new ArrayTestMap(castProperties); } - public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -871,11 +870,11 @@ public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -885,15 +884,15 @@ public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayTest1BoxedMap(validate(arg, configuration)); } @Override - public ArrayTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java index 52a966a767c..c397a603a61 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -60,7 +59,7 @@ public static Items getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -70,28 +69,28 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -101,15 +100,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedNumber(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -117,7 +116,7 @@ public static class ArrayWithValidationsInItemsList extends FrozenList { protected ArrayWithValidationsInItemsList(FrozenList m) { super(m); } - public static ArrayWithValidationsInItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayWithValidationsInItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { return ArrayWithValidationsInItems1.getInstance().validate(arg, configuration); } } @@ -220,7 +219,7 @@ public ArrayWithValidationsInItemsList getNewInstance(List arg, List return new ArrayWithValidationsInItemsList(newInstanceItems); } - public ArrayWithValidationsInItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithValidationsInItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -231,11 +230,11 @@ public ArrayWithValidationsInItemsList validate(List arg, SchemaConfiguration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -245,15 +244,15 @@ public ArrayWithValidationsInItemsList validate(List arg, SchemaConfiguration throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayWithValidationsInItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithValidationsInItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithValidationsInItems1BoxedList(validate(arg, configuration)); } @Override - public ArrayWithValidationsInItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithValidationsInItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java index dddd463f507..f314e9f312f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected BananaMap(FrozenMap<@Nullable Object> m) { "lengthCm" ); public static final Set optionalKeys = Set.of(); - public static BananaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static BananaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Banana1.getInstance().validate(arg, configuration); } @@ -195,7 +194,7 @@ public BananaMap getNewInstance(Map arg, List pathToItem, PathToSc return new BananaMap(castProperties); } - public BananaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BananaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,11 +206,11 @@ public BananaMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -221,15 +220,15 @@ public BananaMap validate(Map arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Banana1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Banana1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Banana1BoxedMap(validate(arg, configuration)); } @Override - public Banana1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Banana1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java index 39ce0a23799..2e7fc44ef1e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -75,7 +74,7 @@ protected BananaReqMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "sweet" ); - public static BananaReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static BananaReqMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return BananaReq1.getInstance().validate(arg, configuration); } @@ -243,7 +242,7 @@ public BananaReqMap getNewInstance(Map arg, List pathToItem, PathT return new BananaReqMap(castProperties); } - public BananaReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BananaReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -255,11 +254,11 @@ public BananaReqMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -269,15 +268,15 @@ public BananaReqMap validate(Map arg, SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BananaReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BananaReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new BananaReq1BoxedMap(validate(arg, configuration)); } @Override - public BananaReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BananaReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java index 0d7d903f99c..e62a21a1d0e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -59,7 +58,7 @@ public static Bar1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -70,11 +69,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -83,22 +82,22 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Bar1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Bar1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Bar1BoxedString(validate(arg, configuration)); } @Override - public Bar1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Bar1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java index 891877224f2..726452e88a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -79,7 +78,7 @@ public static ClassName getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,16 +89,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -109,15 +108,15 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -129,7 +128,7 @@ protected BasquePigMap(FrozenMap<@Nullable Object> m) { "className" ); public static final Set optionalKeys = Set.of(); - public static BasquePigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static BasquePigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return BasquePig1.getInstance().validate(arg, configuration); } @@ -264,7 +263,7 @@ public BasquePigMap getNewInstance(Map arg, List pathToItem, PathT return new BasquePigMap(castProperties); } - public BasquePigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BasquePigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -276,11 +275,11 @@ public BasquePigMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -290,15 +289,15 @@ public BasquePigMap validate(Map arg, SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BasquePig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BasquePig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new BasquePig1BoxedMap(validate(arg, configuration)); } @Override - public BasquePig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BasquePig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java index ac9c596b4da..f9ac16b3542 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator; @@ -73,7 +72,7 @@ public static BooleanEnum1 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -84,17 +83,17 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public boolean validate(BooleanBooleanEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public boolean validate(BooleanBooleanEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -105,16 +104,16 @@ public boolean validate(BooleanBooleanEnumEnums arg,SchemaConfiguration configur throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BooleanEnum1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanEnum1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BooleanEnum1BoxedBoolean(validate(arg, configuration)); } @Override - public BooleanEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java index 4d8c49d8055..b36f13cc0c1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -108,7 +107,7 @@ protected CapitalizationMap(FrozenMap<@Nullable Object> m) { "SCA_ETH_Flow_Points", "ATT_NAME" ); - public static CapitalizationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static CapitalizationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Capitalization1.getInstance().validate(arg, configuration); } @@ -356,7 +355,7 @@ public CapitalizationMap getNewInstance(Map arg, List pathToItem, return new CapitalizationMap(castProperties); } - public CapitalizationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CapitalizationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -368,11 +367,11 @@ public CapitalizationMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -382,15 +381,15 @@ public CapitalizationMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Capitalization1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Capitalization1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Capitalization1BoxedMap(validate(arg, configuration)); } @Override - public Capitalization1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Capitalization1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java index 5e813008bca..1fd40713a14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -57,7 +56,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "declawed" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } @@ -169,7 +168,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -181,11 +180,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -195,15 +194,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -281,7 +280,7 @@ public static Cat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -293,7 +292,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -305,7 +304,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -316,24 +315,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -344,15 +343,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -376,7 +375,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -410,7 +409,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -422,7 +421,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -437,7 +436,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -458,31 +457,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Cat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedVoid(validate(arg, configuration)); } @Override - public Cat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedBoolean(validate(arg, configuration)); } @Override - public Cat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedNumber(validate(arg, configuration)); } @Override - public Cat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedString(validate(arg, configuration)); } @Override - public Cat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedList(validate(arg, configuration)); } @Override - public Cat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedMap(validate(arg, configuration)); } @Override - public Cat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -498,7 +497,7 @@ public Cat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java index 49808839f5c..cd5364ea788 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -75,7 +74,7 @@ public static Name getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,11 +85,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -99,22 +98,22 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public NameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NameBoxedString(validate(arg, configuration)); } @Override - public NameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -128,7 +127,7 @@ protected CategoryMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "id" ); - public static CategoryMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static CategoryMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Category1.getInstance().validate(arg, configuration); } @@ -301,7 +300,7 @@ public CategoryMap getNewInstance(Map arg, List pathToItem, PathTo return new CategoryMap(castProperties); } - public CategoryMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CategoryMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,11 +312,11 @@ public CategoryMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -327,15 +326,15 @@ public CategoryMap validate(Map arg, SchemaConfiguration configuration) th throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Category1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Category1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Category1BoxedMap(validate(arg, configuration)); } @Override - public Category1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Category1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java index 08bda08e4a3..2b56cafb84b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "name" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } @@ -169,7 +168,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -181,11 +180,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -195,15 +194,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -281,7 +280,7 @@ public static ChildCat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -293,7 +292,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -305,7 +304,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -316,24 +315,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -344,15 +343,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -376,7 +375,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -410,7 +409,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -422,7 +421,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -437,7 +436,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -458,31 +457,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ChildCat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedVoid(validate(arg, configuration)); } @Override - public ChildCat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedBoolean(validate(arg, configuration)); } @Override - public ChildCat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedNumber(validate(arg, configuration)); } @Override - public ChildCat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedString(validate(arg, configuration)); } @Override - public ChildCat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedList(validate(arg, configuration)); } @Override - public ChildCat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedMap(validate(arg, configuration)); } @Override - public ChildCat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -498,7 +497,7 @@ public ChildCat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java index b157d6b0b06..21aab6cfc14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ protected ClassModelMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "_class" ); - public static ClassModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ClassModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ClassModel1.getInstance().validate(arg, configuration); } @@ -179,7 +178,7 @@ public static ClassModel1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,7 +190,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +202,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,24 +213,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,15 +241,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -274,7 +273,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -308,7 +307,7 @@ public ClassModelMap getNewInstance(Map arg, List pathToItem, Path return new ClassModelMap(castProperties); } - public ClassModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -320,7 +319,7 @@ public ClassModelMap validate(Map arg, SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -335,7 +334,7 @@ public ClassModelMap validate(Map arg, SchemaConfiguration configuration) } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -356,31 +355,31 @@ public ClassModelMap validate(Map arg, SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassModel1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedVoid(validate(arg, configuration)); } @Override - public ClassModel1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedBoolean(validate(arg, configuration)); } @Override - public ClassModel1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedNumber(validate(arg, configuration)); } @Override - public ClassModel1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedString(validate(arg, configuration)); } @Override - public ClassModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedList(validate(arg, configuration)); } @Override - public ClassModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedMap(validate(arg, configuration)); } @Override - public ClassModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -396,7 +395,7 @@ public ClassModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java index 1cda33382cb..3585bd08508 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected ClientMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "client" ); - public static ClientMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ClientMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Client1.getInstance().validate(arg, configuration); } @@ -166,7 +165,7 @@ public ClientMap getNewInstance(Map arg, List pathToItem, PathToSc return new ClientMap(castProperties); } - public ClientMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClientMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -178,11 +177,11 @@ public ClientMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -192,15 +191,15 @@ public ClientMap validate(Map arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Client1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Client1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Client1BoxedMap(validate(arg, configuration)); } @Override - public Client1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Client1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java index 9ec6d3ebfd5..0f19e634466 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -87,7 +86,7 @@ public static QuadrilateralType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,16 +97,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -117,15 +116,15 @@ public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration conf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralTypeBoxedString(validate(arg, configuration)); } @Override - public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -137,7 +136,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "quadrilateralType" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } @@ -255,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,11 +266,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -281,15 +280,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -367,7 +366,7 @@ public static ComplexQuadrilateral1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -391,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,15 +429,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -462,7 +461,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -508,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -523,7 +522,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -544,31 +543,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComplexQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedVoid(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedBoolean(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedNumber(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedString(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedList(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedMap(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -584,7 +583,7 @@ public ComplexQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java index d032063edf1..d8a18a9d2f4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -163,7 +162,7 @@ public static class Schema9List extends FrozenList<@Nullable Object> { protected Schema9List(FrozenList<@Nullable Object> m) { super(m); } - public static Schema9List of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema9List of(List arg, SchemaConfiguration configuration) throws ValidationException { return Schema9.getInstance().validate(arg, configuration); } } @@ -281,7 +280,7 @@ public Schema9List getNewInstance(List arg, List pathToItem, PathToSc return new Schema9List(newInstanceItems); } - public Schema9List validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public Schema9List validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -292,11 +291,11 @@ public Schema9List validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -306,15 +305,15 @@ public Schema9List validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema9BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema9BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema9BoxedList(validate(arg, configuration)); } @Override - public Schema9Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema9Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -471,7 +470,7 @@ public static ComposedAnyOfDifferentTypesNoValidations1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -483,7 +482,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -495,7 +494,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -506,24 +505,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -534,15 +533,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -566,7 +565,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -600,7 +599,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -612,7 +611,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -627,7 +626,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -648,31 +647,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedVoid(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedNumber(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedString(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedList(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedMap(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -688,7 +687,7 @@ public ComposedAnyOfDifferentTypesNoValidations1Boxed validateAndBox(@Nullable O } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java index 4f5db51dc33..71fd76caa3d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -39,7 +38,7 @@ public static class ComposedArrayList extends FrozenList<@Nullable Object> { protected ComposedArrayList(FrozenList<@Nullable Object> m) { super(m); } - public static ComposedArrayList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ComposedArrayList of(List arg, SchemaConfiguration configuration) throws ValidationException { return ComposedArray1.getInstance().validate(arg, configuration); } } @@ -163,7 +162,7 @@ public ComposedArrayList getNewInstance(List arg, List pathToItem, Pa return new ComposedArrayList(newInstanceItems); } - public ComposedArrayList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ComposedArrayList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -174,11 +173,11 @@ public ComposedArrayList validate(List arg, SchemaConfiguration configuration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -188,15 +187,15 @@ public ComposedArrayList validate(List arg, SchemaConfiguration configuration throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedArray1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedArray1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedArray1BoxedList(validate(arg, configuration)); } @Override - public ComposedArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java index 2f0997f4620..7f34004555f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; @@ -70,7 +69,7 @@ public static ComposedBool1 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -81,12 +80,12 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -97,16 +96,16 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedBool1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedBool1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedBool1BoxedBoolean(validate(arg, configuration)); } @Override - public ComposedBool1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedBool1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java index 7c4d610c4c9..78930744e81 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -70,7 +69,7 @@ public static ComposedNone1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -81,11 +80,11 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -95,16 +94,16 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedNone1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedNone1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedNone1BoxedVoid(validate(arg, configuration)); } @Override - public ComposedNone1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedNone1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java index 581d261821c..ef87afd4d8d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -75,7 +74,7 @@ public static ComposedNumber1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -85,28 +84,28 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -116,15 +115,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedNumber1BoxedNumber(validate(arg, configuration)); } @Override - public ComposedNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java index 41d5395ee3f..9bfd1ae80f8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -98,7 +97,7 @@ public static ComposedObject1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -110,11 +109,11 @@ public static ComposedObject1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -124,15 +123,15 @@ public static ComposedObject1 getInstance() { throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedObject1BoxedMap(validate(arg, configuration)); } @Override - public ComposedObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java index cf020558a2e..44bb609f46b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -114,7 +113,7 @@ public static Schema4 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -126,11 +125,11 @@ public static Schema4 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -140,15 +139,15 @@ public static Schema4 getInstance() { throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema4BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema4BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema4BoxedMap(validate(arg, configuration)); } @Override - public Schema4Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema4Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -168,7 +167,7 @@ public static class Schema5List extends FrozenList<@Nullable Object> { protected Schema5List(FrozenList<@Nullable Object> m) { super(m); } - public static Schema5List of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema5List of(List arg, SchemaConfiguration configuration) throws ValidationException { return Schema5.getInstance().validate(arg, configuration); } } @@ -288,7 +287,7 @@ public Schema5List getNewInstance(List arg, List pathToItem, PathToSc return new Schema5List(newInstanceItems); } - public Schema5List validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public Schema5List validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -299,11 +298,11 @@ public Schema5List validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -313,15 +312,15 @@ public Schema5List validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema5BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema5BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema5BoxedList(validate(arg, configuration)); } @Override - public Schema5Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema5Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -361,7 +360,7 @@ public static Schema6 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -372,11 +371,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -386,15 +385,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema6BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema6BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema6BoxedString(validate(arg, configuration)); } @Override - public Schema6Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema6Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -478,7 +477,7 @@ public static ComposedOneOfDifferentTypes1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -490,7 +489,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -502,7 +501,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -513,24 +512,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -541,15 +540,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -573,7 +572,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -607,7 +606,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -619,7 +618,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -634,7 +633,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -655,31 +654,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedOneOfDifferentTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedVoid(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedBoolean(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedNumber(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedString(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedList(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedMap(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -695,7 +694,7 @@ public ComposedOneOfDifferentTypes1Boxed validateAndBox(@Nullable Object arg, Sc } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java index 2a8ed2ceac4..6128d4db5d2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -72,7 +71,7 @@ public static ComposedString1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -83,11 +82,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -97,15 +96,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedString1BoxedString(validate(arg, configuration)); } @Override - public ComposedString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java index 0ba5c778f44..7fd6478f0c7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -77,7 +76,7 @@ public static Currency1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -88,16 +87,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringCurrencyEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringCurrencyEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -107,15 +106,15 @@ public String validate(StringCurrencyEnums arg,SchemaConfiguration configuration throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Currency1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Currency1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Currency1BoxedString(validate(arg, configuration)); } @Override - public Currency1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Currency1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java index ccd04ccd803..0c514e9658f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -79,7 +78,7 @@ public static ClassName getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,16 +89,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -109,15 +108,15 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -129,7 +128,7 @@ protected DanishPigMap(FrozenMap<@Nullable Object> m) { "className" ); public static final Set optionalKeys = Set.of(); - public static DanishPigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static DanishPigMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return DanishPig1.getInstance().validate(arg, configuration); } @@ -264,7 +263,7 @@ public DanishPigMap getNewInstance(Map arg, List pathToItem, PathT return new DanishPigMap(castProperties); } - public DanishPigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DanishPigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -276,11 +275,11 @@ public DanishPigMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -290,15 +289,15 @@ public DanishPigMap validate(Map arg, SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DanishPig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DanishPig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DanishPig1BoxedMap(validate(arg, configuration)); } @Override - public DanishPig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DanishPig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java index ad98a2f123d..bfb26b9a3b0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -61,7 +60,7 @@ public static DateTimeTest1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -72,11 +71,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -85,22 +84,22 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public DateTimeTest1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeTest1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeTest1BoxedString(validate(arg, configuration)); } @Override - public DateTimeTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java index 7046ade7c92..85d0db19fd4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -63,7 +62,7 @@ public static DateTimeWithValidations1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -74,11 +73,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -88,15 +87,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateTimeWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeWithValidations1BoxedString(validate(arg, configuration)); } @Override - public DateTimeWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java index 4e2804bbd3b..0f023d66745 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -63,7 +62,7 @@ public static DateWithValidations1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -74,11 +73,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -88,15 +87,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateWithValidations1BoxedString(validate(arg, configuration)); } @Override - public DateWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java index 229f39974a7..26d207218d2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "breed" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } @@ -169,7 +168,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -181,11 +180,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -195,15 +194,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -281,7 +280,7 @@ public static Dog1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -293,7 +292,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -305,7 +304,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -316,24 +315,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -344,15 +343,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -376,7 +375,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -410,7 +409,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -422,7 +421,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -437,7 +436,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -458,31 +457,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Dog1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedVoid(validate(arg, configuration)); } @Override - public Dog1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedBoolean(validate(arg, configuration)); } @Override - public Dog1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedNumber(validate(arg, configuration)); } @Override - public Dog1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedString(validate(arg, configuration)); } @Override - public Dog1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedList(validate(arg, configuration)); } @Override - public Dog1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedMap(validate(arg, configuration)); } @Override - public Dog1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -498,7 +497,7 @@ public Dog1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java index b0da09c8066..d243bcfc3b9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -34,7 +33,7 @@ public static class ShapesList extends FrozenList<@Nullable Object> { protected ShapesList(FrozenList<@Nullable Object> m) { super(m); } - public static ShapesList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ShapesList of(List arg, SchemaConfiguration configuration) throws ValidationException { return Shapes.getInstance().validate(arg, configuration); } } @@ -155,7 +154,7 @@ public ShapesList getNewInstance(List arg, List pathToItem, PathToSch return new ShapesList(newInstanceItems); } - public ShapesList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ShapesList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -166,11 +165,11 @@ public ShapesList validate(List arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -180,15 +179,15 @@ public ShapesList validate(List arg, SchemaConfiguration configuration) throw throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ShapesBoxedList(validate(arg, configuration)); } @Override - public ShapesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -203,7 +202,7 @@ protected DrawingMap(FrozenMap<@Nullable Object> m) { "nullableShape", "shapes" ); - public static DrawingMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static DrawingMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Drawing1.getInstance().validate(arg, configuration); } @@ -616,7 +615,7 @@ public DrawingMap getNewInstance(Map arg, List pathToItem, PathToS return new DrawingMap(castProperties); } - public DrawingMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DrawingMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -628,11 +627,11 @@ public DrawingMap validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -642,15 +641,15 @@ public DrawingMap validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Drawing1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Drawing1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Drawing1BoxedMap(validate(arg, configuration)); } @Override - public Drawing1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Drawing1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java index c073d1d2e8a..073d51bc36f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -83,7 +82,7 @@ public static JustSymbol getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -94,16 +93,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringJustSymbolEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringJustSymbolEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -113,15 +112,15 @@ public String validate(StringJustSymbolEnums arg,SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JustSymbolBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JustSymbolBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new JustSymbolBoxedString(validate(arg, configuration)); } @Override - public JustSymbolBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JustSymbolBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringItemsEnums implements StringValueMethod { @@ -174,7 +173,7 @@ public static Items getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,16 +184,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringItemsEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringItemsEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -204,15 +203,15 @@ public String validate(StringItemsEnums arg,SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedString(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -220,7 +219,7 @@ public static class ArrayEnumList extends FrozenList { protected ArrayEnumList(FrozenList m) { super(m); } - public static ArrayEnumList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayEnumList of(List arg, SchemaConfiguration configuration) throws ValidationException { return ArrayEnum.getInstance().validate(arg, configuration); } } @@ -306,7 +305,7 @@ public ArrayEnumList getNewInstance(List arg, List pathToItem, PathTo return new ArrayEnumList(newInstanceItems); } - public ArrayEnumList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayEnumList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -317,11 +316,11 @@ public ArrayEnumList validate(List arg, SchemaConfiguration configuration) th } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -331,15 +330,15 @@ public ArrayEnumList validate(List arg, SchemaConfiguration configuration) th throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayEnumBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayEnumBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayEnumBoxedList(validate(arg, configuration)); } @Override - public ArrayEnumBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayEnumBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -352,7 +351,7 @@ protected EnumArraysMap(FrozenMap<@Nullable Object> m) { "just_symbol", "array_enum" ); - public static EnumArraysMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static EnumArraysMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return EnumArrays1.getInstance().validate(arg, configuration); } @@ -502,7 +501,7 @@ public EnumArraysMap getNewInstance(Map arg, List pathToItem, Path return new EnumArraysMap(castProperties); } - public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -514,11 +513,11 @@ public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -528,15 +527,15 @@ public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumArrays1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumArrays1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EnumArrays1BoxedMap(validate(arg, configuration)); } @Override - public EnumArrays1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumArrays1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java index dd316d9cb74..f757027a167 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -85,7 +84,7 @@ public static EnumClass1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -96,16 +95,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringEnumClassEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringEnumClassEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -114,22 +113,22 @@ public String validate(StringEnumClassEnums arg,SchemaConfiguration configuratio } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public EnumClass1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumClass1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EnumClass1BoxedString(validate(arg, configuration)); } @Override - public EnumClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java index dbf9166af8f..57432f3a3d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -93,7 +92,7 @@ public static EnumString getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -104,16 +103,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringEnumStringEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringEnumStringEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -123,15 +122,15 @@ public String validate(StringEnumStringEnums arg,SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EnumStringBoxedString(validate(arg, configuration)); } @Override - public EnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringEnumStringRequiredEnums implements StringValueMethod { @@ -186,7 +185,7 @@ public static EnumStringRequired getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,16 +196,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringEnumStringRequiredEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringEnumStringRequiredEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -216,15 +215,15 @@ public String validate(StringEnumStringRequiredEnums arg,SchemaConfiguration con throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumStringRequiredBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumStringRequiredBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EnumStringRequiredBoxedString(validate(arg, configuration)); } @Override - public EnumStringRequiredBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumStringRequiredBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum IntegerEnumIntegerEnums implements IntegerValueMethod { @@ -320,7 +319,7 @@ public static EnumInteger getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -330,40 +329,40 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @Override - public int validate(IntegerEnumIntegerEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public int validate(IntegerEnumIntegerEnums arg,SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongEnumIntegerEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public long validate(LongEnumIntegerEnums arg,SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatEnumIntegerEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public float validate(FloatEnumIntegerEnums arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleEnumIntegerEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public double validate(DoubleEnumIntegerEnums arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -373,15 +372,15 @@ public double validate(DoubleEnumIntegerEnums arg,SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EnumIntegerBoxedNumber(validate(arg, configuration)); } @Override - public EnumIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum DoubleEnumNumberEnums implements DoubleValueMethod { @@ -451,7 +450,7 @@ public static EnumNumber getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -460,26 +459,26 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public float validate(FloatEnumNumberEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public float validate(FloatEnumNumberEnums arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleEnumNumberEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public double validate(DoubleEnumNumberEnums arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -489,15 +488,15 @@ public double validate(DoubleEnumNumberEnums arg,SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EnumNumberBoxedNumber(validate(arg, configuration)); } @Override - public EnumNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -518,7 +517,7 @@ protected EnumTestMap(FrozenMap<@Nullable Object> m) { "IntegerEnumWithDefaultValue", "IntegerEnumOneValue" ); - public static EnumTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static EnumTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return EnumTest1.getInstance().validate(arg, configuration); } @@ -1077,7 +1076,7 @@ public EnumTestMap getNewInstance(Map arg, List pathToItem, PathTo return new EnumTestMap(castProperties); } - public EnumTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1089,11 +1088,11 @@ public EnumTestMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1103,15 +1102,15 @@ public EnumTestMap validate(Map arg, SchemaConfiguration configuration) th throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EnumTest1BoxedMap(validate(arg, configuration)); } @Override - public EnumTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java index 46b67f0331b..fa4cfdf5976 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -87,7 +86,7 @@ public static TriangleType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,16 +97,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -117,15 +116,15 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleTypeBoxedString(validate(arg, configuration)); } @Override - public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -137,7 +136,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "triangleType" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } @@ -255,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,11 +266,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -281,15 +280,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -367,7 +366,7 @@ public static EquilateralTriangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -391,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,15 +429,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -462,7 +461,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -508,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -523,7 +522,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -544,31 +543,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EquilateralTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedVoid(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedBoolean(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedNumber(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedString(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedList(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedMap(validate(arg, configuration)); } @Override - public EquilateralTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -584,7 +583,7 @@ public EquilateralTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java index ed5e7ee69d3..d91798f4e93 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected FileMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "sourceURI" ); - public static FileMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static FileMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return File1.getInstance().validate(arg, configuration); } @@ -168,7 +167,7 @@ public FileMap getNewInstance(Map arg, List pathToItem, PathToSche return new FileMap(castProperties); } - public FileMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FileMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,11 +179,11 @@ public FileMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -194,15 +193,15 @@ public FileMap validate(Map arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public File1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public File1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new File1BoxedMap(validate(arg, configuration)); } @Override - public File1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public File1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java index c2bc5aba341..8a07f63e2b0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -34,7 +33,7 @@ public static class FilesList extends FrozenList { protected FilesList(FrozenList m) { super(m); } - public static FilesList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static FilesList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return Files.getInstance().validate(arg, configuration); } } @@ -115,7 +114,7 @@ public FilesList getNewInstance(List arg, List pathToItem, PathToSche return new FilesList(newInstanceItems); } - public FilesList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FilesList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -126,11 +125,11 @@ public FilesList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -140,15 +139,15 @@ public FilesList validate(List arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new FilesBoxedList(validate(arg, configuration)); } @Override - public FilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -161,7 +160,7 @@ protected FileSchemaTestClassMap(FrozenMap<@Nullable Object> m) { "file", "files" ); - public static FileSchemaTestClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static FileSchemaTestClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return FileSchemaTestClass1.getInstance().validate(arg, configuration); } @@ -305,7 +304,7 @@ public FileSchemaTestClassMap getNewInstance(Map arg, List pathToI return new FileSchemaTestClassMap(castProperties); } - public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -317,11 +316,11 @@ public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration config @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -331,15 +330,15 @@ public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration config throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FileSchemaTestClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FileSchemaTestClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FileSchemaTestClass1BoxedMap(validate(arg, configuration)); } @Override - public FileSchemaTestClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FileSchemaTestClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java index 2bc01a01ea5..5a2618fb230 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -36,7 +35,7 @@ protected FooMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "bar" ); - public static FooMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static FooMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Foo1.getInstance().validate(arg, configuration); } @@ -154,7 +153,7 @@ public FooMap getNewInstance(Map arg, List pathToItem, PathToSchem return new FooMap(castProperties); } - public FooMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -166,11 +165,11 @@ public FooMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -180,15 +179,15 @@ public FooMap validate(Map arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Foo1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Foo1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Foo1BoxedMap(validate(arg, configuration)); } @Override - public Foo1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Foo1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java index bbf28d75c60..bf716753fe8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DateJsonSchema; @@ -83,7 +82,7 @@ public static IntegerSchema getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -93,28 +92,28 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -124,15 +123,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerSchemaBoxedNumber(validate(arg, configuration)); } @Override - public IntegerSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -185,7 +184,7 @@ public static Int32withValidations getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,20 +194,20 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -218,15 +217,15 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Int32withValidationsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32withValidationsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int32withValidationsBoxedNumber(validate(arg, configuration)); } @Override - public Int32withValidationsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32withValidationsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -279,7 +278,7 @@ public static NumberSchema getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -289,28 +288,28 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -320,15 +319,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedNumber(validate(arg, configuration)); } @Override - public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -370,7 +369,7 @@ public static FloatSchema getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,16 +378,16 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -398,15 +397,15 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedNumber(validate(arg, configuration)); } @Override - public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -459,7 +458,7 @@ public static DoubleSchema getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -468,16 +467,16 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -487,15 +486,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedNumber(validate(arg, configuration)); } @Override - public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -525,7 +524,7 @@ public static class ArrayWithUniqueItemsList extends FrozenList { protected ArrayWithUniqueItemsList(FrozenList m) { super(m); } - public static ArrayWithUniqueItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayWithUniqueItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { return ArrayWithUniqueItems.getInstance().validate(arg, configuration); } } @@ -622,7 +621,7 @@ public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToI return new ArrayWithUniqueItemsList(newInstanceItems); } - public ArrayWithUniqueItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithUniqueItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -633,11 +632,11 @@ public ArrayWithUniqueItemsList validate(List arg, SchemaConfiguration config } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -647,15 +646,15 @@ public ArrayWithUniqueItemsList validate(List arg, SchemaConfiguration config throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayWithUniqueItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithUniqueItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithUniqueItemsBoxedList(validate(arg, configuration)); } @Override - public ArrayWithUniqueItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithUniqueItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -695,7 +694,7 @@ public static StringSchema getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -706,11 +705,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -720,15 +719,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringSchemaBoxedString(validate(arg, configuration)); } @Override - public StringSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -834,7 +833,7 @@ public static Password getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -845,11 +844,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -859,15 +858,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PasswordBoxedString(validate(arg, configuration)); } @Override - public PasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -906,7 +905,7 @@ public static PatternWithDigits getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -917,11 +916,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -931,15 +930,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternWithDigitsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternWithDigitsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PatternWithDigitsBoxedString(validate(arg, configuration)); } @Override - public PatternWithDigitsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternWithDigitsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -979,7 +978,7 @@ public static PatternWithDigitsAndDelimiter getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -990,11 +989,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1004,15 +1003,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternWithDigitsAndDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternWithDigitsAndDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PatternWithDigitsAndDelimiterBoxedString(validate(arg, configuration)); } @Override - public PatternWithDigitsAndDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternWithDigitsAndDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1056,7 +1055,7 @@ protected FormatTestMap(FrozenMap<@Nullable Object> m) { "pattern_with_digits_and_delimiter", "noneProp" ); - public static FormatTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static FormatTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return FormatTest1.getInstance().validate(arg, configuration); } @@ -1998,7 +1997,7 @@ public FormatTestMap getNewInstance(Map arg, List pathToItem, Path return new FormatTestMap(castProperties); } - public FormatTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FormatTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2010,11 +2009,11 @@ public FormatTestMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -2024,15 +2023,15 @@ public FormatTestMap validate(Map arg, SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FormatTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FormatTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FormatTest1BoxedMap(validate(arg, configuration)); } @Override - public FormatTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FormatTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java index c1dafe2d7aa..b708fa92058 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -61,7 +60,7 @@ protected FromSchemaMap(FrozenMap<@Nullable Object> m) { "data", "id" ); - public static FromSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static FromSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return FromSchema1.getInstance().validate(arg, configuration); } @@ -223,7 +222,7 @@ public FromSchemaMap getNewInstance(Map arg, List pathToItem, Path return new FromSchemaMap(castProperties); } - public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,11 +234,11 @@ public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -249,15 +248,15 @@ public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FromSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FromSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FromSchema1BoxedMap(validate(arg, configuration)); } @Override - public FromSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FromSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java index db2854cd464..7c50a1c4e59 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ protected FruitMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "color" ); - public static FruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static FruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Fruit1.getInstance().validate(arg, configuration); } @@ -191,7 +190,7 @@ public static Fruit1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +202,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,7 +214,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -226,24 +225,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,15 +253,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -286,7 +285,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -320,7 +319,7 @@ public FruitMap getNewInstance(Map arg, List pathToItem, PathToSch return new FruitMap(castProperties); } - public FruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -332,7 +331,7 @@ public FruitMap validate(Map arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -347,7 +346,7 @@ public FruitMap validate(Map arg, SchemaConfiguration configuration) throw } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -368,31 +367,31 @@ public FruitMap validate(Map arg, SchemaConfiguration configuration) throw throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Fruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedVoid(validate(arg, configuration)); } @Override - public Fruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedBoolean(validate(arg, configuration)); } @Override - public Fruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedNumber(validate(arg, configuration)); } @Override - public Fruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedString(validate(arg, configuration)); } @Override - public Fruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedList(validate(arg, configuration)); } @Override - public Fruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedMap(validate(arg, configuration)); } @Override - public Fruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -408,7 +407,7 @@ public Fruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java index bbc0144e6e7..fccdffed6f0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -121,7 +120,7 @@ public static FruitReq1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -133,7 +132,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -145,7 +144,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,24 +155,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,15 +183,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -250,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -262,7 +261,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -277,7 +276,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -298,31 +297,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FruitReq1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedVoid(validate(arg, configuration)); } @Override - public FruitReq1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedBoolean(validate(arg, configuration)); } @Override - public FruitReq1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedNumber(validate(arg, configuration)); } @Override - public FruitReq1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedString(validate(arg, configuration)); } @Override - public FruitReq1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedList(validate(arg, configuration)); } @Override - public FruitReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedMap(validate(arg, configuration)); } @Override - public FruitReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -338,7 +337,7 @@ public FruitReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java index e072bf3b0a2..4ad2cc51e1f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ protected GmFruitMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "color" ); - public static GmFruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static GmFruitMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return GmFruit1.getInstance().validate(arg, configuration); } @@ -191,7 +190,7 @@ public static GmFruit1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +202,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,7 +214,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -226,24 +225,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,15 +253,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -286,7 +285,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -320,7 +319,7 @@ public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToS return new GmFruitMap(castProperties); } - public GmFruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -332,7 +331,7 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -347,7 +346,7 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -368,31 +367,31 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public GmFruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedVoid(validate(arg, configuration)); } @Override - public GmFruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedBoolean(validate(arg, configuration)); } @Override - public GmFruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedNumber(validate(arg, configuration)); } @Override - public GmFruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedString(validate(arg, configuration)); } @Override - public GmFruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedList(validate(arg, configuration)); } @Override - public GmFruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedMap(validate(arg, configuration)); } @Override - public GmFruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -408,7 +407,7 @@ public GmFruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java index 2cb68aa124e..bdc5b75784b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected GrandparentAnimalMap(FrozenMap<@Nullable Object> m) { "pet_type" ); public static final Set optionalKeys = Set.of(); - public static GrandparentAnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static GrandparentAnimalMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return GrandparentAnimal1.getInstance().validate(arg, configuration); } @@ -177,7 +176,7 @@ public GrandparentAnimalMap getNewInstance(Map arg, List pathToIte return new GrandparentAnimalMap(castProperties); } - public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,11 +188,11 @@ public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -203,15 +202,15 @@ public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configur throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public GrandparentAnimal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GrandparentAnimal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new GrandparentAnimal1BoxedMap(validate(arg, configuration)); } @Override - public GrandparentAnimal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GrandparentAnimal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java index 4f718683c66..3e7968f1b15 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -60,7 +59,7 @@ protected HasOnlyReadOnlyMap(FrozenMap<@Nullable Object> m) { "bar", "foo" ); - public static HasOnlyReadOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static HasOnlyReadOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return HasOnlyReadOnly1.getInstance().validate(arg, configuration); } @@ -204,7 +203,7 @@ public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, return new HasOnlyReadOnlyMap(castProperties); } - public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,11 +215,11 @@ public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -230,15 +229,15 @@ public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HasOnlyReadOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HasOnlyReadOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HasOnlyReadOnly1BoxedMap(validate(arg, configuration)); } @Override - public HasOnlyReadOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HasOnlyReadOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java index 68c23c758f9..b90d71cfee4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -70,7 +69,7 @@ public static NullableMessage getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -81,7 +80,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -92,13 +91,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -110,22 +109,22 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableMessageBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableMessageBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NullableMessageBoxedVoid(validate(arg, configuration)); } @Override - public NullableMessageBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableMessageBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NullableMessageBoxedString(validate(arg, configuration)); } @Override - public NullableMessageBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableMessageBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -137,7 +136,7 @@ protected HealthCheckResultMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "NullableMessage" ); - public static HealthCheckResultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static HealthCheckResultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return HealthCheckResult1.getInstance().validate(arg, configuration); } @@ -263,7 +262,7 @@ public HealthCheckResultMap getNewInstance(Map arg, List pathToIte return new HealthCheckResultMap(castProperties); } - public HealthCheckResultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HealthCheckResultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -275,11 +274,11 @@ public HealthCheckResultMap validate(Map arg, SchemaConfiguration configur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -289,15 +288,15 @@ public HealthCheckResultMap validate(Map arg, SchemaConfiguration configur throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HealthCheckResult1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HealthCheckResult1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HealthCheckResult1BoxedMap(validate(arg, configuration)); } @Override - public HealthCheckResult1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HealthCheckResult1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java index 784f40a5be1..3a76754f403 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -132,7 +131,7 @@ public static IntegerEnum1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,48 +141,48 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerIntegerEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public int validate(IntegerIntegerEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongIntegerEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public long validate(LongIntegerEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatIntegerEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public float validate(FloatIntegerEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleIntegerEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public double validate(DoubleIntegerEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -193,15 +192,15 @@ public double validate(DoubleIntegerEnumEnums arg,SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnum1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnum1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerEnum1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java index ddedc296947..5d67f71f851 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -132,7 +131,7 @@ public static IntegerEnumBig1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,48 +141,48 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public int validate(IntegerIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public long validate(LongIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public float validate(FloatIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public double validate(DoubleIntegerEnumBigEnums arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -193,15 +192,15 @@ public double validate(DoubleIntegerEnumBigEnums arg,SchemaConfiguration configu throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnumBig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumBig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerEnumBig1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnumBig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumBig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java index 2568448921f..c5618e31d67 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -122,7 +121,7 @@ public static IntegerEnumOneValue1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,48 +131,48 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public int validate(IntegerIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public long validate(LongIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public float validate(FloatIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public double validate(DoubleIntegerEnumOneValueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -183,15 +182,15 @@ public double validate(DoubleIntegerEnumOneValueEnums arg,SchemaConfiguration co throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnumOneValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumOneValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerEnumOneValue1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnumOneValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumOneValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java index eab8a6c8b01..ad176b517e1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -134,7 +133,7 @@ public static IntegerEnumWithDefaultValue1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,48 +143,48 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public int validate(IntegerIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public long validate(LongIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public float validate(FloatIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public double validate(DoubleIntegerEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -195,15 +194,15 @@ public double validate(DoubleIntegerEnumWithDefaultValueEnums arg,SchemaConfigur throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnumWithDefaultValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumWithDefaultValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerEnumWithDefaultValue1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java index 83d95c760ab..d5382218276 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -62,7 +61,7 @@ public static IntegerMax101 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -72,28 +71,28 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -103,15 +102,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerMax101BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerMax101BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerMax101BoxedNumber(validate(arg, configuration)); } @Override - public IntegerMax101Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerMax101Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java index 7ef094ddb67..551489c98f8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -62,7 +61,7 @@ public static IntegerMin151 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -72,28 +71,28 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -103,15 +102,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerMin151BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerMin151BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerMin151BoxedNumber(validate(arg, configuration)); } @Override - public IntegerMin151Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerMin151Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java index 07d966a166c..01a61a254d0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -87,7 +86,7 @@ public static TriangleType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,16 +97,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -117,15 +116,15 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleTypeBoxedString(validate(arg, configuration)); } @Override - public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -137,7 +136,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "triangleType" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } @@ -255,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,11 +266,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -281,15 +280,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -367,7 +366,7 @@ public static IsoscelesTriangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -391,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,15 +429,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -462,7 +461,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -508,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -523,7 +522,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -544,31 +543,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IsoscelesTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedVoid(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedBoolean(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedNumber(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedString(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedList(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedMap(validate(arg, configuration)); } @Override - public IsoscelesTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -584,7 +583,7 @@ public IsoscelesTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java index 31bda2924b6..99f46b05498 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -40,7 +39,7 @@ public static class ItemsList extends FrozenList> { protected ItemsList(FrozenList> m) { super(m); } - public static ItemsList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ItemsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return Items1.getInstance().validate(arg, configuration); } } @@ -129,7 +128,7 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche return new ItemsList(newInstanceItems); } - public ItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,11 +139,11 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -154,15 +153,15 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Items1BoxedList(validate(arg, configuration)); } @Override - public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java index f461275f948..29a37d97892 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -103,7 +102,7 @@ public static Items getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -115,7 +114,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -127,7 +126,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -138,24 +137,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -166,15 +165,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -198,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -244,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -259,7 +258,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -280,31 +279,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedVoid(validate(arg, configuration)); } @Override - public ItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedBoolean(validate(arg, configuration)); } @Override - public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedNumber(validate(arg, configuration)); } @Override - public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedString(validate(arg, configuration)); } @Override - public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedList(validate(arg, configuration)); } @Override - public ItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedMap(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -320,7 +319,7 @@ public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -328,7 +327,7 @@ public static class JSONPatchRequestList extends FrozenList<@Nullable Object> { protected JSONPatchRequestList(FrozenList<@Nullable Object> m) { super(m); } - public static JSONPatchRequestList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static JSONPatchRequestList of(List arg, SchemaConfiguration configuration) throws ValidationException { return JSONPatchRequest1.getInstance().validate(arg, configuration); } } @@ -452,7 +451,7 @@ public JSONPatchRequestList getNewInstance(List arg, List pathToItem, return new JSONPatchRequestList(newInstanceItems); } - public JSONPatchRequestList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public JSONPatchRequestList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -463,11 +462,11 @@ public JSONPatchRequestList validate(List arg, SchemaConfiguration configurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -477,15 +476,15 @@ public JSONPatchRequestList validate(List arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequest1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequest1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new JSONPatchRequest1BoxedList(validate(arg, configuration)); } @Override - public JSONPatchRequest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java index db08d3af4b0..9e4766a2553 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -119,7 +118,7 @@ public static Op getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,16 +129,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -149,15 +148,15 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OpBoxedString(validate(arg, configuration)); } @Override - public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -171,7 +170,7 @@ protected JSONPatchRequestAddReplaceTestMap(FrozenMap<@Nullable Object> m) { "value" ); public static final Set optionalKeys = Set.of(); - public static JSONPatchRequestAddReplaceTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static JSONPatchRequestAddReplaceTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return JSONPatchRequestAddReplaceTest1.getInstance().validate(arg, configuration); } @@ -480,7 +479,7 @@ public JSONPatchRequestAddReplaceTestMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestAddReplaceTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -492,11 +491,11 @@ public JSONPatchRequestAddReplaceTestMap validate(Map arg, SchemaConfigura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -506,15 +505,15 @@ public JSONPatchRequestAddReplaceTestMap validate(Map arg, SchemaConfigura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequestAddReplaceTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestAddReplaceTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new JSONPatchRequestAddReplaceTest1BoxedMap(validate(arg, configuration)); } @Override - public JSONPatchRequestAddReplaceTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestAddReplaceTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java index aec1e8ece3e..ccecd4a7216 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -117,7 +116,7 @@ public static Op getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -128,16 +127,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -147,15 +146,15 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OpBoxedString(validate(arg, configuration)); } @Override - public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -169,7 +168,7 @@ protected JSONPatchRequestMoveCopyMap(FrozenMap m) { "path" ); public static final Set optionalKeys = Set.of(); - public static JSONPatchRequestMoveCopyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static JSONPatchRequestMoveCopyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return JSONPatchRequestMoveCopy1.getInstance().validate(arg, configuration); } @@ -433,7 +432,7 @@ public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pa return new JSONPatchRequestMoveCopyMap(castProperties); } - public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -445,11 +444,11 @@ public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -459,15 +458,15 @@ public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfiguration c throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequestMoveCopy1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestMoveCopy1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new JSONPatchRequestMoveCopy1BoxedMap(validate(arg, configuration)); } @Override - public JSONPatchRequestMoveCopy1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestMoveCopy1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java index dd6cc0b1d1a..909c63f3f69 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -104,7 +103,7 @@ public static Op getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -115,16 +114,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringOpEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -134,15 +133,15 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OpBoxedString(validate(arg, configuration)); } @Override - public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -155,7 +154,7 @@ protected JSONPatchRequestRemoveMap(FrozenMap m) { "path" ); public static final Set optionalKeys = Set.of(); - public static JSONPatchRequestRemoveMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static JSONPatchRequestRemoveMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return JSONPatchRequestRemove1.getInstance().validate(arg, configuration); } @@ -333,7 +332,7 @@ public JSONPatchRequestRemoveMap getNewInstance(Map arg, List path return new JSONPatchRequestRemoveMap(castProperties); } - public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -345,11 +344,11 @@ public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfiguration con @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -359,15 +358,15 @@ public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfiguration con throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequestRemove1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestRemove1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new JSONPatchRequestRemove1BoxedMap(validate(arg, configuration)); } @Override - public JSONPatchRequestRemove1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestRemove1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java index 23fbf511a9e..79d6eb48d01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -109,7 +108,7 @@ public static Mammal1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,7 +120,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -133,7 +132,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,24 +143,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,15 +171,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -204,7 +203,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -238,7 +237,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -250,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -265,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -286,31 +285,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Mammal1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedVoid(validate(arg, configuration)); } @Override - public Mammal1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedBoolean(validate(arg, configuration)); } @Override - public Mammal1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedNumber(validate(arg, configuration)); } @Override - public Mammal1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedString(validate(arg, configuration)); } @Override - public Mammal1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedList(validate(arg, configuration)); } @Override - public Mammal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedMap(validate(arg, configuration)); } @Override - public Mammal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -326,7 +325,7 @@ public Mammal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java index 0f112f5e10c..5c949106062 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -52,7 +51,7 @@ protected AdditionalPropertiesMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return AdditionalProperties.getInstance().validate(arg, configuration); } @@ -150,7 +149,7 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo return new AdditionalPropertiesMap(castProperties); } - public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,11 +161,11 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration confi @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -176,15 +175,15 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration confi throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalPropertiesBoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -195,7 +194,7 @@ protected MapMapOfStringMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapMapOfStringMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MapMapOfStringMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { return MapMapOfString.getInstance().validate(arg, configuration); } @@ -293,7 +292,7 @@ public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, return new MapMapOfStringMap(castProperties); } - public MapMapOfStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapMapOfStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -305,11 +304,11 @@ public MapMapOfStringMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -319,15 +318,15 @@ public MapMapOfStringMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapMapOfStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapMapOfStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapMapOfStringBoxedMap(validate(arg, configuration)); } @Override - public MapMapOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapMapOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -381,7 +380,7 @@ public static AdditionalProperties2 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -392,16 +391,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringAdditionalPropertiesEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringAdditionalPropertiesEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -411,15 +410,15 @@ public String validate(StringAdditionalPropertiesEnums arg,SchemaConfiguration c throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedString(validate(arg, configuration)); } @Override - public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -429,7 +428,7 @@ protected MapOfEnumStringMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapOfEnumStringMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MapOfEnumStringMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MapOfEnumString.getInstance().validate(arg, configuration); } @@ -534,7 +533,7 @@ public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, return new MapOfEnumStringMap(castProperties); } - public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -546,11 +545,11 @@ public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -560,15 +559,15 @@ public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapOfEnumStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfEnumStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapOfEnumStringBoxedMap(validate(arg, configuration)); } @Override - public MapOfEnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfEnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -590,7 +589,7 @@ protected DirectMapMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static DirectMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static DirectMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return DirectMap.getInstance().validate(arg, configuration); } @@ -693,7 +692,7 @@ public DirectMapMap getNewInstance(Map arg, List pathToItem, PathT return new DirectMapMap(castProperties); } - public DirectMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DirectMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -705,11 +704,11 @@ public DirectMapMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -719,15 +718,15 @@ public DirectMapMap validate(Map arg, SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DirectMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DirectMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DirectMapBoxedMap(validate(arg, configuration)); } @Override - public DirectMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DirectMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -743,7 +742,7 @@ protected MapTestMap(FrozenMap<@Nullable Object> m) { "direct_map", "indirect_map" ); - public static MapTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MapTestMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MapTest1.getInstance().validate(arg, configuration); } @@ -939,7 +938,7 @@ public MapTestMap getNewInstance(Map arg, List pathToItem, PathToS return new MapTestMap(castProperties); } - public MapTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -951,11 +950,11 @@ public MapTestMap validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -965,15 +964,15 @@ public MapTestMap validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapTest1BoxedMap(validate(arg, configuration)); } @Override - public MapTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java index 354de5b9ae4..745291751f4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; @@ -59,7 +58,7 @@ protected MapMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static MapMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MapMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { return MapSchema.getInstance().validate(arg, configuration); } @@ -157,7 +156,7 @@ public MapMap getNewInstance(Map arg, List pathToItem, PathToSchem return new MapMap(castProperties); } - public MapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -169,11 +168,11 @@ public MapMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -183,15 +182,15 @@ public MapMap validate(Map arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapSchemaBoxedMap(validate(arg, configuration)); } @Override - public MapSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -206,7 +205,7 @@ protected MixedPropertiesAndAdditionalPropertiesClassMap(FrozenMap<@Nullable Obj "dateTime", "map" ); - public static MixedPropertiesAndAdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MixedPropertiesAndAdditionalPropertiesClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MixedPropertiesAndAdditionalPropertiesClass1.getInstance().validate(arg, configuration); } @@ -356,7 +355,7 @@ public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map a return new MixedPropertiesAndAdditionalPropertiesClassMap(castProperties); } - public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -368,11 +367,11 @@ public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map arg, Sc @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -382,15 +381,15 @@ public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map arg, Sc throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MixedPropertiesAndAdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MixedPropertiesAndAdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MixedPropertiesAndAdditionalPropertiesClass1BoxedMap(validate(arg, configuration)); } @Override - public MixedPropertiesAndAdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MixedPropertiesAndAdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java index d64b7e21b6b..8556b36f75d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -62,7 +61,7 @@ protected MoneyMap(FrozenMap<@Nullable Object> m) { "currency" ); public static final Set optionalKeys = Set.of(); - public static MoneyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MoneyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Money1.getInstance().validate(arg, configuration); } @@ -237,7 +236,7 @@ public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSch return new MoneyMap(castProperties); } - public MoneyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MoneyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,11 +248,11 @@ public MoneyMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -263,15 +262,15 @@ public MoneyMap validate(Map arg, SchemaConfiguration configuration) throw throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Money1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Money1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Money1BoxedMap(validate(arg, configuration)); } @Override - public Money1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Money1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java index 0f3ee4b146b..49aeac11da7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -61,7 +60,7 @@ protected MyObjectDtoMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "id" ); - public static MyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MyObjectDto1.getInstance().validate(arg, configuration); } @@ -168,7 +167,7 @@ public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, Pat return new MyObjectDtoMap(castProperties); } - public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,11 +179,11 @@ public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -194,15 +193,15 @@ public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MyObjectDto1BoxedMap(validate(arg, configuration)); } @Override - public MyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java index 4e70d396f79..42f33135fe6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -83,7 +82,7 @@ protected NameMap(FrozenMap<@Nullable Object> m) { "snake_case", "property" ); - public static NameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static NameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Name1.getInstance().validate(arg, configuration); } @@ -290,7 +289,7 @@ public static Name1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -302,7 +301,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,7 +313,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -325,24 +324,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -353,15 +352,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -385,7 +384,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,7 +418,7 @@ public NameMap getNewInstance(Map arg, List pathToItem, PathToSche return new NameMap(castProperties); } - public NameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -431,7 +430,7 @@ public NameMap validate(Map arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -446,7 +445,7 @@ public NameMap validate(Map arg, SchemaConfiguration configuration) throws } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -467,31 +466,31 @@ public NameMap validate(Map arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Name1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedVoid(validate(arg, configuration)); } @Override - public Name1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedBoolean(validate(arg, configuration)); } @Override - public Name1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedNumber(validate(arg, configuration)); } @Override - public Name1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedString(validate(arg, configuration)); } @Override - public Name1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedList(validate(arg, configuration)); } @Override - public Name1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedMap(validate(arg, configuration)); } @Override - public Name1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -507,7 +506,7 @@ public Name1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java index 07112ce09d6..0500ace9a46 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -74,7 +73,7 @@ protected NoAdditionalPropertiesMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "petId" ); - public static NoAdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static NoAdditionalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return NoAdditionalProperties1.getInstance().validate(arg, configuration); } @@ -254,7 +253,7 @@ public NoAdditionalPropertiesMap getNewInstance(Map arg, List path return new NoAdditionalPropertiesMap(castProperties); } - public NoAdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NoAdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -266,11 +265,11 @@ public NoAdditionalPropertiesMap validate(Map arg, SchemaConfiguration con @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -280,15 +279,15 @@ public NoAdditionalPropertiesMap validate(Map arg, SchemaConfiguration con throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NoAdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NoAdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NoAdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public NoAdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NoAdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java index fee17dcaa33..2bc824b0de6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -77,7 +76,7 @@ public static AdditionalProperties3 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -110,7 +109,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -122,13 +121,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -140,22 +139,22 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties3BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties3BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties3BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties3BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -203,7 +202,7 @@ public static IntegerProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,7 +213,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -224,30 +223,30 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -259,22 +258,22 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerPropBoxedVoid(validate(arg, configuration)); } @Override - public IntegerPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerPropBoxedNumber(validate(arg, configuration)); } @Override - public IntegerPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -321,7 +320,7 @@ public static NumberProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -332,7 +331,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -342,30 +341,30 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -377,22 +376,22 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NumberPropBoxedVoid(validate(arg, configuration)); } @Override - public NumberPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberPropBoxedNumber(validate(arg, configuration)); } @Override - public NumberPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -436,7 +435,7 @@ public static BooleanProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -447,7 +446,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -458,14 +457,14 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -478,15 +477,15 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BooleanPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new BooleanPropBoxedVoid(validate(arg, configuration)); } @Override - public BooleanPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BooleanPropBoxedBoolean(validate(arg, configuration)); } @Override - public BooleanPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -494,7 +493,7 @@ public BooleanPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -538,7 +537,7 @@ public static StringProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -549,7 +548,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -560,13 +559,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -578,22 +577,22 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new StringPropBoxedVoid(validate(arg, configuration)); } @Override - public StringPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringPropBoxedString(validate(arg, configuration)); } @Override - public StringPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -638,7 +637,7 @@ public static DateProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -649,7 +648,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -660,13 +659,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -678,22 +677,22 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DatePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DatePropBoxedVoid(validate(arg, configuration)); } @Override - public DatePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DatePropBoxedString(validate(arg, configuration)); } @Override - public DatePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -738,7 +737,7 @@ public static DatetimeProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -749,7 +748,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -760,13 +759,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -778,22 +777,22 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DatetimePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimePropBoxedVoid(validate(arg, configuration)); } @Override - public DatetimePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimePropBoxedString(validate(arg, configuration)); } @Override - public DatetimePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -812,7 +811,7 @@ public static class ArrayNullablePropList extends FrozenList> { protected ArrayNullablePropList(FrozenList> m) { super(m); } - public static ArrayNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return ArrayNullableProp.getInstance().validate(arg, configuration); } } @@ -881,7 +880,7 @@ public static ArrayNullableProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -914,7 +913,7 @@ public ArrayNullablePropList getNewInstance(List arg, List pathToItem return new ArrayNullablePropList(newInstanceItems); } - public ArrayNullablePropList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayNullablePropList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -925,13 +924,13 @@ public ArrayNullablePropList validate(List arg, SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -943,22 +942,22 @@ public ArrayNullablePropList validate(List arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ArrayNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayNullablePropBoxedList(validate(arg, configuration)); } @Override - public ArrayNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1001,7 +1000,7 @@ public static Items1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1034,7 +1033,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1046,13 +1045,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1064,22 +1063,22 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Items1BoxedVoid(validate(arg, configuration)); } @Override - public Items1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Items1BoxedMap(validate(arg, configuration)); } @Override - public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1087,7 +1086,7 @@ public static class ArrayAndItemsNullablePropList extends FrozenList<@Nullable F protected ArrayAndItemsNullablePropList(FrozenList<@Nullable FrozenMap> m) { super(m); } - public static ArrayAndItemsNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayAndItemsNullablePropList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return ArrayAndItemsNullableProp.getInstance().validate(arg, configuration); } } @@ -1161,7 +1160,7 @@ public static ArrayAndItemsNullableProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1194,7 +1193,7 @@ public ArrayAndItemsNullablePropList getNewInstance(List arg, List pa return new ArrayAndItemsNullablePropList(newInstanceItems); } - public ArrayAndItemsNullablePropList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayAndItemsNullablePropList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1205,13 +1204,13 @@ public ArrayAndItemsNullablePropList validate(List arg, SchemaConfiguration c } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1223,22 +1222,22 @@ public ArrayAndItemsNullablePropList validate(List arg, SchemaConfiguration c throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayAndItemsNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ArrayAndItemsNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayAndItemsNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayAndItemsNullablePropBoxedList(validate(arg, configuration)); } @Override - public ArrayAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1281,7 +1280,7 @@ public static Items2 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1314,7 +1313,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1326,13 +1325,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1344,22 +1343,22 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Items2BoxedVoid(validate(arg, configuration)); } @Override - public Items2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Items2BoxedMap(validate(arg, configuration)); } @Override - public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1367,7 +1366,7 @@ public static class ArrayItemsNullableList extends FrozenList<@Nullable FrozenMa protected ArrayItemsNullableList(FrozenList<@Nullable FrozenMap> m) { super(m); } - public static ArrayItemsNullableList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayItemsNullableList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return ArrayItemsNullable.getInstance().validate(arg, configuration); } } @@ -1453,7 +1452,7 @@ public ArrayItemsNullableList getNewInstance(List arg, List pathToIte return new ArrayItemsNullableList(newInstanceItems); } - public ArrayItemsNullableList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayItemsNullableList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1464,11 +1463,11 @@ public ArrayItemsNullableList validate(List arg, SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1478,15 +1477,15 @@ public ArrayItemsNullableList validate(List arg, SchemaConfiguration configur throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayItemsNullableBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayItemsNullableBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayItemsNullableBoxedList(validate(arg, configuration)); } @Override - public ArrayItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1507,7 +1506,7 @@ protected ObjectNullablePropMap(FrozenMap> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static ObjectNullablePropMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectNullablePropMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { return ObjectNullableProp.getInstance().validate(arg, configuration); } @@ -1590,7 +1589,7 @@ public static ObjectNullableProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1626,7 +1625,7 @@ public ObjectNullablePropMap getNewInstance(Map arg, List pathToIt return new ObjectNullablePropMap(castProperties); } - public ObjectNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1638,13 +1637,13 @@ public ObjectNullablePropMap validate(Map arg, SchemaConfiguration configu @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1656,22 +1655,22 @@ public ObjectNullablePropMap validate(Map arg, SchemaConfiguration configu throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ObjectNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectNullablePropBoxedMap(validate(arg, configuration)); } @Override - public ObjectNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1714,7 +1713,7 @@ public static AdditionalProperties1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1747,7 +1746,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1759,13 +1758,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1777,22 +1776,22 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1802,7 +1801,7 @@ protected ObjectAndItemsNullablePropMap(FrozenMap<@Nullable FrozenMap> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static ObjectAndItemsNullablePropMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectAndItemsNullablePropMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { return ObjectAndItemsNullableProp.getInstance().validate(arg, configuration); } @@ -1892,7 +1891,7 @@ public static ObjectAndItemsNullableProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1928,7 +1927,7 @@ public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List return new ObjectAndItemsNullablePropMap(castProperties); } - public ObjectAndItemsNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectAndItemsNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1940,13 +1939,13 @@ public ObjectAndItemsNullablePropMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1958,22 +1957,22 @@ public ObjectAndItemsNullablePropMap validate(Map arg, SchemaConfiguration throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectAndItemsNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ObjectAndItemsNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectAndItemsNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectAndItemsNullablePropBoxedMap(validate(arg, configuration)); } @Override - public ObjectAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2016,7 +2015,7 @@ public static AdditionalProperties2 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2049,7 +2048,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2061,13 +2060,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -2079,22 +2078,22 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2104,7 +2103,7 @@ protected ObjectItemsNullableMap(FrozenMap<@Nullable FrozenMap> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static ObjectItemsNullableMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectItemsNullableMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { return ObjectItemsNullable.getInstance().validate(arg, configuration); } @@ -2209,7 +2208,7 @@ public ObjectItemsNullableMap getNewInstance(Map arg, List pathToI return new ObjectItemsNullableMap(castProperties); } - public ObjectItemsNullableMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectItemsNullableMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2221,11 +2220,11 @@ public ObjectItemsNullableMap validate(Map arg, SchemaConfiguration config @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -2235,15 +2234,15 @@ public ObjectItemsNullableMap validate(Map arg, SchemaConfiguration config throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectItemsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectItemsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectItemsNullableBoxedMap(validate(arg, configuration)); } @Override - public ObjectItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2267,7 +2266,7 @@ protected NullableClassMap(FrozenMap<@Nullable Object> m) { "object_and_items_nullable_prop", "object_items_nullable" ); - public static NullableClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static NullableClassMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return NullableClass1.getInstance().validate(arg, configuration); } @@ -2794,7 +2793,7 @@ public NullableClassMap getNewInstance(Map arg, List pathToItem, P return new NullableClassMap(castProperties); } - public NullableClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2806,11 +2805,11 @@ public NullableClassMap validate(Map arg, SchemaConfiguration configuratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -2820,15 +2819,15 @@ public NullableClassMap validate(Map arg, SchemaConfiguration configuratio throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NullableClass1BoxedMap(validate(arg, configuration)); } @Override - public NullableClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java index c6c5d363ba2..a182ebc1218 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -123,7 +122,7 @@ public static NullableShape1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,7 +134,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -147,7 +146,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -158,24 +157,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -186,15 +185,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -252,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -264,7 +263,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -279,7 +278,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -300,31 +299,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableShape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedVoid(validate(arg, configuration)); } @Override - public NullableShape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedBoolean(validate(arg, configuration)); } @Override - public NullableShape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedNumber(validate(arg, configuration)); } @Override - public NullableShape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedString(validate(arg, configuration)); } @Override - public NullableShape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedList(validate(arg, configuration)); } @Override - public NullableShape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedMap(validate(arg, configuration)); } @Override - public NullableShape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -340,7 +339,7 @@ public NullableShape1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurat } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java index 65d302e6ff2..82eff01189c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -67,7 +66,7 @@ public static NullableString1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -78,7 +77,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -89,13 +88,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -107,22 +106,22 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NullableString1BoxedVoid(validate(arg, configuration)); } @Override - public NullableString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NullableString1BoxedString(validate(arg, configuration)); } @Override - public NullableString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java index 9871bbb637e..40f333f0b3d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected NumberOnlyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "JustNumber" ); - public static NumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static NumberOnlyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return NumberOnly1.getInstance().validate(arg, configuration); } @@ -184,7 +183,7 @@ public NumberOnlyMap getNewInstance(Map arg, List pathToItem, Path return new NumberOnlyMap(castProperties); } - public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -196,11 +195,11 @@ public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -210,15 +209,15 @@ public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NumberOnly1BoxedMap(validate(arg, configuration)); } @Override - public NumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java index cc9f66947cd..b07cf3e7b49 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -62,7 +61,7 @@ public static NumberWithExclusiveMinMax1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -72,28 +71,28 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -103,15 +102,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberWithExclusiveMinMax1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberWithExclusiveMinMax1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberWithExclusiveMinMax1BoxedNumber(validate(arg, configuration)); } @Override - public NumberWithExclusiveMinMax1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberWithExclusiveMinMax1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java index 6ff107598ba..cf0349c6748 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -62,7 +61,7 @@ public static NumberWithValidations1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -72,28 +71,28 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -103,15 +102,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberWithValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberWithValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberWithValidations1BoxedNumber(validate(arg, configuration)); } @Override - public NumberWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java index 9535263d425..c3d1cef070f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected ObjWithRequiredPropsMap(FrozenMap<@Nullable Object> m) { "a" ); public static final Set optionalKeys = Set.of(); - public static ObjWithRequiredPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjWithRequiredPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjWithRequiredProps1.getInstance().validate(arg, configuration); } @@ -180,7 +179,7 @@ public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathTo return new ObjWithRequiredPropsMap(castProperties); } - public ObjWithRequiredPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -192,11 +191,11 @@ public ObjWithRequiredPropsMap validate(Map arg, SchemaConfiguration confi @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -206,15 +205,15 @@ public ObjWithRequiredPropsMap validate(Map arg, SchemaConfiguration confi throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjWithRequiredProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjWithRequiredProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjWithRequiredProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java index fe428a5aaa5..721ccab7180 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected ObjWithRequiredPropsBaseMap(FrozenMap<@Nullable Object> m) { "b" ); public static final Set optionalKeys = Set.of(); - public static ObjWithRequiredPropsBaseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjWithRequiredPropsBaseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjWithRequiredPropsBase1.getInstance().validate(arg, configuration); } @@ -177,7 +176,7 @@ public ObjWithRequiredPropsBaseMap getNewInstance(Map arg, List pa return new ObjWithRequiredPropsBaseMap(castProperties); } - public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,11 +188,11 @@ public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -203,15 +202,15 @@ public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfiguration c throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjWithRequiredPropsBase1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredPropsBase1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjWithRequiredPropsBase1BoxedMap(validate(arg, configuration)); } @Override - public ObjWithRequiredPropsBase1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredPropsBase1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java index 7148a75db63..8709961bd10 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -60,7 +59,7 @@ protected ObjectModelWithArgAndArgsPropertiesMap(FrozenMap<@Nullable Object> m) "args" ); public static final Set optionalKeys = Set.of(); - public static ObjectModelWithArgAndArgsPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectModelWithArgAndArgsPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectModelWithArgAndArgsProperties1.getInstance().validate(arg, configuration); } @@ -240,7 +239,7 @@ public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(Map arg, List return new ObjectModelWithArgAndArgsPropertiesMap(castProperties); } - public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -252,11 +251,11 @@ public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -266,15 +265,15 @@ public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectModelWithArgAndArgsProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithArgAndArgsProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectModelWithArgAndArgsProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectModelWithArgAndArgsProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithArgAndArgsProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java index 9b7a20ea6b5..8e8d69563b7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -38,7 +37,7 @@ protected ObjectModelWithRefPropsMap(FrozenMap<@Nullable Object> m) { "myString", "myBoolean" ); - public static ObjectModelWithRefPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectModelWithRefPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectModelWithRefProps1.getInstance().validate(arg, configuration); } @@ -228,7 +227,7 @@ public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pat return new ObjectModelWithRefPropsMap(castProperties); } - public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,11 +239,11 @@ public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -254,15 +253,15 @@ public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfiguration co throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectModelWithRefProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithRefProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectModelWithRefProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjectModelWithRefProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithRefProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java index 08109d7a7d7..e9986ba7011 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -59,7 +58,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "name" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } @@ -255,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,11 +266,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -281,15 +280,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -367,7 +366,7 @@ public static ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -391,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,15 +429,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -462,7 +461,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -508,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -523,7 +522,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -544,31 +543,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -584,7 +583,7 @@ public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed validateAndBox(@Null } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java index 4bacb58eb6e..0b6133faf4b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -60,7 +59,7 @@ protected ObjectWithCollidingPropertiesMap(FrozenMap<@Nullable Object> m) { "someProp", "someprop" ); - public static ObjectWithCollidingPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectWithCollidingPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithCollidingProperties1.getInstance().validate(arg, configuration); } @@ -206,7 +205,7 @@ public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithCollidingPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,11 +217,11 @@ public ObjectWithCollidingPropertiesMap validate(Map arg, SchemaConfigurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -232,15 +231,15 @@ public ObjectWithCollidingPropertiesMap validate(Map arg, SchemaConfigurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithCollidingProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithCollidingProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithCollidingProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithCollidingProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithCollidingProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java index a055d3347f7..6581484c416 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DecimalJsonSchema; @@ -50,7 +49,7 @@ protected ObjectWithDecimalPropertiesMap(FrozenMap<@Nullable Object> m) { "width", "cost" ); - public static ObjectWithDecimalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectWithDecimalPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithDecimalProperties1.getInstance().validate(arg, configuration); } @@ -220,7 +219,7 @@ public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List return new ObjectWithDecimalPropertiesMap(castProperties); } - public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -232,11 +231,11 @@ public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -246,15 +245,15 @@ public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguratio throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithDecimalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDecimalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithDecimalProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithDecimalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDecimalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java index 379516fee52..9eaf1306f8d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -75,7 +74,7 @@ protected ObjectWithDifficultlyNamedPropsMap(FrozenMap<@Nullable Object> m) { "$special[property.name]", "123Number" ); - public static ObjectWithDifficultlyNamedPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectWithDifficultlyNamedPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithDifficultlyNamedProps1.getInstance().validate(arg, configuration); } @@ -266,7 +265,7 @@ public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDifficultlyNamedPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -278,11 +277,11 @@ public ObjectWithDifficultlyNamedPropsMap validate(Map arg, SchemaConfigur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -292,15 +291,15 @@ public ObjectWithDifficultlyNamedPropsMap validate(Map arg, SchemaConfigur throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithDifficultlyNamedProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDifficultlyNamedProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithDifficultlyNamedProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithDifficultlyNamedProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDifficultlyNamedProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java index 5a778351f9d..c88a642a47a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -70,7 +69,7 @@ public static Schema0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -81,11 +80,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -95,15 +94,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -173,7 +172,7 @@ public static SomeProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,7 +184,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,24 +207,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -236,15 +235,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -268,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -302,7 +301,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -329,7 +328,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -350,31 +349,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedVoid(validate(arg, configuration)); } @Override - public SomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedBoolean(validate(arg, configuration)); } @Override - public SomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedNumber(validate(arg, configuration)); } @Override - public SomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedString(validate(arg, configuration)); } @Override - public SomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedList(validate(arg, configuration)); } @Override - public SomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedMap(validate(arg, configuration)); } @Override - public SomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -390,7 +389,7 @@ public SomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -402,7 +401,7 @@ protected ObjectWithInlineCompositionPropertyMap(FrozenMap<@Nullable Object> m) public static final Set optionalKeys = Set.of( "someProp" ); - public static ObjectWithInlineCompositionPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectWithInlineCompositionPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithInlineCompositionProperty1.getInstance().validate(arg, configuration); } @@ -562,7 +561,7 @@ public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List return new ObjectWithInlineCompositionPropertyMap(castProperties); } - public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -574,11 +573,11 @@ public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -588,15 +587,15 @@ public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithInlineCompositionProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInlineCompositionProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithInlineCompositionProperty1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithInlineCompositionProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInlineCompositionProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java index f2c25adf5b4..bb4e4b05c6d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -37,7 +36,7 @@ protected ObjectWithInvalidNamedRefedPropertiesMap(FrozenMap<@Nullable Object> m "from" ); public static final Set optionalKeys = Set.of(); - public static ObjectWithInvalidNamedRefedPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectWithInvalidNamedRefedPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithInvalidNamedRefedProperties1.getInstance().validate(arg, configuration); } @@ -209,7 +208,7 @@ public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(Map arg, Li return new ObjectWithInvalidNamedRefedPropertiesMap(castProperties); } - public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -221,11 +220,11 @@ public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaCo @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -235,15 +234,15 @@ public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaCo throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithInvalidNamedRefedProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInvalidNamedRefedProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithInvalidNamedRefedProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithInvalidNamedRefedProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInvalidNamedRefedProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java index 77d997b739d..fba62004ad4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -60,7 +59,7 @@ protected ObjectWithNonIntersectingValuesMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "a" ); - public static ObjectWithNonIntersectingValuesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectWithNonIntersectingValuesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithNonIntersectingValues1.getInstance().validate(arg, configuration); } @@ -216,7 +215,7 @@ public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNonIntersectingValuesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,11 +227,11 @@ public ObjectWithNonIntersectingValuesMap validate(Map arg, SchemaConfigur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -242,15 +241,15 @@ public ObjectWithNonIntersectingValuesMap validate(Map arg, SchemaConfigur throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithNonIntersectingValues1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNonIntersectingValues1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithNonIntersectingValues1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithNonIntersectingValues1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNonIntersectingValues1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java index 6801e4a3bfa..d8b8726ab28 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -74,7 +73,7 @@ protected ObjectWithOnlyOptionalPropsMap(FrozenMap m) { "a", "b" ); - public static ObjectWithOnlyOptionalPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectWithOnlyOptionalPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithOnlyOptionalProps1.getInstance().validate(arg, configuration); } @@ -231,7 +230,7 @@ public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List return new ObjectWithOnlyOptionalPropsMap(castProperties); } - public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,11 +242,11 @@ public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -257,15 +256,15 @@ public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguratio throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithOnlyOptionalProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOnlyOptionalProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithOnlyOptionalProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithOnlyOptionalProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOnlyOptionalProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java index 0865b282471..fedaf9d618a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected ObjectWithOptionalTestPropMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "test" ); - public static ObjectWithOptionalTestPropMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectWithOptionalTestPropMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithOptionalTestProp1.getInstance().validate(arg, configuration); } @@ -166,7 +165,7 @@ public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List return new ObjectWithOptionalTestPropMap(castProperties); } - public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -178,11 +177,11 @@ public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -192,15 +191,15 @@ public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithOptionalTestProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOptionalTestProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithOptionalTestProp1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithOptionalTestProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOptionalTestProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java index 78c5b4aa10c..bc80404533f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -84,7 +83,7 @@ public static ObjectWithValidations1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -96,11 +95,11 @@ public static ObjectWithValidations1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -110,15 +109,15 @@ public static ObjectWithValidations1 getInstance() { throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithValidations1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java index bf6b0474bb9..095cd4d6adb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -131,7 +130,7 @@ public static Status getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,16 +141,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -161,15 +160,15 @@ public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StatusBoxedString(validate(arg, configuration)); } @Override - public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -197,7 +196,7 @@ protected OrderMap(FrozenMap<@Nullable Object> m) { "status", "complete" ); - public static OrderMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static OrderMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Order1.getInstance().validate(arg, configuration); } @@ -493,7 +492,7 @@ public OrderMap getNewInstance(Map arg, List pathToItem, PathToSch return new OrderMap(castProperties); } - public OrderMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OrderMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -505,11 +504,11 @@ public OrderMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -519,15 +518,15 @@ public OrderMap validate(Map arg, SchemaConfiguration configuration) throw throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Order1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Order1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Order1BoxedMap(validate(arg, configuration)); } @Override - public Order1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Order1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java index cc9906d7d5f..4029137d41a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -59,7 +58,7 @@ public static class ResultsList extends FrozenList { protected ResultsList(FrozenList m) { super(m); } - public static ResultsList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ResultsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return Results.getInstance().validate(arg, configuration); } } @@ -140,7 +139,7 @@ public ResultsList getNewInstance(List arg, List pathToItem, PathToSc return new ResultsList(newInstanceItems); } - public ResultsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ResultsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -151,11 +150,11 @@ public ResultsList validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -165,15 +164,15 @@ public ResultsList validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ResultsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ResultsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ResultsBoxedList(validate(arg, configuration)); } @Override - public ResultsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ResultsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -186,7 +185,7 @@ protected PaginatedResultMyObjectDtoMap(FrozenMap m) { "results" ); public static final Set optionalKeys = Set.of(); - public static PaginatedResultMyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PaginatedResultMyObjectDtoMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PaginatedResultMyObjectDto1.getInstance().validate(arg, configuration); } @@ -376,7 +375,7 @@ public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List return new PaginatedResultMyObjectDtoMap(castProperties); } - public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -388,11 +387,11 @@ public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -402,15 +401,15 @@ public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PaginatedResultMyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PaginatedResultMyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PaginatedResultMyObjectDto1BoxedMap(validate(arg, configuration)); } @Override - public PaginatedResultMyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PaginatedResultMyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java index 1f5ca58ab3a..891f53e085b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -86,7 +85,7 @@ public static ParentPet1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,11 +97,11 @@ public static ParentPet1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -112,15 +111,15 @@ public static ParentPet1 getInstance() { throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ParentPet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ParentPet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ParentPet1BoxedMap(validate(arg, configuration)); } @Override - public ParentPet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ParentPet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java index 95df7d95cc5..6e0157524b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -73,7 +72,7 @@ public static class PhotoUrlsList extends FrozenList { protected PhotoUrlsList(FrozenList m) { super(m); } - public static PhotoUrlsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PhotoUrlsList of(List arg, SchemaConfiguration configuration) throws ValidationException { return PhotoUrls.getInstance().validate(arg, configuration); } } @@ -154,7 +153,7 @@ public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathTo return new PhotoUrlsList(newInstanceItems); } - public PhotoUrlsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public PhotoUrlsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -165,11 +164,11 @@ public PhotoUrlsList validate(List arg, SchemaConfiguration configuration) th } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -179,15 +178,15 @@ public PhotoUrlsList validate(List arg, SchemaConfiguration configuration) th throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PhotoUrlsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PhotoUrlsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PhotoUrlsBoxedList(validate(arg, configuration)); } @Override - public PhotoUrlsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PhotoUrlsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringStatusEnums implements StringValueMethod { @@ -242,7 +241,7 @@ public static Status getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -253,16 +252,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -272,15 +271,15 @@ public String validate(StringStatusEnums arg,SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StatusBoxedString(validate(arg, configuration)); } @Override - public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -288,7 +287,7 @@ public static class TagsList extends FrozenList { protected TagsList(FrozenList m) { super(m); } - public static TagsList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static TagsList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return Tags.getInstance().validate(arg, configuration); } } @@ -369,7 +368,7 @@ public TagsList getNewInstance(List arg, List pathToItem, PathToSchem return new TagsList(newInstanceItems); } - public TagsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public TagsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -380,11 +379,11 @@ public TagsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -394,15 +393,15 @@ public TagsList validate(List arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TagsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TagsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new TagsBoxedList(validate(arg, configuration)); } @Override - public TagsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TagsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -420,7 +419,7 @@ protected PetMap(FrozenMap<@Nullable Object> m) { "tags", "status" ); - public static PetMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PetMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Pet1.getInstance().validate(arg, configuration); } @@ -730,7 +729,7 @@ public PetMap getNewInstance(Map arg, List pathToItem, PathToSchem return new PetMap(castProperties); } - public PetMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PetMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -742,11 +741,11 @@ public PetMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -756,15 +755,15 @@ public PetMap validate(Map arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Pet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Pet1BoxedMap(validate(arg, configuration)); } @Override - public Pet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java index d1905e00d45..68fab7484ef 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +107,7 @@ public static Pig1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +119,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +142,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -171,15 +170,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -203,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -237,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +248,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,7 +263,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -285,31 +284,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Pig1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedVoid(validate(arg, configuration)); } @Override - public Pig1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedBoolean(validate(arg, configuration)); } @Override - public Pig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedNumber(validate(arg, configuration)); } @Override - public Pig1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedString(validate(arg, configuration)); } @Override - public Pig1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedList(validate(arg, configuration)); } @Override - public Pig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedMap(validate(arg, configuration)); } @Override - public Pig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +324,7 @@ public Pig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java index b8fbde3939a..3908dffc525 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -49,7 +48,7 @@ protected PlayerMap(FrozenMap<@Nullable Object> m) { "name", "enemyPlayer" ); - public static PlayerMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PlayerMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Player1.getInstance().validate(arg, configuration); } @@ -195,7 +194,7 @@ public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSc return new PlayerMap(castProperties); } - public PlayerMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PlayerMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,11 +206,11 @@ public PlayerMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -221,15 +220,15 @@ public PlayerMap validate(Map arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Player1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Player1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Player1BoxedMap(validate(arg, configuration)); } @Override - public Player1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Player1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java index 9c6057d02e7..12a5cb206e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected PublicKeyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "key" ); - public static PublicKeyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PublicKeyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PublicKey1.getInstance().validate(arg, configuration); } @@ -168,7 +167,7 @@ public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathT return new PublicKeyMap(castProperties); } - public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,11 +179,11 @@ public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -194,15 +193,15 @@ public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PublicKey1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PublicKey1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PublicKey1BoxedMap(validate(arg, configuration)); } @Override - public PublicKey1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PublicKey1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java index d614559b5d9..c46fd11c75b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +107,7 @@ public static Quadrilateral1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +119,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +142,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -171,15 +170,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -203,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -237,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +248,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,7 +263,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -285,31 +284,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Quadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedVoid(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedBoolean(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedNumber(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedString(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedList(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedMap(validate(arg, configuration)); } @Override - public Quadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +324,7 @@ public Quadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurat } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java index a34f913a8e4..2f2db60c5e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -88,7 +87,7 @@ public static ShapeType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -99,16 +98,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -118,15 +117,15 @@ public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuratio throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeTypeBoxedString(validate(arg, configuration)); } @Override - public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -150,7 +149,7 @@ protected QuadrilateralInterfaceMap(FrozenMap<@Nullable Object> m) { "shapeType" ); public static final Set optionalKeys = Set.of(); - public static QuadrilateralInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QuadrilateralInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return QuadrilateralInterface1.getInstance().validate(arg, configuration); } @@ -348,7 +347,7 @@ public static QuadrilateralInterface1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -360,7 +359,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -372,7 +371,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -383,24 +382,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -411,15 +410,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -443,7 +442,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -477,7 +476,7 @@ public QuadrilateralInterfaceMap getNewInstance(Map arg, List path return new QuadrilateralInterfaceMap(castProperties); } - public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -489,7 +488,7 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration con } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -504,7 +503,7 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -525,31 +524,31 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration con throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QuadrilateralInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedVoid(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedBoolean(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedNumber(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedString(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedList(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedMap(validate(arg, configuration)); } @Override - public QuadrilateralInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -565,7 +564,7 @@ public QuadrilateralInterface1Boxed validateAndBox(@Nullable Object arg, SchemaC } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java index b820e79f937..6e3420867ce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -60,7 +59,7 @@ protected ReadOnlyFirstMap(FrozenMap<@Nullable Object> m) { "bar", "baz" ); - public static ReadOnlyFirstMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ReadOnlyFirstMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ReadOnlyFirst1.getInstance().validate(arg, configuration); } @@ -204,7 +203,7 @@ public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, P return new ReadOnlyFirstMap(castProperties); } - public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,11 +215,11 @@ public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -230,15 +229,15 @@ public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuratio throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReadOnlyFirst1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReadOnlyFirst1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ReadOnlyFirst1BoxedMap(validate(arg, configuration)); } @Override - public ReadOnlyFirst1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReadOnlyFirst1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java index 39a136395c7..0e8d8c58426 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected ReqPropsFromExplicitAddPropsMap(FrozenMap m) { "validName" ); public static final Set optionalKeys = Set.of(); - public static ReqPropsFromExplicitAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ReqPropsFromExplicitAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ReqPropsFromExplicitAddProps1.getInstance().validate(arg, configuration); } @@ -232,7 +231,7 @@ public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromExplicitAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -244,11 +243,11 @@ public ReqPropsFromExplicitAddPropsMap validate(Map arg, SchemaConfigurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -258,15 +257,15 @@ public ReqPropsFromExplicitAddPropsMap validate(Map arg, SchemaConfigurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReqPropsFromExplicitAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromExplicitAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ReqPropsFromExplicitAddProps1BoxedMap(validate(arg, configuration)); } @Override - public ReqPropsFromExplicitAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromExplicitAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java index d518fb83a8d..88595c25790 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -48,7 +47,7 @@ protected ReqPropsFromTrueAddPropsMap(FrozenMap<@Nullable Object> m) { "validName" ); public static final Set optionalKeys = Set.of(); - public static ReqPropsFromTrueAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ReqPropsFromTrueAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ReqPropsFromTrueAddProps1.getInstance().validate(arg, configuration); } @@ -381,7 +380,7 @@ public ReqPropsFromTrueAddPropsMap getNewInstance(Map arg, List pa return new ReqPropsFromTrueAddPropsMap(castProperties); } - public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -393,11 +392,11 @@ public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -407,15 +406,15 @@ public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfiguration c throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReqPropsFromTrueAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromTrueAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ReqPropsFromTrueAddProps1BoxedMap(validate(arg, configuration)); } @Override - public ReqPropsFromTrueAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromTrueAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java index dfb9da99592..26a7234885a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -36,7 +35,7 @@ protected ReqPropsFromUnsetAddPropsMap(FrozenMap<@Nullable Object> m) { "validName" ); public static final Set optionalKeys = Set.of(); - public static ReqPropsFromUnsetAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ReqPropsFromUnsetAddPropsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ReqPropsFromUnsetAddProps1.getInstance().validate(arg, configuration); } @@ -300,7 +299,7 @@ public ReqPropsFromUnsetAddPropsMap getNewInstance(Map arg, List p return new ReqPropsFromUnsetAddPropsMap(castProperties); } - public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -312,11 +311,11 @@ public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -326,15 +325,15 @@ public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConfiguration throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReqPropsFromUnsetAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromUnsetAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ReqPropsFromUnsetAddProps1BoxedMap(validate(arg, configuration)); } @Override - public ReqPropsFromUnsetAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromUnsetAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java index d5ce670188a..e09c2c586b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ protected ReturnMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "return" ); - public static ReturnMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ReturnMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ReturnSchema1.getInstance().validate(arg, configuration); } @@ -185,7 +184,7 @@ public static ReturnSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -209,7 +208,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -220,24 +219,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,15 +247,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -280,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,7 +313,7 @@ public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSc return new ReturnMap(castProperties); } - public ReturnMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -326,7 +325,7 @@ public ReturnMap validate(Map arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -341,7 +340,7 @@ public ReturnMap validate(Map arg, SchemaConfiguration configuration) thro } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -362,31 +361,31 @@ public ReturnMap validate(Map arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReturnSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedVoid(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedNumber(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedString(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedList(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedMap(validate(arg, configuration)); } @Override - public ReturnSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -402,7 +401,7 @@ public ReturnSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurati } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java index 052f0d58104..3a6e545b3a1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -87,7 +86,7 @@ public static TriangleType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,16 +97,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -117,15 +116,15 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleTypeBoxedString(validate(arg, configuration)); } @Override - public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -137,7 +136,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "triangleType" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } @@ -255,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,11 +266,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -281,15 +280,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -367,7 +366,7 @@ public static ScaleneTriangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -391,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,15 +429,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -462,7 +461,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -508,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -523,7 +522,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -544,31 +543,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ScaleneTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedVoid(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedBoolean(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedNumber(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedString(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedList(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedMap(validate(arg, configuration)); } @Override - public ScaleneTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -584,7 +583,7 @@ public ScaleneTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfigur } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java index e985e4fc961..ddd41386c39 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -70,7 +69,7 @@ protected Schema200ResponseMap(FrozenMap<@Nullable Object> m) { "name", "class" ); - public static Schema200ResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema200ResponseMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema200Response1.getInstance().validate(arg, configuration); } @@ -224,7 +223,7 @@ public static Schema200Response1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -236,7 +235,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +247,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -259,24 +258,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -287,15 +286,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -319,7 +318,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -353,7 +352,7 @@ public Schema200ResponseMap getNewInstance(Map arg, List pathToIte return new Schema200ResponseMap(castProperties); } - public Schema200ResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200ResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -365,7 +364,7 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -380,7 +379,7 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -401,31 +400,31 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguration configur throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema200Response1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedVoid(validate(arg, configuration)); } @Override - public Schema200Response1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema200Response1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedNumber(validate(arg, configuration)); } @Override - public Schema200Response1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedString(validate(arg, configuration)); } @Override - public Schema200Response1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedList(validate(arg, configuration)); } @Override - public Schema200Response1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedMap(validate(arg, configuration)); } @Override - public Schema200Response1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -441,7 +440,7 @@ public Schema200Response1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java index 772fd0c377b..4b3d12e860b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -27,7 +26,7 @@ public static class SelfReferencingArrayModelList extends FrozenList m) { super(m); } - public static SelfReferencingArrayModelList of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SelfReferencingArrayModelList of(List> arg, SchemaConfiguration configuration) throws ValidationException { return SelfReferencingArrayModel1.getInstance().validate(arg, configuration); } } @@ -114,7 +113,7 @@ public SelfReferencingArrayModelList getNewInstance(List arg, List pa return new SelfReferencingArrayModelList(newInstanceItems); } - public SelfReferencingArrayModelList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SelfReferencingArrayModelList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,11 +124,11 @@ public SelfReferencingArrayModelList validate(List arg, SchemaConfiguration c } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -139,15 +138,15 @@ public SelfReferencingArrayModelList validate(List arg, SchemaConfiguration c throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SelfReferencingArrayModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SelfReferencingArrayModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new SelfReferencingArrayModel1BoxedList(validate(arg, configuration)); } @Override - public SelfReferencingArrayModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SelfReferencingArrayModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java index 86d3b5bf5f7..cf46cae884b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -36,7 +35,7 @@ protected SelfReferencingObjectModelMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "selfRef" ); - public static SelfReferencingObjectModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SelfReferencingObjectModelMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return SelfReferencingObjectModel1.getInstance().validate(arg, configuration); } @@ -171,7 +170,7 @@ public SelfReferencingObjectModelMap getNewInstance(Map arg, List return new SelfReferencingObjectModelMap(castProperties); } - public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,11 +182,11 @@ public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -197,15 +196,15 @@ public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SelfReferencingObjectModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SelfReferencingObjectModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SelfReferencingObjectModel1BoxedMap(validate(arg, configuration)); } @Override - public SelfReferencingObjectModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SelfReferencingObjectModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java index fc2591ee41f..707b7d06ec3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +107,7 @@ public static Shape1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +119,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +142,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -171,15 +170,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -203,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -237,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +248,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,7 +263,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -285,31 +284,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Shape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedVoid(validate(arg, configuration)); } @Override - public Shape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedBoolean(validate(arg, configuration)); } @Override - public Shape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedNumber(validate(arg, configuration)); } @Override - public Shape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedString(validate(arg, configuration)); } @Override - public Shape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedList(validate(arg, configuration)); } @Override - public Shape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedMap(validate(arg, configuration)); } @Override - public Shape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +324,7 @@ public Shape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java index ea2b2517101..de5a61a3518 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -123,7 +122,7 @@ public static ShapeOrNull1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,7 +134,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -147,7 +146,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -158,24 +157,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -186,15 +185,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -252,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -264,7 +263,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -279,7 +278,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -300,31 +299,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapeOrNull1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedVoid(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedBoolean(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedNumber(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedString(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedList(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedMap(validate(arg, configuration)); } @Override - public ShapeOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -340,7 +339,7 @@ public ShapeOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java index 89b18465d78..21e800bc477 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -87,7 +86,7 @@ public static QuadrilateralType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,16 +97,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -117,15 +116,15 @@ public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration conf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralTypeBoxedString(validate(arg, configuration)); } @Override - public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -137,7 +136,7 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "quadrilateralType" ); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } @@ -255,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,11 +266,11 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -281,15 +280,15 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -367,7 +366,7 @@ public static SimpleQuadrilateral1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -391,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,15 +429,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -462,7 +461,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -508,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -523,7 +522,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -544,31 +543,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SimpleQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedVoid(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedBoolean(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedNumber(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedString(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedList(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedMap(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -584,7 +583,7 @@ public SimpleQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java index fa7f1bb0c45..8718a67dee6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -107,7 +106,7 @@ public static SomeObject1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -119,7 +118,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,7 +130,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,24 +141,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -170,15 +169,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -202,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +247,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -263,7 +262,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -284,31 +283,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SomeObject1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedVoid(validate(arg, configuration)); } @Override - public SomeObject1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedBoolean(validate(arg, configuration)); } @Override - public SomeObject1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedNumber(validate(arg, configuration)); } @Override - public SomeObject1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedString(validate(arg, configuration)); } @Override - public SomeObject1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedList(validate(arg, configuration)); } @Override - public SomeObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedMap(validate(arg, configuration)); } @Override - public SomeObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -324,7 +323,7 @@ public SomeObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java index a0d7869e135..a215bad464d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected SpecialModelnameMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "a" ); - public static SpecialModelnameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SpecialModelnameMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return SpecialModelname1.getInstance().validate(arg, configuration); } @@ -168,7 +167,7 @@ public SpecialModelnameMap getNewInstance(Map arg, List pathToItem return new SpecialModelnameMap(castProperties); } - public SpecialModelnameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SpecialModelnameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,11 +179,11 @@ public SpecialModelnameMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -194,15 +193,15 @@ public SpecialModelnameMap validate(Map arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SpecialModelname1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SpecialModelname1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SpecialModelname1BoxedMap(validate(arg, configuration)); } @Override - public SpecialModelname1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SpecialModelname1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java index 2eda6c59628..3cd9d77465b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -45,7 +44,7 @@ protected StringBooleanMapMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static StringBooleanMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static StringBooleanMapMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return StringBooleanMap1.getInstance().validate(arg, configuration); } @@ -154,7 +153,7 @@ public StringBooleanMapMap getNewInstance(Map arg, List pathToItem return new StringBooleanMapMap(castProperties); } - public StringBooleanMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringBooleanMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -166,11 +165,11 @@ public StringBooleanMapMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -180,15 +179,15 @@ public StringBooleanMapMap validate(Map arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringBooleanMap1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringBooleanMap1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new StringBooleanMap1BoxedMap(validate(arg, configuration)); } @Override - public StringBooleanMap1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringBooleanMap1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java index 0ca779f13ba..75aa221d691 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -110,7 +109,7 @@ public static StringEnum1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,7 +120,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,23 +131,23 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public Void validate(NullStringEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public Void validate(NullStringEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public String validate(StringStringEnumEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringStringEnumEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -160,22 +159,22 @@ public String validate(StringStringEnumEnums arg,SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringEnum1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringEnum1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new StringEnum1BoxedVoid(validate(arg, configuration)); } @Override - public StringEnum1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringEnum1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringEnum1BoxedString(validate(arg, configuration)); } @Override - public StringEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java index 5bcc7f5a40e..995121cb014 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -81,7 +80,7 @@ public static StringEnumWithDefaultValue1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -92,16 +91,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringStringEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringStringEnumWithDefaultValueEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -110,22 +109,22 @@ public String validate(StringStringEnumWithDefaultValueEnums arg,SchemaConfigura } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public StringEnumWithDefaultValue1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringEnumWithDefaultValue1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringEnumWithDefaultValue1BoxedString(validate(arg, configuration)); } @Override - public StringEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java index a1855745f4a..8cb16f298db 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -58,7 +57,7 @@ public static StringWithValidation1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -69,11 +68,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -83,15 +82,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringWithValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringWithValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringWithValidation1BoxedString(validate(arg, configuration)); } @Override - public StringWithValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringWithValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java index 04847ec6ab9..6b1b1a88433 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -61,7 +60,7 @@ protected TagMap(FrozenMap<@Nullable Object> m) { "id", "name" ); - public static TagMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static TagMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Tag1.getInstance().validate(arg, configuration); } @@ -223,7 +222,7 @@ public TagMap getNewInstance(Map arg, List pathToItem, PathToSchem return new TagMap(castProperties); } - public TagMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TagMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,11 +234,11 @@ public TagMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -249,15 +248,15 @@ public TagMap validate(Map arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Tag1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Tag1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Tag1BoxedMap(validate(arg, configuration)); } @Override - public Tag1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Tag1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java index 924d3cbbec0..3bc2f282022 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -109,7 +108,7 @@ public static Triangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,7 +120,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -133,7 +132,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,24 +143,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,15 +171,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -204,7 +203,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -238,7 +237,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -250,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -265,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -286,31 +285,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Triangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedVoid(validate(arg, configuration)); } @Override - public Triangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedBoolean(validate(arg, configuration)); } @Override - public Triangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedNumber(validate(arg, configuration)); } @Override - public Triangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedString(validate(arg, configuration)); } @Override - public Triangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedList(validate(arg, configuration)); } @Override - public Triangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedMap(validate(arg, configuration)); } @Override - public Triangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -326,7 +325,7 @@ public Triangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java index 1ed56881f39..56a2cbfeeb5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -88,7 +87,7 @@ public static ShapeType getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -99,16 +98,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -118,15 +117,15 @@ public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuratio throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeTypeBoxedString(validate(arg, configuration)); } @Override - public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -150,7 +149,7 @@ protected TriangleInterfaceMap(FrozenMap<@Nullable Object> m) { "triangleType" ); public static final Set optionalKeys = Set.of(); - public static TriangleInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static TriangleInterfaceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return TriangleInterface1.getInstance().validate(arg, configuration); } @@ -348,7 +347,7 @@ public static TriangleInterface1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -360,7 +359,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -372,7 +371,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -383,24 +382,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -411,15 +410,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -443,7 +442,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -477,7 +476,7 @@ public TriangleInterfaceMap getNewInstance(Map arg, List pathToIte return new TriangleInterfaceMap(castProperties); } - public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -489,7 +488,7 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -504,7 +503,7 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -525,31 +524,31 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configur throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedVoid(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedBoolean(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedNumber(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedString(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedList(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedMap(validate(arg, configuration)); } @Override - public TriangleInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -565,7 +564,7 @@ public TriangleInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java index 4d41b3a5bdb..8455abea757 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -60,7 +59,7 @@ public static UUIDString1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -71,11 +70,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -85,15 +84,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UUIDString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UUIDString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UUIDString1BoxedString(validate(arg, configuration)); } @Override - public UUIDString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UUIDString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java index 347391cbacc..ff051614480 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -181,7 +180,7 @@ public static ObjectWithNoDeclaredPropsNullable getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,7 +213,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -226,13 +225,13 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -244,22 +243,22 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithNoDeclaredPropsNullableBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNoDeclaredPropsNullableBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithNoDeclaredPropsNullableBoxedVoid(validate(arg, configuration)); } @Override - public ObjectWithNoDeclaredPropsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNoDeclaredPropsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithNoDeclaredPropsNullableBoxedMap(validate(arg, configuration)); } @Override - public ObjectWithNoDeclaredPropsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNoDeclaredPropsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -349,7 +348,7 @@ public static AnyTypeExceptNullProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -361,7 +360,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -373,7 +372,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -384,24 +383,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -412,15 +411,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -444,7 +443,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -478,7 +477,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -490,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -505,7 +504,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -526,31 +525,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyTypeExceptNullPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedString(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedList(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedMap(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -566,7 +565,7 @@ public AnyTypeExceptNullPropBoxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -601,7 +600,7 @@ protected UserMap(FrozenMap<@Nullable Object> m) { "anyTypeExceptNullProp", "anyTypePropNullable" ); - public static UserMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static UserMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return User1.getInstance().validate(arg, configuration); } @@ -1187,7 +1186,7 @@ public UserMap getNewInstance(Map arg, List pathToItem, PathToSche return new UserMap(castProperties); } - public UserMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UserMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1199,11 +1198,11 @@ public UserMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1213,15 +1212,15 @@ public UserMap validate(Map arg, SchemaConfiguration configuration) throws throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public User1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public User1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new User1BoxedMap(validate(arg, configuration)); } @Override - public User1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public User1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java index fa016ed0ef6..10d89abd9fd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -102,7 +101,7 @@ public static ClassName getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -113,16 +112,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -132,15 +131,15 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -155,7 +154,7 @@ protected WhaleMap(FrozenMap<@Nullable Object> m) { "hasBaleen", "hasTeeth" ); - public static WhaleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static WhaleMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Whale1.getInstance().validate(arg, configuration); } @@ -342,7 +341,7 @@ public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSch return new WhaleMap(castProperties); } - public WhaleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public WhaleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -354,11 +353,11 @@ public WhaleMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -368,15 +367,15 @@ public WhaleMap validate(Map arg, SchemaConfiguration configuration) throw throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Whale1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Whale1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Whale1BoxedMap(validate(arg, configuration)); } @Override - public Whale1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Whale1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java index f17287ff271..0b9d57cfa03 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -95,7 +94,7 @@ public static Type getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -106,16 +105,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringTypeEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringTypeEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -125,15 +124,15 @@ public String validate(StringTypeEnums arg,SchemaConfiguration configuration) th throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new TypeBoxedString(validate(arg, configuration)); } @Override - public TypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringClassNameEnums implements StringValueMethod { @@ -184,7 +183,7 @@ public static ClassName getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,16 +194,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringClassNameEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -214,15 +213,15 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -236,7 +235,7 @@ protected ZebraMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "type" ); - public static ZebraMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ZebraMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Zebra1.getInstance().validate(arg, configuration); } @@ -472,7 +471,7 @@ public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSch return new ZebraMap(castProperties); } - public ZebraMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ZebraMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -484,11 +483,11 @@ public ZebraMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -498,15 +497,15 @@ public ZebraMap validate(Map arg, SchemaConfiguration configuration) throw throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Zebra1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Zebra1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Zebra1BoxedMap(validate(arg, configuration)); } @Override - public Zebra1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Zebra1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java index 6ba33b6bb8d..0fc91100784 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.parameter.ParameterStyle; @@ -32,7 +31,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { + 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)) { @@ -44,7 +43,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { + 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) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java index 89728acfb77..42387a7859b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java @@ -4,12 +4,11 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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, InvalidTypeException; - @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException; + 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/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java index b253262dc13..0f929d9c63b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.parameter.ParameterStyle; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; @@ -33,7 +32,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { + 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); @@ -88,7 +87,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { + 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); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java index c0ee0aa2552..b6dd1d97b37 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -63,7 +62,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java index f3d1a4c9c88..ee80dad1860 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java index 23be67ef64f..b01a73ce335 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java index d399d737436..475bc216c9f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -66,7 +65,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java index fbcec1deec8..84e1e36efe5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -67,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java index 8597436d355..113973108cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -66,7 +65,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java index 27d5e082e04..a721eaf3fb8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected HeaderParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "someHeader" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -151,7 +150,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,11 +162,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -177,15 +176,15 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java index f896975eb9c..0dc2b07dfaf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter1.Schema1; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "subDir" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -171,7 +170,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,11 +182,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -197,15 +196,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java index 86eecd81c6f..3a0905419c6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java index 8f0871fbb01..4110959c0e3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -71,7 +70,7 @@ public static Schema11 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -82,16 +81,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -101,15 +100,15 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema11BoxedString(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java index e59706308c9..9fbb4015a95 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "subDir" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -171,7 +170,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,11 +182,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -197,15 +196,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java index 07b9fc0a12d..e8c5c6bd329 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected QueryParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "searchStr" ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -151,7 +150,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,11 +162,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -177,15 +176,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java index 41528d925e3..a491608f72f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java index 0c968d356f1..b6b17e739c3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -71,7 +70,7 @@ public static RouteParamSchema01 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -82,16 +81,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringRouteParamSchemaEnums0 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringRouteParamSchemaEnums0 arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -101,15 +100,15 @@ public String validate(StringRouteParamSchemaEnums0 arg,SchemaConfiguration conf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RouteParamSchema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RouteParamSchema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RouteParamSchema01BoxedString(validate(arg, configuration)); } @Override - public RouteParamSchema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RouteParamSchema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java index d29fa64fa15..4bdf41e9a2f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected HeaderParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "someHeader" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -151,7 +150,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,11 +162,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -177,15 +176,15 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java index 19c4f712186..f0dcd660250 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "subDir" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -171,7 +170,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,11 +182,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -197,15 +196,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java index b0e5e86f225..12bcf6c08de 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java index 960b1659b6b..64e2a73038f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fake; @@ -35,7 +34,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -78,7 +77,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java index 10569298a1d..94d40088458 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -35,7 +34,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -83,7 +82,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java index 60f5f954579..913a462909d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -63,7 +62,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java index 4da2bae68c0..18da6442b7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -35,7 +34,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -80,7 +79,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java index 569943097bf..85b788d456c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter1.Schema1; @@ -53,7 +52,7 @@ protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "boolean_group" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -206,7 +205,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,11 +217,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -232,15 +231,15 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java index 15eeef771e2..17b5e6d69e9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter0.Schema0; @@ -57,7 +56,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "int64_group", "string_group" ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -311,7 +310,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -323,11 +322,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -337,15 +336,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java index c67d698847f..1ea719d635f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fake.delete.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java index 1fcfe9d5f82..417a8c466fb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -71,7 +70,7 @@ public static Schema11 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -82,16 +81,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -101,15 +100,15 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema11BoxedString(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java index 6df2a50863a..595c106806d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -71,7 +70,7 @@ public static Schema41 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -82,16 +81,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringSchemaEnums4 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringSchemaEnums4 arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -101,15 +100,15 @@ public String validate(StringSchemaEnums4 arg,SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema41BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema41BoxedString(validate(arg, configuration)); } @Override - public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java index d9389e372af..6e85c71e181 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.get.parameters.parameter0.Schema0; @@ -52,7 +51,7 @@ protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { "enum_header_string", "enum_header_string_array" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -188,7 +187,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -200,11 +199,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -214,15 +213,15 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java index a25176302ba..837ef9d55d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.get.parameters.parameter2.Schema2; @@ -56,7 +55,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "enum_query_integer", "enum_query_string_array" ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -304,7 +303,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -316,11 +315,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -330,15 +329,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java index cf26ab00125..6027d75594f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fake.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fake.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -41,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java index 197ed207b5e..2b31d119440 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -77,7 +76,7 @@ public static Items0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -88,16 +87,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -106,22 +105,22 @@ public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Items0BoxedString(validate(arg, configuration)); } @Override - public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -129,7 +128,7 @@ public static class SchemaList0 extends FrozenList { protected SchemaList0(FrozenList m) { super(m); } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { return Schema01.getInstance().validate(arg, configuration); } } @@ -215,7 +214,7 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList0(newInstanceItems); } - public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -226,11 +225,11 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -240,15 +239,15 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java index 7231dd2ee1f..02907bcc352 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -75,7 +74,7 @@ public static Schema11 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,16 +85,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -104,22 +103,22 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema11BoxedString(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java index 5f5c687684c..ffb41afbb75 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -77,7 +76,7 @@ public static Items2 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -88,16 +87,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringItemsEnums2 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringItemsEnums2 arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -106,22 +105,22 @@ public String validate(StringItemsEnums2 arg,SchemaConfiguration configuration) } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Items2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Items2BoxedString(validate(arg, configuration)); } @Override - public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -129,7 +128,7 @@ public static class SchemaList2 extends FrozenList { protected SchemaList2(FrozenList m) { super(m); } - public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException { return Schema21.getInstance().validate(arg, configuration); } } @@ -215,7 +214,7 @@ public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList2(newInstanceItems); } - public SchemaList2 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SchemaList2 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -226,11 +225,11 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -240,15 +239,15 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema21BoxedList(validate(arg, configuration)); } @Override - public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java index 84a671f3eab..37fb6b578b6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -75,7 +74,7 @@ public static Schema31 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,16 +85,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringSchemaEnums3 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringSchemaEnums3 arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -104,22 +103,22 @@ public String validate(StringSchemaEnums3 arg,SchemaConfiguration configuration) } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Schema31BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema31BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema31BoxedString(validate(arg, configuration)); } @Override - public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java index bbf30358b9e..e7762fe4493 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -121,7 +120,7 @@ public static Schema41 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,40 +130,40 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @Override - public int validate(IntegerSchemaEnums4 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public int validate(IntegerSchemaEnums4 arg,SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongSchemaEnums4 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public long validate(LongSchemaEnums4 arg,SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatSchemaEnums4 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public float validate(FloatSchemaEnums4 arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleSchemaEnums4 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public double validate(DoubleSchemaEnums4 arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -174,15 +173,15 @@ public double validate(DoubleSchemaEnums4 arg,SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema41BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema41BoxedNumber(validate(arg, configuration)); } @Override - public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java index 6206118464a..18dcf62eda7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -91,7 +90,7 @@ public static Schema51 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -100,26 +99,26 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public float validate(FloatSchemaEnums5 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public float validate(FloatSchemaEnums5 arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleSchemaEnums5 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public double validate(DoubleSchemaEnums5 arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -129,15 +128,15 @@ public double validate(DoubleSchemaEnums5 arg,SchemaConfiguration configuration) throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema51BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema51BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema51BoxedNumber(validate(arg, configuration)); } @Override - public Schema51Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema51Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index d40a45957c1..ea8f9b6295e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -85,7 +84,7 @@ public static ApplicationxwwwformurlencodedItems getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -96,16 +95,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringApplicationxwwwformurlencodedItemsEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringApplicationxwwwformurlencodedItemsEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -114,22 +113,22 @@ public String validate(StringApplicationxwwwformurlencodedItemsEnums arg,SchemaC } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public ApplicationxwwwformurlencodedItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedItemsBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -137,7 +136,7 @@ public static class ApplicationxwwwformurlencodedEnumFormStringArrayList extends protected ApplicationxwwwformurlencodedEnumFormStringArrayList(FrozenList m) { super(m); } - public static ApplicationxwwwformurlencodedEnumFormStringArrayList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationxwwwformurlencodedEnumFormStringArrayList of(List arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationxwwwformurlencodedEnumFormStringArray.getInstance().validate(arg, configuration); } } @@ -223,7 +222,7 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList getNewInstance(List< return new ApplicationxwwwformurlencodedEnumFormStringArrayList(newInstanceItems); } - public ApplicationxwwwformurlencodedEnumFormStringArrayList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ApplicationxwwwformurlencodedEnumFormStringArrayList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -234,11 +233,11 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList validate(List arg } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -248,15 +247,15 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList validate(List arg throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedEnumFormStringArrayBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedEnumFormStringArrayBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringApplicationxwwwformurlencodedEnumFormStringEnums implements StringValueMethod { @@ -312,7 +311,7 @@ public static ApplicationxwwwformurlencodedEnumFormString getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -323,16 +322,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringApplicationxwwwformurlencodedEnumFormStringEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringApplicationxwwwformurlencodedEnumFormStringEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -341,22 +340,22 @@ public String validate(StringApplicationxwwwformurlencodedEnumFormStringEnums ar } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public ApplicationxwwwformurlencodedEnumFormStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedEnumFormStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedEnumFormStringBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedEnumFormStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedEnumFormStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -369,7 +368,7 @@ protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) "enum_form_string_array", "enum_form_string" ); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); } @@ -513,7 +512,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -525,11 +524,11 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -539,15 +538,15 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java index ead22eaf4b1..34af3ea2174 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code404Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java index d6ad76d4229..5ea188b2480 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fake.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java index a5dc33043b3..9e368e1e05c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java index 713a77d0b6d..7a2562b0a60 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fake.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fake.post.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -41,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index b25205eba36..bb231ecf95e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DateJsonSchema; @@ -74,7 +73,7 @@ public static ApplicationxwwwformurlencodedInteger getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -84,28 +83,28 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -115,15 +114,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedIntegerBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -165,7 +164,7 @@ public static ApplicationxwwwformurlencodedInt32 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -175,20 +174,20 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -198,15 +197,15 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedInt32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedInt32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedInt32BoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedInt32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedInt32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -258,7 +257,7 @@ public static ApplicationxwwwformurlencodedNumber getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -268,28 +267,28 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -299,15 +298,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedNumberBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -348,7 +347,7 @@ public static ApplicationxwwwformurlencodedFloat getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -357,16 +356,16 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -376,15 +375,15 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedFloatBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedFloatBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedFloatBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedFloatBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedFloatBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -426,7 +425,7 @@ public static ApplicationxwwwformurlencodedDouble getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -435,16 +434,16 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val PathToSchemasMap pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet); return castArg; } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -454,15 +453,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedDoubleBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedDoubleBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedDoubleBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedDoubleBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedDoubleBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -502,7 +501,7 @@ public static ApplicationxwwwformurlencodedString getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -513,11 +512,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -527,15 +526,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedStringBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -574,7 +573,7 @@ public static ApplicationxwwwformurlencodedPatternWithoutDelimiter getInstance() } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -585,11 +584,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -599,15 +598,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -679,7 +678,7 @@ public static ApplicationxwwwformurlencodedDateTime getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -690,11 +689,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -703,22 +702,22 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public ApplicationxwwwformurlencodedDateTimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedDateTimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedDateTimeBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedDateTimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedDateTimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -757,7 +756,7 @@ public static ApplicationxwwwformurlencodedPassword getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -768,11 +767,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -782,15 +781,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedPasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedPasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedPasswordBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedPasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedPasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -827,7 +826,7 @@ protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) "password", "callback" ); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); } @@ -1551,7 +1550,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1563,11 +1562,11 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1577,15 +1576,15 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java index bf6bdfef7bc..4e6abc094e0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java index 29428395e7a..07c73d4f887 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java index a1a6558ff46..be8ef287de3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java index 63aa0097bea..0a17d85055f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java index 087bca2e097..ddc35d6146a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -63,7 +62,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java index facc5c9d5cd..0beb85a7c98 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java index ae426076e95..ba8cd1a869b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -34,7 +33,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -69,7 +68,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java index ec37aacdef9..03360b53511 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected QueryParametersMap(FrozenMap m) { "query" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -165,7 +164,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,11 +176,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -191,15 +190,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java index 47cb64a34d3..6109b533036 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java index 5834c52bde6..9740580cca0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fakecasesensitiveparams; @@ -31,7 +30,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -60,7 +59,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java index a087ffae8dc..f3482c8b143 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter0.Schema0; @@ -54,7 +53,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "some_var" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -303,7 +302,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -315,11 +314,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -329,15 +328,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java index 1f55adc41c5..657dc7e0feb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java index 27e33d07e95..dd5ea58f497 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -35,7 +34,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -76,7 +75,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java index 1550b533cf8..6c0629531b3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java index 20ec0e0f539..89d40f66041 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java index 8351af2e5bc..cedaa59345b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fakedeletecoffeeid; @@ -31,7 +30,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +58,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java index 8d43a07f983..afb07c84f67 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "id" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -165,7 +164,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,11 +176,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -191,15 +190,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java index a3d4538aacc..992b7a97bbf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.Code200Response; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -47,7 +46,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java index 3baf5feab2a..1035e7e22d1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java index 9be4c625bed..9e1fcb44bc3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fakehealth; @@ -29,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -54,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java index 07e95d11d13..60cdc4cf144 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakehealth.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java index c0b16aeb80b..1de1e383c20 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java index dbfd04a0a0f..6b9aec9067f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -63,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java index 4479a0fc1d7..aa94f2fbb73 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 60bef93ad40..552865b8b4c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -45,7 +44,7 @@ protected ApplicationjsonSchemaMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } @@ -143,7 +142,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -155,11 +154,11 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -169,15 +168,15 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java index c5408571af2..06f4d279174 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -34,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -76,7 +75,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java index d214f59fe6a..144b9be7749 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter0.Schema0; @@ -52,7 +51,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "compositionAtRoot", "compositionInProperty" ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -230,7 +229,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,11 +241,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -256,15 +255,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java index 28c02844de2..ce85d87ccd8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java index d3d1e6b83c3..2ce60fa7be0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -68,7 +67,7 @@ public static Schema00 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -79,11 +78,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -93,15 +92,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema00BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema00BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema00BoxedString(validate(arg, configuration)); } @Override - public Schema00Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema00Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -171,7 +170,7 @@ public static Schema01 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,7 +194,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,24 +205,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -234,15 +233,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -266,7 +265,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -300,7 +299,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -312,7 +311,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -327,7 +326,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -348,31 +347,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedVoid(validate(arg, configuration)); } @Override - public Schema01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedBoolean(validate(arg, configuration)); } @Override - public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedNumber(validate(arg, configuration)); } @Override - public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedString(validate(arg, configuration)); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedMap(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -388,7 +387,7 @@ public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java index 4418ead419b..44cb10452d6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -70,7 +69,7 @@ public static Schema01 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -81,11 +80,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -95,15 +94,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedString(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -173,7 +172,7 @@ public static SomeProp1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,7 +184,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,24 +207,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -236,15 +235,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -268,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -302,7 +301,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -329,7 +328,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -350,31 +349,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SomeProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedVoid(validate(arg, configuration)); } @Override - public SomeProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedBoolean(validate(arg, configuration)); } @Override - public SomeProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedNumber(validate(arg, configuration)); } @Override - public SomeProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedString(validate(arg, configuration)); } @Override - public SomeProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedList(validate(arg, configuration)); } @Override - public SomeProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedMap(validate(arg, configuration)); } @Override - public SomeProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -390,7 +389,7 @@ public SomeProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -402,7 +401,7 @@ protected SchemaMap1(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "someProp" ); - public static SchemaMap1 of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SchemaMap1 of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema11.getInstance().validate(arg, configuration); } @@ -556,7 +555,7 @@ public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToS return new SchemaMap1(castProperties); } - public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -568,11 +567,11 @@ public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -582,15 +581,15 @@ public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema11BoxedMap(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 71b2f8c0688..90eeb11bea9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -68,7 +67,7 @@ public static Applicationjson0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -79,11 +78,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -93,15 +92,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Applicationjson0BoxedString(validate(arg, configuration)); } @Override - public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -171,7 +170,7 @@ public static ApplicationjsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,7 +194,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,24 +205,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -234,15 +233,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -266,7 +265,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -300,7 +299,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -312,7 +311,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -327,7 +326,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -348,31 +347,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedString(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -388,7 +387,7 @@ public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCo } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 75874622842..469b099493b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -70,7 +69,7 @@ public static Multipartformdata0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -81,11 +80,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -95,15 +94,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Multipartformdata0BoxedString(validate(arg, configuration)); } @Override - public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -173,7 +172,7 @@ public static MultipartformdataSomeProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,7 +184,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,24 +207,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -236,15 +235,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -268,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -302,7 +301,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -329,7 +328,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -350,31 +349,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedVoid(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedBoolean(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedNumber(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedString(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedList(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -390,7 +389,7 @@ public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, Schem } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -402,7 +401,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "someProp" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -556,7 +555,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -568,11 +567,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -582,15 +581,15 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java index f581d9c5a25..d8bdbbf90a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -53,7 +52,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + 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 ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java index a7fd369ab3f..168cbeb975c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -68,7 +67,7 @@ public static Applicationjson0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -79,11 +78,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -93,15 +92,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Applicationjson0BoxedString(validate(arg, configuration)); } @Override - public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -171,7 +170,7 @@ public static ApplicationjsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,7 +194,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,24 +205,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -234,15 +233,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -266,7 +265,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -300,7 +299,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -312,7 +311,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -327,7 +326,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -348,31 +347,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedString(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -388,7 +387,7 @@ public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCo } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java index c23f54cc10c..68748fd1603 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -70,7 +69,7 @@ public static Multipartformdata0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -81,11 +80,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -95,15 +94,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Multipartformdata0BoxedString(validate(arg, configuration)); } @Override - public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -173,7 +172,7 @@ public static MultipartformdataSomeProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,7 +184,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,24 +207,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -236,15 +235,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -268,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -302,7 +301,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -329,7 +328,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -350,31 +349,31 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedVoid(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedBoolean(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedNumber(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedString(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedList(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -390,7 +389,7 @@ public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, Schem } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -402,7 +401,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "someProp" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -556,7 +555,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -568,11 +567,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -582,15 +581,15 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java index 1e94f899e16..7f09ba7a1f4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java index 62abcd15f19..f583e035a7d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 09715eef974..9a70e8487d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -60,7 +59,7 @@ protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) "param2" ); public static final Set optionalKeys = Set.of(); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); } @@ -234,7 +233,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,11 +245,11 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -260,15 +259,15 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java index af3c446126b..11acaae5b01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java index ee2ece51011..8b8c72ea1e2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java index 06cbd2da4b7..256707d6c16 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java index 8ae07ef27c3..c4ad7ae4d22 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java index 9b7afb9998d..d1c8cfba01a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { Applicationjsoncharsetutf8MediaType thisMediaType = (Applicationjsoncharsetutf8MediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new Applicationjsoncharsetutf8ResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java index a4d6e976d8f..eec76f14d75 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java index db0147ab306..0eeb2290be0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index fc0e9f7370a..16a494f8b3d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected ApplicationjsonSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "a" ); - public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } @@ -160,7 +159,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,11 +171,11 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -186,15 +185,15 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 1e47f7b5fb9..684ede7bd69 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "b" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -160,7 +159,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,11 +171,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -186,15 +185,15 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java index cbb82ae131a..30659d828c6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java index 8c64746e29d..c741ed63ddb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fakemultipleresponsebodies; @@ -29,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -54,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java index 373ccad7971..3325b9085a8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.Code202Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -48,7 +47,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java index 6043aa1edeb..567d4148b74 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java index fcce76ef9cf..2783f09c99f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code202Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java index 3c8238bde96..d7db1ca4247 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fakemultiplesecurities; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -67,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java index 796036a87ae..94d796bdc3c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java index faeb00a825a..14964db98f2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java index 8117d757cff..e4f5836bd16 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fakeobjinquery; @@ -31,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -63,7 +62,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java index 8bacd8219d7..351fd68acab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected QueryParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "mapBean" ); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -151,7 +150,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,11 +162,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -177,15 +176,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java index 41b43464d15..1cb6c0ca42e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java index 7e0d45d29ef..f94e9fadd7a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -48,7 +47,7 @@ protected SchemaMap0(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "keyword" ); - public static SchemaMap0 of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SchemaMap0 of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema01.getInstance().validate(arg, configuration); } @@ -160,7 +159,7 @@ public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToS return new SchemaMap0(castProperties); } - public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,11 +171,11 @@ public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -186,15 +185,15 @@ public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) thr throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedMap(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java index 7f154f0901e..6f8f32dcdab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -95,7 +94,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java index 1eb0036adbf..0acba3877bc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter14.Schema14; @@ -58,7 +57,7 @@ protected CookieParametersMap(FrozenMap<@Nullable Object> m) { "A-B", "self" ); - public static CookieParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static CookieParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return CookieParameters1.getInstance().validate(arg, configuration); } @@ -246,7 +245,7 @@ public CookieParametersMap getNewInstance(Map arg, List pathToItem return new CookieParametersMap(castProperties); } - public CookieParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CookieParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,11 +257,11 @@ public CookieParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -272,15 +271,15 @@ public CookieParametersMap validate(Map arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public CookieParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CookieParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new CookieParameters1BoxedMap(validate(arg, configuration)); } @Override - public CookieParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CookieParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java index f914e01801c..904e373ed76 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter5.Schema5; @@ -56,7 +55,7 @@ protected HeaderParametersMap(FrozenMap<@Nullable Object> m) { "A-B", "self" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -218,7 +217,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -230,11 +229,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -244,15 +243,15 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java index 350cde408ec..8e4742efa0f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter10.Schema10; @@ -58,7 +57,7 @@ protected PathParametersMap(FrozenMap<@Nullable Object> m) { "self" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -779,7 +778,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -791,11 +790,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -805,15 +804,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java index 75cb0906e77..0a9975c014b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter0.Schema0; @@ -58,7 +57,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "A-B", "self" ); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -246,7 +245,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,11 +257,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -272,15 +271,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java index 9f06472df14..63bb9a16183 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java index 4e0667e9eb9..7cda67e481f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java index e8f428c1e2e..76762c2106d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java index c546986c419..c0cddd94174 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java index 9ea03b2b36a..499c915f8f3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationxpemfileMediaType thisMediaType = (ApplicationxpemfileMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxpemfileResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java index ed37398b126..bc14ed14094 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -85,7 +84,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java index 6e22e59d43c..a568880cab5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "petId" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -183,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,11 +194,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -209,15 +208,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java index 9eddc5a2d15..ae1b734dfce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 6dc3c67b7bf..50a815585cb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -62,7 +61,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "additionalMetadata" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -211,7 +210,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,11 +222,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -237,15 +236,15 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java index 0f6bf6c64d3..e12ad3e1ff1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java index 3890a98c04b..1d2525666c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fakequeryparamwithjsoncontenttype; @@ -31,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -60,7 +59,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java index 415e967f817..12618cb5ee0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson.Schema0; @@ -50,7 +49,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "someParam" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -213,7 +212,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -225,11 +224,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -239,15 +238,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java index 3fa5ce2e6a4..67fcc96df1a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java index 04bfc3d9134..1c25969ab61 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java index dfb5d3fdddd..79bfed8fe0c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fakeredirection; @@ -29,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -54,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java index da82930d54d..addd1e3384e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.fakeredirection.get.responses.Code303Response; import org.openapijsonschematools.client.paths.fakeredirection.get.responses.Code3XXResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -53,7 +52,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java index 5e200656719..80bbe5222cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java index 454b6e7947c..fc5125abeca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java index f9dbc60a250..d640b1e04c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fakerefobjinquery; @@ -31,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -63,7 +62,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java index 7353b5a0858..5f291a86045 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.schemas.Foo; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -50,7 +49,7 @@ protected QueryParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "mapBean" ); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -151,7 +150,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,11 +162,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -177,15 +176,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java index 3e8158b527e..fa40e5c878e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java index 93a7b5975ff..3b1dad9974c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java index 7b8ea36efd5..dbe304b8a0f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java index 63eb944c1cb..c6902020026 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java index 89242e2d4c0..13d1ccbab8f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java index 32d76ef966e..4e054707d20 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java index 15be766f42d..9ee1287a9d1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java index ada45acb5ce..95db0847da6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java index 74ce65b7258..755d4d97568 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java index 13f2508c3de..2f85215f463 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java index ce59f14897c..97d3e46b39c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java index 59f328b3436..bdc96d2297e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java index ffde6c64e13..aa7d008cb6e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java index 30bd665a405..02719172619 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java index 04737b6a945..9668bb4535f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java index 43657448da3..23ed2009366 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java index 71576e55171..278c82a493c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -63,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java index a62bef5028e..47df1517739 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java index 758993678dd..6565afc0de3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java index c42b1daa0a0..1eaba218885 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java index 5c619f2615f..64721d3dfb9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java index b20ec46379e..9e8e93aca7f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java index 371e89bd77e..a8a554dc678 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java index 805be560b86..cf4c1d15769 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java index a68e6a31fb7..a2b03d8a56d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java index 3798f955bf6..c2b331a1125 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java index 796169823ad..c2d043e5a24 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java index 63ac9182ca2..78842227518 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java index 2df81dfbde5..58e670e37cc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fakeresponsewithoutschema; @@ -29,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -54,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java index a435d216366..829ad9e8208 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java index 797bc568bdb..01622b70b62 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java index 9e5b9b621a5..98a0fd0f5e2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Faketestqueryparamters; @@ -31,7 +30,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -60,7 +59,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java index 47c211d528a..c4573b4f79d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.schemas.StringWithValidation; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter0.Schema0; @@ -60,7 +59,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "url" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -1475,7 +1474,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1487,11 +1486,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -1501,15 +1500,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java index fbea3022d59..e24c9f4f38b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java index 7e69b2efefd..6a6b47f4a85 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -38,7 +37,7 @@ public static class SchemaList0 extends FrozenList { protected SchemaList0(FrozenList m) { super(m); } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { return Schema01.getInstance().validate(arg, configuration); } } @@ -119,7 +118,7 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList0(newInstanceItems); } - public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,11 +129,11 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -144,15 +143,15 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java index 7dc49eb28e6..c386c6cd560 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -38,7 +37,7 @@ public static class SchemaList1 extends FrozenList { protected SchemaList1(FrozenList m) { super(m); } - public static SchemaList1 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SchemaList1 of(List arg, SchemaConfiguration configuration) throws ValidationException { return Schema11.getInstance().validate(arg, configuration); } } @@ -119,7 +118,7 @@ public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList1(newInstanceItems); } - public SchemaList1 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SchemaList1 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,11 +129,11 @@ public SchemaList1 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -144,15 +143,15 @@ public SchemaList1 validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema11BoxedList(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java index 9c02099dafc..b9a650f1e17 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -38,7 +37,7 @@ public static class SchemaList2 extends FrozenList { protected SchemaList2(FrozenList m) { super(m); } - public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SchemaList2 of(List arg, SchemaConfiguration configuration) throws ValidationException { return Schema21.getInstance().validate(arg, configuration); } } @@ -119,7 +118,7 @@ public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList2(newInstanceItems); } - public SchemaList2 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SchemaList2 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,11 +129,11 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -144,15 +143,15 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema21BoxedList(validate(arg, configuration)); } @Override - public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java index c7cde49fc1c..2e44f938af9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -38,7 +37,7 @@ public static class SchemaList3 extends FrozenList { protected SchemaList3(FrozenList m) { super(m); } - public static SchemaList3 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SchemaList3 of(List arg, SchemaConfiguration configuration) throws ValidationException { return Schema31.getInstance().validate(arg, configuration); } } @@ -119,7 +118,7 @@ public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList3(newInstanceItems); } - public SchemaList3 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SchemaList3 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,11 +129,11 @@ public SchemaList3 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -144,15 +143,15 @@ public SchemaList3 validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema31BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema31BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema31BoxedList(validate(arg, configuration)); } @Override - public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java index b1df82a9902..5dcc583172d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -38,7 +37,7 @@ public static class SchemaList4 extends FrozenList { protected SchemaList4(FrozenList m) { super(m); } - public static SchemaList4 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SchemaList4 of(List arg, SchemaConfiguration configuration) throws ValidationException { return Schema41.getInstance().validate(arg, configuration); } } @@ -119,7 +118,7 @@ public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList4(newInstanceItems); } - public SchemaList4 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SchemaList4 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,11 +129,11 @@ public SchemaList4 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -144,15 +143,15 @@ public SchemaList4 validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema41BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema41BoxedList(validate(arg, configuration)); } @Override - public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java index 034b36f6c09..0cfde8026ef 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -63,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java index 1fb9ed96fe3..2a8598335a0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java index bc70432957e..f9b8bd33e16 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationoctetstreamMediaType thisMediaType = (ApplicationoctetstreamMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationoctetstreamResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java index 10ff3668b11..87f187dd7e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java index 9af74e296f1..d57c98d7c24 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 78f810b7dde..bc7210852e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -62,7 +61,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "additionalMetadata" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -211,7 +210,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,11 +222,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -237,15 +236,15 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java index fda56d8d98b..5ef05875230 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java index 039190ef90c..7be8841da1e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -67,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java index 8c20a8f2354..2507eff62d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 028896bfe7b..ceefe884ce3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -47,7 +46,7 @@ public static class MultipartformdataFilesList extends FrozenList { protected MultipartformdataFilesList(FrozenList m) { super(m); } - public static MultipartformdataFilesList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MultipartformdataFilesList of(List arg, SchemaConfiguration configuration) throws ValidationException { return MultipartformdataFiles.getInstance().validate(arg, configuration); } } @@ -128,7 +127,7 @@ public MultipartformdataFilesList getNewInstance(List arg, List pathT return new MultipartformdataFilesList(newInstanceItems); } - public MultipartformdataFilesList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public MultipartformdataFilesList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -139,11 +138,11 @@ public MultipartformdataFilesList validate(List arg, SchemaConfiguration conf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -153,15 +152,15 @@ public MultipartformdataFilesList validate(List arg, SchemaConfiguration conf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataFilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataFilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataFilesBoxedList(validate(arg, configuration)); } @Override - public MultipartformdataFilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataFilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -173,7 +172,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "files" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -285,7 +284,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -297,11 +296,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -311,15 +310,15 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java index 63eb6225408..8491068775e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java index f6153f8bd79..fe290c34307 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Fakewildcardresponses; @@ -29,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -54,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java index b11902474b6..70451e1cb4c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java @@ -7,7 +7,6 @@ import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code4XXResponse; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code5XXResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -83,7 +82,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java index e6ffd9a14e2..4bb1a115b72 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code1XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java index 45f6f05a1bf..8138d8bc1a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java index ada58f1ca6f..3d9e6eb5638 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code2XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java index fbde66ac240..5a177c3e8ae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code3XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java index 6282c0777bb..944465a02ea 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code4XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java index 86807d6916f..46d31fd8f01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public Code5XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java index a40b0912b2c..ca58d9e23fe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Foo; @@ -29,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -54,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java index 1bad88482dc..63a2d1d6c22 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.foo.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -30,7 +29,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java index fc0399186e9..28ef2eae71c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -40,7 +39,7 @@ public CodedefaultResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java index 5cd8f76499d..860a1e86279 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -37,7 +36,7 @@ protected ApplicationjsonSchemaMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "string" ); - public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationjsonSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationjsonSchema1.getInstance().validate(arg, configuration); } @@ -139,7 +138,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -151,11 +150,11 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -165,15 +164,15 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java index b6996507cc9..336ea6edf71 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.servers.ServerWithVariables; import org.openapijsonschematools.client.schemas.validation.MapUtils; @@ -19,7 +18,7 @@ private static Variables.VariablesMap getVariables() { ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) ); - } catch (ValidationException | InvalidTypeException e) { + } catch (ValidationException e) { throw new RuntimeException(e); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java index 8f3d384647e..8cc25687164 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -96,7 +95,7 @@ public static Version getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -107,16 +106,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -125,22 +124,22 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new VersionBoxedString(validate(arg, configuration)); } @Override - public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -152,7 +151,7 @@ protected VariablesMap(FrozenMap m) { "version" ); public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Variables1.getInstance().validate(arg, configuration); } @@ -273,7 +272,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -285,11 +284,11 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -299,15 +298,15 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java index 38644fb2297..8ac322b163d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -35,7 +34,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -76,7 +75,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java index 72777735bd7..e75a9b792d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -35,7 +34,7 @@ public static Void put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -76,7 +75,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java index f489228252d..1e44c96d53e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.pet.post.responses.Code200Response; import org.openapijsonschematools.client.paths.pet.post.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -41,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java index fa949dd06c9..207a4ef554f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java index 6b6d8741ac7..c5ef091d53a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.pet.put.responses.Code404Response; import org.openapijsonschematools.client.paths.pet.put.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; @@ -36,7 +35,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java index 895a0c711c8..27021cdf728 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java index 783c844b050..b74b875389c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java index 0764ab97ba6..350e155a9c0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java index 35c64dd335e..aa30e9bf00f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Petfindbystatus; @@ -34,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -73,7 +72,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java index 8c386f45f8b..90468bd21f2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.parameter0.Schema0; @@ -51,7 +50,7 @@ protected QueryParametersMap(FrozenMap m) { "status" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -166,7 +165,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -178,11 +177,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -192,15 +191,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java index 39f93fe6169..4e008e2a33b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.Code200Response; import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -41,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java index 2d4d15690ac..d45479cd0dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -79,7 +78,7 @@ public static Items0 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,16 +89,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -108,22 +107,22 @@ public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Items0BoxedString(validate(arg, configuration)); } @Override - public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -131,7 +130,7 @@ public static class SchemaList0 extends FrozenList { protected SchemaList0(FrozenList m) { super(m); } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { return Schema01.getInstance().validate(arg, configuration); } } @@ -217,7 +216,7 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList0(newInstanceItems); } - public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,11 +227,11 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -242,15 +241,15 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java index a2fa568b81b..3ea6e1da098 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java index 5ab4ae0157e..e36810b4c40 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.servers.ServerWithVariables; import org.openapijsonschematools.client.schemas.validation.MapUtils; @@ -19,7 +18,7 @@ private static Variables.VariablesMap getVariables() { ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) ); - } catch (ValidationException | InvalidTypeException e) { + } catch (ValidationException e) { throw new RuntimeException(e); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java index 91d630876a5..402b2e4be8b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -96,7 +95,7 @@ public static Version getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -107,16 +106,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -125,22 +124,22 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new VersionBoxedString(validate(arg, configuration)); } @Override - public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -152,7 +151,7 @@ protected VariablesMap(FrozenMap m) { "version" ); public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Variables1.getInstance().validate(arg, configuration); } @@ -273,7 +272,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -285,11 +284,11 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -299,15 +298,15 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java index cac84c76738..f29d6b59081 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Petfindbytags; @@ -34,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -73,7 +72,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java index 22ad5d4517b..11bb6b1896d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petfindbytags.get.parameters.parameter0.Schema0; @@ -51,7 +50,7 @@ protected QueryParametersMap(FrozenMap m) { "tags" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map> arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -166,7 +165,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -178,11 +177,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -192,15 +191,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java index 55e1353d90b..b29be24d716 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.petfindbytags.get.responses.Code200Response; import org.openapijsonschematools.client.paths.petfindbytags.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -41,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java index ce4ffe4d3db..420ca7fe8b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -38,7 +37,7 @@ public static class SchemaList0 extends FrozenList { protected SchemaList0(FrozenList m) { super(m); } - public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static SchemaList0 of(List arg, SchemaConfiguration configuration) throws ValidationException { return Schema01.getInstance().validate(arg, configuration); } } @@ -119,7 +118,7 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc return new SchemaList0(newInstanceItems); } - public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SchemaList0 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,11 +129,11 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -144,15 +143,15 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java index ecf1d521147..b674ee9ab33 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java index 2af7e68d326..4504536c416 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Petpetid; @@ -35,7 +34,7 @@ public static Void delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -79,7 +78,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java index f54abe64bc6..d61d683a408 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Petpetid; @@ -34,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -72,7 +71,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java index b03b8858661..b9ad09b7104 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public static Void post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -85,7 +84,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Void post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java index 0e14cae85a7..044c81974e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected HeaderParametersMap(FrozenMap m) { public static final Set optionalKeys = Set.of( "api_key" ); - public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static HeaderParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return HeaderParameters1.getInstance().validate(arg, configuration); } @@ -151,7 +150,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,11 +162,11 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -177,15 +176,15 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java index 9b5c91d9392..ed599dfe636 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter1.Schema1; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "petId" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -183,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,11 +194,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -209,15 +208,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java index 33379e74309..6c5d7573a1a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.petpetid.delete.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; @@ -28,7 +27,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java index 228a15165e7..48b687555cd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java index 9dd18c89681..65b7c41a406 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.get.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "petId" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -183,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,11 +194,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -209,15 +208,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java index dc6d70600c1..b0be031e585 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.petpetid.get.responses.Code400Response; import org.openapijsonschematools.client.paths.petpetid.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -45,7 +44,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java index 6d7f5caeb25..2e28a301c5d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -53,7 +52,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java index 3c6472aa971..5bbc55f84a2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java index f1e9aac2176..0aa19c5d169 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java index 75122cf695e..a4306745deb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.post.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "petId" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -183,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,11 +194,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -209,15 +208,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java index 329a163abd6..0f129ddcc1d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.petpetid.post.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; @@ -28,7 +27,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 2392c0da8b5..0b10b8675bd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -60,7 +59,7 @@ protected ApplicationxwwwformurlencodedSchemaMap(FrozenMap<@Nullable Object> m) "name", "status" ); - public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ApplicationxwwwformurlencodedSchema1.getInstance().validate(arg, configuration); } @@ -198,7 +197,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -210,11 +209,11 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -224,15 +223,15 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java index 16810be9dd9..4dfaf36ff01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java index ad98ca897bf..372c6fffde0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -85,7 +84,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java index e62ccf822b9..9418fd079ae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "petId" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -183,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,11 +194,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -209,15 +208,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java index a6a929bb919..ed5b656f912 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.Code200Response; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 3274c7642d8..e6b3f39636f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -61,7 +60,7 @@ protected MultipartformdataSchemaMap(FrozenMap<@Nullable Object> m) { "additionalMetadata", "file" ); - public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static MultipartformdataSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return MultipartformdataSchema1.getInstance().validate(arg, configuration); } @@ -199,7 +198,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -211,11 +210,11 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -225,15 +224,15 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java index 89b72d247eb..111e91bdcf4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Solidus; @@ -29,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -54,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java index 284af850fac..2c1b302e62b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.solidus.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -37,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java index 7bd2f7b8194..49e7b1d5ab7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Storeinventory; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -67,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java index 70f0fe2d50c..1390a3b9d94 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.storeinventory.get.responses.Code200Response; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -38,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java index 5a0c05d3300..ba0d5c15793 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -63,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java index ea3370b1621..c62c12edaf2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.storeorder.post.responses.Code200Response; import org.openapijsonschematools.client.paths.storeorder.post.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -41,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java index cf6301f20cf..fc535ab3955 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -53,7 +52,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java index 74c9668aa25..3d9ae44d402 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java index aa5ebac564b..12139abd4b9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Storeorderorderid; @@ -31,7 +30,7 @@ public static Void delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +58,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java index 8cea573fe40..e585a91d120 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Storeorderorderid; @@ -31,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +58,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java index 75affd39735..d1a63779d53 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "order_id" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -165,7 +164,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,11 +176,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -191,15 +190,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java index 29a3e1766f4..5e9f34d93b7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code400Response; import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; @@ -32,7 +31,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java index 5407a07ffe8..7ad936566fc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java index 24985b372b4..565b71b9a4f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java index 0260a0f7a1a..106faf07142 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.parameter0.Schema0; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "order_id" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -183,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,11 +194,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -209,15 +208,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java index 418c6fb4b88..5c23d3cc14c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code400Response; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -45,7 +44,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java index f9118a29b89..9d05f93bfb2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -57,7 +56,7 @@ public static Schema01 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -67,28 +66,28 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -98,15 +97,15 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedNumber(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java index d356148fabd..e0cea6e6191 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -53,7 +52,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java index 72846a731c2..c3304e02b39 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java index a50cc84f941..5de14a5ccd1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java index 5da53d22478..51f43cc60ac 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -63,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java index 4abec218764..c1cc62b43da 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.user.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -30,7 +29,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java index b580db6b5e1..20148c56e39 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java index 3c7bfbe2c01..a2d805d6d78 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -63,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java index 397d3835a1a..79c988e4f1b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -30,7 +29,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java index 4ce485764ed..bd617d9262d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java index 1f20af95fa2..f8f78fabe13 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java @@ -9,7 +9,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -32,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -63,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java index 8a532eb3e89..8c24f5ea31e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -30,7 +29,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java index ae83348ddcb..a8989114b04 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java index 7426dc6d2ef..c2660417c71 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Userlogin; @@ -31,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -60,7 +59,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java index 776ed7baff6..01dd3860ee8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter0.Schema0; @@ -52,7 +51,7 @@ protected QueryParametersMap(FrozenMap<@Nullable Object> m) { "username" ); public static final Set optionalKeys = Set.of(); - public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static QueryParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return QueryParameters1.getInstance().validate(arg, configuration); } @@ -215,7 +214,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -227,11 +226,11 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -241,15 +240,15 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java index 6b4e717f4a0..0df32af2421 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.Code200ResponseHeadersSchema; import org.openapijsonschematools.client.paths.userlogin.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -42,7 +41,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java index 9eef5825f29..399cc9fd94f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -55,7 +54,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); @@ -67,7 +66,7 @@ protected SealedResponseBody getBody(String contentType, SealedMediaType mediaTy } @Override - protected Code200ResponseHeadersSchema.Code200ResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException, NotImplementedException { + protected Code200ResponseHeadersSchema.Code200ResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java index 6c6a6c19d9f..a30d61bec1a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java index 76d7ecb3390..4b54d1e388b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.components.schemas.StringWithValidation; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xexpiresafter.XExpiresAfterSchema; @@ -59,7 +58,7 @@ protected Code200ResponseHeadersSchemaMap(FrozenMap<@Nullable Object> m) { "X-Expires-After", "numberHeader" ); - public static Code200ResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Code200ResponseHeadersSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Code200ResponseHeadersSchema1.getInstance().validate(arg, configuration); } @@ -349,7 +348,7 @@ public Code200ResponseHeadersSchemaMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Code200ResponseHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -361,11 +360,11 @@ public Code200ResponseHeadersSchemaMap validate(Map arg, SchemaConfigurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -375,15 +374,15 @@ public Code200ResponseHeadersSchemaMap validate(Map arg, SchemaConfigurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Code200ResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Code200ResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Code200ResponseHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public Code200ResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Code200ResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java index 801cac1ac3f..efc687945ab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java @@ -8,7 +8,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Userlogout; @@ -29,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -54,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java index 761922e6336..0093801140c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.paths.userlogout.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -30,7 +29,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java index 6494d9f4258..223efea0cce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Userusername; @@ -31,7 +30,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +58,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java index a9238ea9579..503ec431719 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java @@ -10,7 +10,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.paths.Userusername; @@ -31,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +58,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java index 4cf81f66373..748d806d396 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -34,7 +33,7 @@ public static Void put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -68,7 +67,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java index b51d6207c72..75de97ae0ee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.parameters.pathusername.Schema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "username" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -165,7 +164,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,11 +176,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -191,15 +190,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java index fc6ff86235a..e5020958495 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.userusername.delete.responses.Code200Response; import org.openapijsonschematools.client.paths.userusername.delete.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -41,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java index 5b4efd75bd6..ab220b57b21 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java index 336d2df6829..cf14e31de9d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.parameters.pathusername.Schema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "username" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -165,7 +164,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,11 +176,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -191,15 +190,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java index 5898e98526e..320fedb631d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.paths.userusername.get.responses.Code400Response; import org.openapijsonschematools.client.paths.userusername.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; @@ -45,7 +44,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java index 4f666f798b0..e83a0bb7634 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -53,7 +52,7 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java index cd1e5881c77..4fcdb4ca075 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java index bb3e8a1c549..cfa381bd2a1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java index e57d83e5196..a45316dbab8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.parameters.pathusername.Schema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -50,7 +49,7 @@ protected PathParametersMap(FrozenMap m) { "username" ); public static final Set optionalKeys = Set.of(); - public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PathParametersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PathParameters1.getInstance().validate(arg, configuration); } @@ -165,7 +164,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,11 +176,11 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -191,15 +190,15 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java index 10141999654..732033d8a06 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.paths.userusername.put.responses.Code400Response; import org.openapijsonschematools.client.paths.userusername.put.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; @@ -32,7 +31,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java index e5c690d292d..600fd3fe1df 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java index d5619116676..c7aea37db95 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java @@ -4,7 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java index d0eeaaa566d..9ec3e3c44a6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java @@ -2,7 +2,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.header.Header; @@ -21,7 +20,7 @@ public HeadersDeserializer(Map headers, MapSchemaValidator headersToValidate = new HashMap<>(); for (Map.Entry> entry: responseHeaders.map().entrySet()) { String headerName = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java index 1d8be2229d0..640f2a96415 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.ApiException; @@ -27,8 +26,8 @@ public ResponseDeserializer(Map content) { this.headers = null; } - protected abstract SealedBodyClass getBody(String contentType, SealedMediaTypeClass mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException; - protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException; + 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); @@ -39,7 +38,7 @@ protected String deserializeTextPlain(byte[] body) { return new String(body, StandardCharsets.UTF_8); } - protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + 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); @@ -50,7 +49,7 @@ protected T deserializeBody(String contentType, byte[] body, JsonSchema s throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); } - public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { throw new ApiException( diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java index 58e1bc55d70..f72be2313af 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java @@ -2,11 +2,10 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import java.net.http.HttpResponse; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException; + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index 6bc6fe04985..7990efaa995 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -86,7 +85,7 @@ public static AnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,7 +97,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -110,7 +109,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,24 +120,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -149,15 +148,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -180,7 +179,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,7 +213,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -245,7 +244,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -260,41 +259,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -310,7 +309,7 @@ public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java index a5e697bc7e1..12af2ba8196 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -44,7 +43,7 @@ public static BooleanJsonSchema1 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -64,26 +63,26 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index bc63f4a4bcb..4853a27dee8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static DateJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -57,7 +56,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -70,26 +69,26 @@ public String validate(LocalDate arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof LocalDate) { return validate((LocalDate) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java index 04afec44e81..a5b4f50d788 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static DateTimeJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -57,7 +56,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -70,26 +69,26 @@ public String validate(ZonedDateTime arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof ZonedDateTime) { return validate((ZonedDateTime) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java index 053ed1d9194..6651aa44497 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static DecimalJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -65,24 +64,24 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DecimalJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java index 30409a5bfa0..9bcb31d2068 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static DoubleJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -56,7 +55,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -69,24 +68,24 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java index b06048101bd..101b2ea1f57 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static FloatJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -56,7 +55,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @@ -69,24 +68,24 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FloatJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java index 0007819ca43..2938d08bf21 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -49,7 +48,7 @@ public static Int32JsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -59,11 +58,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @@ -76,24 +75,24 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int32JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java index ab1735795d1..c17217a89ab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -51,7 +50,7 @@ public static Int64JsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,19 +60,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -86,24 +85,24 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int64JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java index 16a442386f2..34b79da8f66 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -51,7 +50,7 @@ public static IntJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,19 +60,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -86,24 +85,24 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index 0f6e5062fae..8135ed020cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -66,7 +65,7 @@ public static ListJsonSchema1 getInstance() { return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,24 +85,24 @@ public static ListJsonSchema1 getInstance() { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ListJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index e397fcadc47..85396cda11a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -71,7 +70,7 @@ public static MapJsonSchema1 getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,24 +89,24 @@ public static MapJsonSchema1 getInstance() { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index 1135409baef..7a1a3367d78 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -88,7 +87,7 @@ public static NotAnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -100,7 +99,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,24 +122,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -151,15 +150,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -182,7 +181,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -247,7 +246,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,41 +261,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -312,7 +311,7 @@ public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java index 483996081d7..af32938007e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -45,7 +44,7 @@ public static NullJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -64,25 +63,25 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NullJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java index d5650985076..57629ac9557 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -50,7 +49,7 @@ public static NumberJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,19 +59,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -85,24 +84,24 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java index d200689b1f5..7185ac28496 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static StringJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -57,15 +56,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -78,7 +77,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof LocalDate) { @@ -88,20 +87,20 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java index 85b94ee2403..2502602642f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static UuidJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -57,7 +56,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -70,26 +69,26 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UuidJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java index cbf6ed9ddbf..7e80fd207c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface BooleanEnumValidator { - boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java index 7bade32a205..96c69f5a7a2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface BooleanSchemaValidator { - boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java index 1a0611f1b8e..1f1d1ba5e68 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; public interface DefaultValueMethod { - T defaultValue() throws InvalidTypeException; + T defaultValue() throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java index aa59920f5ac..f2b8b1e7d74 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface DoubleEnumValidator { - double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java index 337af4a9a60..18573a77ef7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ElseValidator implements KeywordValidator { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java index 33d4834731d..17317003a34 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface FloatEnumValidator { - float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java index 491cb228f18..cb20c832f9b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface IntegerEnumValidator { - int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index d6f5cdab7b7..a597533422f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; +import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.checkerframework.checker.nullness.qual.Nullable; import java.math.BigDecimal; import java.time.LocalDate; @@ -222,8 +221,8 @@ protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { } public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas); - public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; - public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; + public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; + public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; private List getContainsPathToSchemas( @Nullable Object arg, @@ -389,7 +388,7 @@ protected Void castToAllowedTypes(Void arg, List pathToItem, Set castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws InvalidTypeException { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { pathSet.add(pathToItem); List<@Nullable Object> argFixed = new ArrayList<>(); int i =0; @@ -403,13 +402,13 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws InvalidTypeException { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws ValidationException { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new ValidationException("Invalid non-string key value"); } Object val = entry.getValue(); List newPathToItem = new ArrayList<>(pathToItem); @@ -420,7 +419,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set pathToItem, Set> pathSet) throws InvalidTypeException { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws ValidationException { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { @@ -448,7 +447,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set argClass = arg.getClass(); - throw new InvalidTypeException("Invalid type passed in for input="+arg+" type="+argClass); + throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index 2ef994a9c9f..a7752b37595 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; - OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; + OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException; + BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java index 88410ffc5e2..6b6bcd88c47 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface LongEnumValidator { - long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java index 5633ebe09f9..9bd7d432165 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; import java.util.Map; public interface MapSchemaValidator { - OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; - OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; + OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException; + BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java index 96b52a74b9f..bc6bd3663bb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface NullEnumValidator { - Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java index 89924e90d5a..c30cde9f9b7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface NullSchemaValidator { - Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java index c426b250af8..dd3c349ad69 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface NumberSchemaValidator { - Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java index 49ca190ae5f..baf86081fd7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface StringEnumValidator { - String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java index 8cbc38335bf..e6729893fca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface StringSchemaValidator { - String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + String validate(String arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index f5604144fe7..8e17449eb27 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; @@ -73,7 +72,7 @@ public static UnsetAnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -85,7 +84,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -97,7 +96,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -108,24 +107,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -136,15 +135,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -167,7 +166,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -247,41 +246,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -297,7 +296,7 @@ public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaC } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java index 314d2c82bbe..b0aa605a011 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.servers.server0.Variables; @@ -22,7 +21,7 @@ private static Variables.VariablesMap getVariables() { ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) ); - } catch (ValidationException | InvalidTypeException e) { + } catch (ValidationException e) { throw new RuntimeException(e); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java index ca7947449b0..555ea894037 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.servers.server1.Variables; @@ -21,7 +20,7 @@ private static Variables.VariablesMap getVariables() { ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) ); - } catch (ValidationException | InvalidTypeException e) { + } catch (ValidationException e) { throw new RuntimeException(e); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java index 94f9fa76377..9a17cee2161 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -98,7 +97,7 @@ public static Server getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -109,16 +108,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringServerEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringServerEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -127,22 +126,22 @@ public String validate(StringServerEnums arg,SchemaConfiguration configuration) } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public ServerBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ServerBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ServerBoxedString(validate(arg, configuration)); } @Override - public ServerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ServerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringPortEnums implements StringValueMethod { @@ -196,7 +195,7 @@ public static Port getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,16 +206,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringPortEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringPortEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -225,22 +224,22 @@ public String validate(StringPortEnums arg,SchemaConfiguration configuration) th } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public PortBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PortBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PortBoxedString(validate(arg, configuration)); } @Override - public PortBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PortBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -253,7 +252,7 @@ protected VariablesMap(FrozenMap m) { "server" ); public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Variables1.getInstance().validate(arg, configuration); } @@ -431,7 +430,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -443,11 +442,11 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -457,15 +456,15 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java index a014676fa94..c8f236973c4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -96,7 +95,7 @@ public static Version getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -107,16 +106,16 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringVersionEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -125,22 +124,22 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new VersionBoxedString(validate(arg, configuration)); } @Override - public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -152,7 +151,7 @@ protected VariablesMap(FrozenMap m) { "version" ); public static final Set optionalKeys = Set.of(); - public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static VariablesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Variables1.getInstance().validate(arg, configuration); } @@ -273,7 +272,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -285,11 +284,11 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { @@ -299,15 +298,15 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java index 48b1e4632ef..476dab2c3da 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; @@ -26,7 +25,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { + public void testSerialization() throws ValidationException, NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java index 536188dd45c..b1dc30975ab 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -30,7 +29,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { + public void testSerialization() throws ValidationException, NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -128,7 +127,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserialization() throws ValidationException, NotImplementedException, InvalidTypeException { + public void testDeserialization() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java index 9a6dd9726e3..4d799c14c72 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java @@ -3,7 +3,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java index 83b9469a24d..413b092634f 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java @@ -3,7 +3,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java index 880ad7749b3..93a5adb916a 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java @@ -3,7 +3,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -96,7 +95,7 @@ private String getJsonBody(SerializedRequestBody requestBody) { } @Test - public void testSerializeApplicationJson() throws ValidationException, InvalidTypeException, NotImplementedException { + public void testSerializeApplicationJson() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); String jsonBody; @@ -167,7 +166,7 @@ public void testSerializeApplicationJson() throws ValidationException, InvalidTy } @Test - public void testSerializeTextPlain() throws ValidationException, InvalidTypeException, NotImplementedException { + public void testSerializeTextPlain() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); SerializedRequestBody requestBody = serializer.serialize( diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java index 16ee04ec220..e4656ecbbc3 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java @@ -8,7 +8,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.exceptions.ValidationException; @@ -68,7 +67,7 @@ public MyResponseDeserializer() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, InvalidTypeException { + 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); @@ -152,7 +151,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserializeApplicationJsonNull() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); @@ -168,7 +167,7 @@ public void testDeserializeApplicationJsonNull() throws ValidationException, Api } @Test - public void testDeserializeApplicationJsonTrue() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); @@ -184,7 +183,7 @@ public void testDeserializeApplicationJsonTrue() throws ValidationException, Api } @Test - public void testDeserializeApplicationJsonFalse() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); @@ -200,7 +199,7 @@ public void testDeserializeApplicationJsonFalse() throws ValidationException, Ap } @Test - public void testDeserializeApplicationJsonInt() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); @@ -216,7 +215,7 @@ public void testDeserializeApplicationJsonInt() throws ValidationException, ApiE } @Test - public void testDeserializeApplicationJsonFloat() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); @@ -232,7 +231,7 @@ public void testDeserializeApplicationJsonFloat() throws ValidationException, Ap } @Test - public void testDeserializeApplicationJsonString() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java index 3a066958ffe..206c683cd50 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -28,13 +27,13 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testValidateNull() throws ValidationException, InvalidTypeException { + public void testValidateNull() throws ValidationException { Void validatedValue = schema.validate((Void) null, configuration); assertNull(validatedValue); } @Test - public void testValidateBoolean() throws ValidationException, InvalidTypeException { + public void testValidateBoolean() throws ValidationException { boolean trueValue = schema.validate(true, configuration); Assert.assertTrue(trueValue); @@ -43,49 +42,49 @@ public void testValidateBoolean() throws ValidationException, InvalidTypeExcepti } @Test - public void testValidateInteger() throws ValidationException, InvalidTypeException { + public void testValidateInteger() throws ValidationException { int validatedValue = schema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() throws ValidationException, InvalidTypeException { + public void testValidateLong() throws ValidationException { long validatedValue = schema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() throws ValidationException, InvalidTypeException { + public void testValidateFloat() throws ValidationException { float validatedValue = schema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() throws ValidationException, InvalidTypeException { + public void testValidateDouble() throws ValidationException { double validatedValue = schema.validate(70.6458763d, configuration); Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); } @Test - public void testValidateString() throws ValidationException, InvalidTypeException { + public void testValidateString() throws ValidationException { String validatedValue = schema.validate("a", configuration); Assert.assertEquals(validatedValue, "a"); } @Test - public void testValidateZonedDateTime() throws ValidationException, InvalidTypeException { + public void testValidateZonedDateTime() throws ValidationException { String validatedValue = schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration); Assert.assertEquals(validatedValue, "2017-07-21T17:32:28Z"); } @Test - public void testValidateLocalDate() throws ValidationException, InvalidTypeException { + public void testValidateLocalDate() throws ValidationException { String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); Assert.assertEquals(validatedValue, "2017-07-21"); } @Test - public void testValidateMap() throws ValidationException, InvalidTypeException { + public void testValidateMap() throws ValidationException { LinkedHashMap inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap validatedValue = schema.validate(inMap, configuration); @@ -95,7 +94,7 @@ public void testValidateMap() throws ValidationException, InvalidTypeException { } @Test - public void testValidateList() throws ValidationException, InvalidTypeException { + public void testValidateList() throws ValidationException { ArrayList inList = new ArrayList<>(); inList.add(LocalDate.of(2017, 7, 21)); FrozenList validatedValue = schema.validate(inList, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index 2d26f1563d4..0ca5e56ecd2 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -5,13 +5,12 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -66,7 +65,7 @@ public FrozenList getNewInstance(List arg, List pathToItem, P return new FrozenList<>(items); } - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -77,7 +76,7 @@ public FrozenList validate(List arg, SchemaConfiguration configuratio } @Override - public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithItemsSchemaBoxedList(validate(arg, configuration)); } @@ -90,19 +89,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return new ArrayWithItemsSchemaBoxedList(validate(listArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -111,7 +110,7 @@ protected ArrayWithOutputClsSchemaList(FrozenList m) { super(m); } - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithOutputClsSchema().validate(arg, configuration); } } @@ -152,7 +151,7 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat return new ArrayWithOutputClsSchemaList(newInstanceItems); } - public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,7 +162,7 @@ public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration co } @Override - public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)); } @@ -176,19 +175,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return new ArrayWithOutputClsSchemaBoxedList(validate(listArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -202,7 +201,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateArrayWithItemsSchema() throws ValidationException, InvalidTypeException { + public void testValidateArrayWithItemsSchema() throws ValidationException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); @@ -227,7 +226,7 @@ public void testValidateArrayWithItemsSchema() throws ValidationException, Inval } @Test - public void testValidateArrayWithOutputClsSchema() throws ValidationException, InvalidTypeException { + public void testValidateArrayWithOutputClsSchema() throws ValidationException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java index a989ca41eb2..7ac24fbeaa2 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java @@ -4,7 +4,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; @@ -24,13 +23,13 @@ public class BooleanSchemaTest { ); @Test - public void testValidateTrue() throws ValidationException, InvalidTypeException { + public void testValidateTrue() throws ValidationException { boolean validatedValue = booleanJsonSchema.validate(true, configuration); Assert.assertTrue(validatedValue); } @Test - public void testValidateFalse() throws ValidationException, InvalidTypeException { + public void testValidateFalse() throws ValidationException { boolean validatedValue = booleanJsonSchema.validate(false, configuration); Assert.assertFalse(validatedValue); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java index b0417274fe5..17d5f35dcbe 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -36,7 +35,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateList() throws ValidationException, InvalidTypeException { + public void testValidateList() throws ValidationException { List inList = new ArrayList<>(); inList.add("today"); FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java index 2b3e4231fe4..5b03fec8609 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -38,7 +37,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateMap() throws ValidationException, InvalidTypeException { + public void testValidateMap() throws ValidationException { Map inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap<@Nullable Object> validatedValue = mapJsonSchema.validate(inMap, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java index afcc5996893..eb1c70ef049 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java @@ -4,7 +4,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; @@ -26,7 +25,7 @@ public class NullSchemaTest { @Test @SuppressWarnings("nullness") - public void testValidateNull() throws ValidationException, InvalidTypeException { + public void testValidateNull() throws ValidationException { Void validatedValue = nullJsonSchema.validate(null, configuration); Assert.assertNull(validatedValue); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java index 92698dee479..fcde27495e3 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java @@ -4,7 +4,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; @@ -24,25 +23,25 @@ public class NumberSchemaTest { ); @Test - public void testValidateInteger() throws ValidationException, InvalidTypeException { + public void testValidateInteger() throws ValidationException { int validatedValue = numberJsonSchema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() throws ValidationException, InvalidTypeException { + public void testValidateLong() throws ValidationException { long validatedValue = numberJsonSchema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() throws ValidationException, InvalidTypeException { + public void testValidateFloat() throws ValidationException { float validatedValue = numberJsonSchema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() throws ValidationException, InvalidTypeException { + public void testValidateDouble() throws ValidationException { double validatedValue = numberJsonSchema.validate(3.14d, configuration); Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index c1f9e5de4df..fad3d574369 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -79,7 +78,7 @@ public static ObjectWithPropsSchema getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,7 +89,7 @@ public static ObjectWithPropsSchema getInstance() { } @Override - public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)); } @@ -103,19 +102,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -166,7 +165,7 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, return new FrozenMap<>(properties); } - public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,24 +176,24 @@ public FrozenMap validate(Map arg, SchemaConfiguration configurati } @Override - public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -252,7 +251,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -263,24 +262,24 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { } @Override - public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -297,7 +296,7 @@ protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { super(m); } - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); } } @@ -347,7 +346,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); } - public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -358,24 +357,24 @@ public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration } @Override - public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithOutputTypeSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -398,7 +397,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateObjectWithPropsSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithPropsSchema() throws ValidationException { ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); // map with only property works @@ -429,7 +428,7 @@ public void testValidateObjectWithPropsSchema() throws ValidationException, Inva } @Test - public void testValidateObjectWithAddpropsSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithAddpropsSchema() throws ValidationException { ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); // map with only property works @@ -460,7 +459,7 @@ public void testValidateObjectWithAddpropsSchema() throws ValidationException, I } @Test - public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException { ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); // map with only property works @@ -499,7 +498,7 @@ public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationExce } @Test - public void testValidateObjectWithOutputTypeSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithOutputTypeSchema() throws ValidationException { ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); // map with only property works diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java index 92c61870552..d3cba69fb20 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java @@ -4,7 +4,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; @@ -28,13 +27,13 @@ public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchem ); @Test - public void testValidateTrue() throws ValidationException, InvalidTypeException { + public void testValidateTrue() throws ValidationException { Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); Assert.assertEquals(validatedValue, Boolean.TRUE); } @Test - public void testValidateFalse() throws ValidationException, InvalidTypeException { + public void testValidateFalse() throws ValidationException { Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); Assert.assertEquals(validatedValue, Boolean.FALSE); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java index a48a2c742f0..ea3ec6ae8c3 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -51,15 +50,15 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java index 6299f5e6ef2..5b70aada50c 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java @@ -6,7 +6,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; @@ -41,15 +40,15 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return validate(listArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithItemsSchemaBoxedList(); } } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java index 7a8578bae93..c1cc4c84e9e 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -44,15 +43,15 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new SomeSchemaBoxedString(); } } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java index 19d8a475edd..e35b145e721 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java @@ -5,9 +5,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.StringJsonSchema; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -40,15 +39,15 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java index 221050d9e82..58c160a0499 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -36,15 +35,15 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithRequiredSchemaBoxedMap(); } } diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java index c1ea881c0de..c1ffa4cc812 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java @@ -729,7 +729,6 @@ public void processOpts() { exceptionClasses.add("ApiException"); exceptionClasses.add("BaseException"); exceptionClasses.add("InvalidAdditionalPropertyException"); - exceptionClasses.add("InvalidTypeException"); exceptionClasses.add("NotImplementedException"); exceptionClasses.add("UnsetPropertyException"); exceptionClasses.add("ValidationException"); @@ -2056,7 +2055,6 @@ private void addCustomSchemaImports(Set imports, CodegenSchema schema) { imports.add("import " + packageName + ".schemas.validation.JsonSchemaInfo;"); imports.add("import "+packageName + ".configurations.SchemaConfiguration;"); imports.add("import "+packageName + ".exceptions.ValidationException;"); - imports.add("import "+packageName + ".exceptions.InvalidTypeException;"); // for castToAllowedTypes imports.add("import java.util.Set;"); // for validate imports.add("import java.util.HashSet;"); // for validate imports.add("import java.util.Objects;"); // for validate diff --git a/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs b/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs index 7823b594fc3..48595f3b57c 100644 --- a/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/responses/Response.hbs @@ -14,7 +14,6 @@ import {{packageName}}.configurations.SchemaConfiguration; import {{packageName}}.response.ResponseDeserializer; import {{packageName}}.response.DeserializedHttpResponse; import {{packageName}}.exceptions.ApiException; -import {{packageName}}.exceptions.InvalidTypeException; import {{packageName}}.exceptions.ValidationException; import {{packageName}}.exceptions.NotImplementedException; {{#if hasContentSchema}} @@ -83,7 +82,7 @@ public class {{jsonPathPiece.pascalCase}} { {{#if hasContentSchema}} @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + 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; @@ -116,7 +115,7 @@ public class {{jsonPathPiece.pascalCase}} { {{/if}} @Override - protected {{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Void{{/with}} getHeaders(HttpHeaders headers, SchemaConfiguration configuration){{#if headers}} throws ValidationException, InvalidTypeException, NotImplementedException{{/if}} { + protected {{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Void{{/with}} getHeaders(HttpHeaders headers, SchemaConfiguration configuration){{#if headers}} throws ValidationException, NotImplementedException{{/if}} { {{#if headers}} return new {{headers.jsonPathPiece.pascalCase}}().deserialize(headers, configuration); {{else}} diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs index f467e48f7f2..0d408f5bf12 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_Schema_string.hbs @@ -77,11 +77,11 @@ public static class {{jsonPathPiece.pascalCase}} extends JsonSchema<{{jsonPathPi {{> src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor }} {{> src/main/java/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} {{#if defaultValue}} - public String defaultValue() throws InvalidTypeException { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } {{/if}} {{> src/main/java/packagename/components/schemas/SchemaClass/_validateAndBox }} diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBox.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBox.hbs index 61e1ac280f5..892e1ef9f41 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBox.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBox.hbs @@ -20,7 +20,7 @@ {{/eq}} {{/each}} @Override -public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { {{#each types}} {{#if @first}} {{#eq this "null"}} @@ -68,7 +68,7 @@ public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, Sc return validateAndBox(castArg, configuration); {{/each}} } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } {{else}} {{> src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxVoid }} @@ -78,7 +78,7 @@ public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, Sc {{> src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxList }} {{> src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxMap }} @Override -public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -94,6 +94,6 @@ public {{jsonPathPiece.pascalCase}}Boxed validateAndBox(@Nullable Object arg, Sc } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs index 6e143217c73..de40afe4e66 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs @@ -1,4 +1,4 @@ @Override -public {{jsonPathPiece.pascalCase}}BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public {{jsonPathPiece.pascalCase}}BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new {{jsonPathPiece.pascalCase}}BoxedBoolean(validate(arg, configuration)); } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs index ba62fc67fc0..cda68ddbb60 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs @@ -1,4 +1,4 @@ @Override -public {{jsonPathPiece.pascalCase}}BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public {{jsonPathPiece.pascalCase}}BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new {{jsonPathPiece.pascalCase}}BoxedList(validate(arg, configuration)); } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs index 4b2dad11975..c84fc8d79cc 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs @@ -1,4 +1,4 @@ @Override -public {{jsonPathPiece.pascalCase}}BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public {{jsonPathPiece.pascalCase}}BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new {{jsonPathPiece.pascalCase}}BoxedMap(validate(arg, configuration)); } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs index 65f44e59bfe..dae6e8f3f4a 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs @@ -1,4 +1,4 @@ @Override -public {{jsonPathPiece.pascalCase}}BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public {{jsonPathPiece.pascalCase}}BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new {{jsonPathPiece.pascalCase}}BoxedNumber(validate(arg, configuration)); } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs index 0c8395ae69f..d64c59a5e94 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs @@ -1,4 +1,4 @@ @Override -public {{jsonPathPiece.pascalCase}}BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public {{jsonPathPiece.pascalCase}}BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new {{jsonPathPiece.pascalCase}}BoxedString(validate(arg, configuration)); } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs index a192c88cdc8..ec67a67fc7a 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs @@ -1,4 +1,4 @@ @Override -public {{jsonPathPiece.pascalCase}}BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public {{jsonPathPiece.pascalCase}}BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new {{jsonPathPiece.pascalCase}}BoxedVoid(validate(arg, configuration)); } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs index e04fe979f77..697141b80f9 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -3,7 +3,7 @@ {{#eq this "null"}} @Override -public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -53,7 +53,7 @@ public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}} {{/if}} } -public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<@Nullable Object>{{/if}} validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<@Nullable Object>{{/if}} validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -101,7 +101,7 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCa {{/if}} } -public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { +public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -118,7 +118,7 @@ public {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCa {{else}} @Override -public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +132,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val {{#eq this "integer"}} @Override -public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,20 +142,20 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } {{#neq ../format "int32"}} -public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } {{/neq}} @@ -163,7 +163,7 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val {{#eq this "number"}} @Override -public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -174,55 +174,55 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val } {{#eq ../format null}} -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } -public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } {{else}} {{#eq ../format "int32"}} -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } {{else}} {{#eq ../format "int64"}} -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } -public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } {{else}} {{#eq ../format "float"}} -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } {{else}} {{#eq ../format "double"}} -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } {{/eq}} @@ -234,7 +234,7 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val {{#eq this "boolean"}} @Override -public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +248,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V {{else}} @Override -public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -260,7 +260,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override -public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -272,7 +272,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override -public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -283,24 +283,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } -public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } -public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } -public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } -public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override -public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -311,15 +311,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } -public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } -public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } -public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -358,7 +358,7 @@ public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{ {{/if}} } -public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { +public {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}@Nullable Object{{/with}}>{{/if}} validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -407,7 +407,7 @@ public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else {{/if}} } -public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}? extends @Nullable Object{{/with}}>{{/if}} validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}? extends @Nullable Object{{/with}}>{{/if}} validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -421,55 +421,55 @@ public {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else {{#and enumInfo enumInfo.typeToValues.null}} @Override -public Void validate(Null{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { +public Void validate(Null{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.boolean}} @Override -public boolean validate(Boolean{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { +public boolean validate(Boolean{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.string}} @Override -public String validate(String{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { +public String validate(String{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.Integer}} @Override -public int validate(Integer{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { +public int validate(Integer{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.Long}} @Override -public long validate(Long{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { +public long validate(Long{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.Float}} @Override -public float validate(Float{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { +public float validate(Float{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } {{/and}} {{#and enumInfo enumInfo.typeToValues.Double}} @Override -public double validate(Double{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { +public double validate(Double{{enumInfo.jsonPathPiece.pascalCase}} arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } {{/and}} @Override -public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { +public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { {{#if types}} {{#each types}} {{#if @first}} @@ -516,5 +516,5 @@ public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration confi return validate((Map) arg, configuration); } {{/if}} - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/components/schemas/_arrayOutputType.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/_arrayOutputType.hbs index 40ec25fcd44..157d668d23d 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/_arrayOutputType.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/_arrayOutputType.hbs @@ -4,7 +4,7 @@ public static class {{arrayOutputJsonPathPiece.pascalCase}} extends FrozenList<{ protected {{arrayOutputJsonPathPiece.pascalCase}}(FrozenList<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true }}{{/with}}> m) { super(m); } - public static {{arrayOutputJsonPathPiece.pascalCase}} of(List<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static {{arrayOutputJsonPathPiece.pascalCase}} of(List<{{#with listItemSchema}}{{> src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException { return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration); } } diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputType.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputType.hbs index a9d22ab6c1e..3bd3071359b 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputType.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/_objectOutputType.hbs @@ -39,11 +39,11 @@ public static class {{mapOutputJsonPathPiece.pascalCase}} extends FrozenMap<@Nul {{/eq}} {{/eq}} {{#if mapValueSchema}} - public static {{mapOutputJsonPathPiece.pascalCase}} of(Map src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static {{mapOutputJsonPathPiece.pascalCase}} of(Map src/main/java/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}> arg, SchemaConfiguration configuration) throws ValidationException { return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration); } {{else}} - public static {{mapOutputJsonPathPiece.pascalCase}} of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static {{mapOutputJsonPathPiece.pascalCase}} of(Map arg, SchemaConfiguration configuration) throws ValidationException { return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration); } {{/if}} diff --git a/src/main/resources/java/src/main/java/packagename/exceptions/InvalidTypeException.hbs b/src/main/resources/java/src/main/java/packagename/exceptions/InvalidTypeException.hbs deleted file mode 100644 index 1025411b4c4..00000000000 --- a/src/main/resources/java/src/main/java/packagename/exceptions/InvalidTypeException.hbs +++ /dev/null @@ -1,8 +0,0 @@ -package {{{packageName}}}.exceptions; - -@SuppressWarnings("serial") -public class InvalidTypeException extends BaseException { - public InvalidTypeException(String s) { - super(s); - } -} \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs b/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs index 632a882cf1b..83631bb6e09 100644 --- a/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/ContentHeader.hbs @@ -7,7 +7,6 @@ import {{{packageName}}}.contenttype.ContentTypeSerializer; import {{{packageName}}}.contenttype.ContentTypeDeserializer; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.mediatype.MediaType; import {{{packageName}}}.parameter.ParameterStyle; @@ -32,7 +31,7 @@ public class ContentHeader extends HeaderBase implements Header { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { + 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)) { @@ -44,7 +43,7 @@ public class ContentHeader extends HeaderBase implements Header { } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { + 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) { diff --git a/src/main/resources/java/src/main/java/packagename/header/Header.hbs b/src/main/resources/java/src/main/java/packagename/header/Header.hbs index 7cf5059493b..f9bbeae3a7a 100644 --- a/src/main/resources/java/src/main/java/packagename/header/Header.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/Header.hbs @@ -4,12 +4,11 @@ import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.exceptions.InvalidTypeException; 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, InvalidTypeException; - @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException; + 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/java/src/main/java/packagename/header/SchemaHeader.hbs b/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs index fb060e9ea6d..6ba7081757d 100644 --- a/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs +++ b/src/main/resources/java/src/main/java/packagename/header/SchemaHeader.hbs @@ -5,7 +5,6 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.contenttype.ContentTypeDeserializer; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.parameter.ParameterStyle; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaFactory; @@ -33,7 +32,7 @@ public class SchemaHeader extends HeaderBase implements Header { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { + 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); @@ -88,7 +87,7 @@ public class SchemaHeader extends HeaderBase implements Header { } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { + 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); diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs index 5d1de439e1b..b04427102fd 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Operation.hbs @@ -32,7 +32,6 @@ import {{packageName}}.configurations.ApiConfiguration; import {{packageName}}.configurations.SchemaConfiguration; import {{packageName}}.exceptions.ValidationException; import {{packageName}}.exceptions.NotImplementedException; -import {{packageName}}.exceptions.InvalidTypeException; import {{packageName}}.exceptions.ApiException; import {{packageName}}.restclient.RestClient; {{#if requestBody}} @@ -71,7 +70,7 @@ public class {{jsonPathPiece.pascalCase}} { ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); {{#with requestBody}} @@ -197,7 +196,7 @@ public class {{jsonPathPiece.pascalCase}} { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Void{{/if}} {{jsonPathPiece.camelCase}}({{jsonPathPiece.pascalCase}}Request request) throws IOException, InterruptedException, ValidationException, NotImplementedException, InvalidTypeException, ApiException { + default {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Void{{/if}} {{jsonPathPiece.camelCase}}({{jsonPathPiece.pascalCase}}Request request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return {{jsonPathPiece.pascalCase}}Provider.{{jsonPathPiece.camelCase}}(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs index 281effc2228..70920363fa6 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/Responses.hbs @@ -9,7 +9,6 @@ import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; {{/with}} {{/each}} import {{{packageName}}}.exceptions.ApiException; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.exceptions.ValidationException; {{#if nonErrorResponses }} @@ -84,7 +83,7 @@ public class {{responses.jsonPathPiece.pascalCase}} { {{/with}} } - public {{#if nonErrorResponses }}EndpointResponse{{else}}Void{{/if}} deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public {{#if nonErrorResponses }}EndpointResponse{{else}}Void{{/if}} deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { {{#eq defaultResponse null }} String statusCode = String.valueOf(response.statusCode()); {{#and statusCodeResponses wildcardCodeResponses }} diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index 9725a1eeb8e..2bf31ba3b0b 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -67,7 +67,6 @@ import {{packageName}}.configurations.SchemaConfiguration; import {{packageName}}.configurations.JsonSchemaKeywordFlags; import {{packageName}}.exceptions.ValidationException; import {{packageName}}.exceptions.NotImplementedException; -import {{packageName}}.exceptions.InvalidTypeException; import {{packageName}}.exceptions.ApiException; import {{{packageName}}}.schemas.validation.MapUtils; import {{{packageName}}}.schemas.validation.FrozenList; @@ -209,7 +208,7 @@ try { } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; -} catch (ValidationException | InvalidTypeException 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) { diff --git a/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs b/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs index 2b7c573a028..d57437b0187 100644 --- a/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/response/HeadersDeserializer.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.response; import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.header.Header; @@ -21,7 +20,7 @@ public abstract class HeadersDeserializer { this.headersSchema = headersSchema; } - public OutType deserialize(HttpHeaders responseHeaders, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException, NotImplementedException { + 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(); diff --git a/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs b/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs index 0f8c6b7bf84..05d319d1558 100644 --- a/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/response/ResponseDeserializer.hbs @@ -12,7 +12,6 @@ import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.contenttype.ContentTypeDetector; import {{{packageName}}}.contenttype.ContentTypeDeserializer; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.exceptions.ApiException; @@ -27,8 +26,8 @@ public abstract class ResponseDeserializer T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + 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); @@ -50,7 +49,7 @@ public abstract class ResponseDeserializer deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { throw new ApiException( diff --git a/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs b/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs index 8719d3e9257..618cf4bdd9a 100644 --- a/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs +++ b/src/main/resources/java/src/main/java/packagename/response/ResponsesDeserializer.hbs @@ -2,11 +2,10 @@ package {{{packageName}}}.response; import {{{packageName}}}.configurations.SchemaConfiguration; import java.net.http.HttpResponse; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException, ApiException; + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs index 80ad87837f7..a567563caeb 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/AnyTypeJsonSchema.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.FrozenList; import {{{packageName}}}.schemas.validation.FrozenMap; @@ -86,7 +85,7 @@ public class AnyTypeJsonSchema { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,7 +97,7 @@ public class AnyTypeJsonSchema { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -110,7 +109,7 @@ public class AnyTypeJsonSchema { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,24 +120,24 @@ public class AnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -149,15 +148,15 @@ public class AnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -180,7 +179,7 @@ public class AnyTypeJsonSchema { return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,7 +213,7 @@ public class AnyTypeJsonSchema { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -245,7 +244,7 @@ public class AnyTypeJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -260,41 +259,41 @@ public class AnyTypeJsonSchema { } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -310,7 +309,7 @@ public class AnyTypeJsonSchema { } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs index b82c4f320a9..ec11de46bb8 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/BooleanJsonSchema.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaInfo; @@ -44,7 +43,7 @@ public class BooleanJsonSchema { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -64,26 +63,26 @@ public class BooleanJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/DateJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs index 4954a6f821f..4db4d871f87 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DateJsonSchema.hbs @@ -2,12 +2,11 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; +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}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public class DateJsonSchema { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -57,7 +56,7 @@ public class DateJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -70,26 +69,26 @@ public class DateJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof LocalDate) { return validate((LocalDate) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs index 2eea7f7903f..eb371aaaa3b 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DateTimeJsonSchema.hbs @@ -2,12 +2,11 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; +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}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public class DateTimeJsonSchema { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -57,7 +56,7 @@ public class DateTimeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -70,26 +69,26 @@ public class DateTimeJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof ZonedDateTime) { return validate((ZonedDateTime) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs index 7364ba1596b..5761cc9a553 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DecimalJsonSchema.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public class DecimalJsonSchema { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -65,24 +64,24 @@ public class DecimalJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DecimalJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs index 895752167b7..0fced18b575 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/DoubleJsonSchema.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public class DoubleJsonSchema { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -56,7 +55,7 @@ public class DoubleJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -69,24 +68,24 @@ public class DoubleJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs index cc403ac2715..246ffc2f834 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/FloatJsonSchema.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public class FloatJsonSchema { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -56,7 +55,7 @@ public class FloatJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @@ -69,24 +68,24 @@ public class FloatJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FloatJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs index 34e3ec48df8..6f9b9ccd666 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/Int32JsonSchema.hbs @@ -1,13 +1,12 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.InvalidTypeException; +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}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -49,7 +48,7 @@ public class Int32JsonSchema { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -59,11 +58,11 @@ public class Int32JsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @@ -76,24 +75,24 @@ public class Int32JsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int32JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs index 6d9090aebad..c3e46a01fc3 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/Int64JsonSchema.hbs @@ -1,13 +1,12 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.InvalidTypeException; +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}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -51,7 +50,7 @@ public class Int64JsonSchema { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,19 +60,19 @@ public class Int64JsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -86,24 +85,24 @@ public class Int64JsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int64JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/IntJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs index d8c9b1dd289..b82c7692e20 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/IntJsonSchema.hbs @@ -1,13 +1,12 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.InvalidTypeException; +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}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -51,7 +50,7 @@ public class IntJsonSchema { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,19 +60,19 @@ public class IntJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -86,24 +85,24 @@ public class IntJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs index 76311a285ec..13c3d3b24d2 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/ListJsonSchema.hbs @@ -1,14 +1,13 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.InvalidTypeException; +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}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -66,7 +65,7 @@ public class ListJsonSchema { return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,24 +85,24 @@ public class ListJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ListJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs index 680564ffbe7..769d4ad1723 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/MapJsonSchema.hbs @@ -1,14 +1,13 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.InvalidTypeException; +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}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -71,7 +70,7 @@ public class MapJsonSchema { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,24 +89,24 @@ public class MapJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs index 027294a551c..7a3ab0c79d5 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.FrozenList; import {{{packageName}}}.schemas.validation.FrozenMap; @@ -88,7 +87,7 @@ public class NotAnyTypeJsonSchema { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -100,7 +99,7 @@ public class NotAnyTypeJsonSchema { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public class NotAnyTypeJsonSchema { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,24 +122,24 @@ public class NotAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -151,15 +150,15 @@ public class NotAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -182,7 +181,7 @@ public class NotAnyTypeJsonSchema { return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public class NotAnyTypeJsonSchema { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -247,7 +246,7 @@ public class NotAnyTypeJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,41 +261,41 @@ public class NotAnyTypeJsonSchema { } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -312,7 +311,7 @@ public class NotAnyTypeJsonSchema { } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/NullJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs index 20d551fb293..5013b032120 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NullJsonSchema.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaInfo; @@ -45,7 +44,7 @@ public class NullJsonSchema { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -64,25 +63,25 @@ public class NullJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NullJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs index 7bbd3a65aa4..a0b9a93c7f8 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/NumberJsonSchema.hbs @@ -1,13 +1,12 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.InvalidTypeException; +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}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -50,7 +49,7 @@ public class NumberJsonSchema { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,19 +59,19 @@ public class NumberJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -85,24 +84,24 @@ public class NumberJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/StringJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs index a0b8052ecd2..e78b29157a6 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/StringJsonSchema.hbs @@ -2,12 +2,11 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; +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}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public class StringJsonSchema { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -57,15 +56,15 @@ public class StringJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -78,7 +77,7 @@ public class StringJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof LocalDate) { @@ -88,20 +87,20 @@ public class StringJsonSchema { } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs index 8e69aad0ef4..46cc06847b4 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/UuidJsonSchema.hbs @@ -1,13 +1,12 @@ package {{{packageName}}}.schemas; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; -import {{{packageName}}}.exceptions.InvalidTypeException; +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}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public class UuidJsonSchema { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -57,7 +56,7 @@ public class UuidJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -70,26 +69,26 @@ public class UuidJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UuidJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/schemas/validation/BooleanEnumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanEnumValidator.hbs index 8b2685dac0b..f9ecf469846 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanEnumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanEnumValidator.hbs @@ -1,9 +1,8 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public interface BooleanEnumValidator { - boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs index 6900f7c9f35..8ac8de93950 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/BooleanSchemaValidator.hbs @@ -1,10 +1,9 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public interface BooleanSchemaValidator { - boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/DefaultValueMethod.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/DefaultValueMethod.hbs index c19a5ba9d51..a362656402f 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/DefaultValueMethod.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/DefaultValueMethod.hbs @@ -1,7 +1,7 @@ package {{{packageName}}}.schemas.validation; -import {{{packageName}}}.exceptions.InvalidTypeException; +import {{{packageName}}}.exceptions.ValidationException; public interface DefaultValueMethod { - T defaultValue() throws InvalidTypeException; + T defaultValue() throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/DoubleEnumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/DoubleEnumValidator.hbs index 7044cb03384..9de5c58a990 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/DoubleEnumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/DoubleEnumValidator.hbs @@ -1,9 +1,8 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public interface DoubleEnumValidator { - double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ElseValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ElseValidator.hbs index af1a2be3193..f4963b7f04f 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ElseValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ElseValidator.hbs @@ -1,7 +1,6 @@ package {{{packageName}}}.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public class ElseValidator implements KeywordValidator { diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/FloatEnumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/FloatEnumValidator.hbs index dd65b633ded..7d9d5a7fcce 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/FloatEnumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/FloatEnumValidator.hbs @@ -1,9 +1,8 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public interface FloatEnumValidator { - float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/IntegerEnumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/IntegerEnumValidator.hbs index 5283339cee6..352afd6be56 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/IntegerEnumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/IntegerEnumValidator.hbs @@ -1,9 +1,8 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public interface IntegerEnumValidator { - int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs index 135052bac15..840cbdaede2 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/JsonSchema.hbs @@ -1,9 +1,8 @@ package {{{packageName}}}.schemas.validation; +import org.checkerframework.checker.nullness.qual.Nullable; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.exceptions.InvalidTypeException; -import org.checkerframework.checker.nullness.qual.Nullable; import java.math.BigDecimal; import java.time.LocalDate; @@ -222,8 +221,8 @@ public abstract class JsonSchema { } public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas); - public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; - public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; + public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; + public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; private List getContainsPathToSchemas( @Nullable Object arg, @@ -389,7 +388,7 @@ public abstract class JsonSchema { return arg; } - protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws InvalidTypeException { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { pathSet.add(pathToItem); List<@Nullable Object> argFixed = new ArrayList<>(); int i =0; @@ -403,13 +402,13 @@ public abstract class JsonSchema { return argFixed; } - protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws InvalidTypeException { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws ValidationException { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new ValidationException("Invalid non-string key value"); } Object val = entry.getValue(); List newPathToItem = new ArrayList<>(pathToItem); @@ -420,7 +419,7 @@ public abstract class JsonSchema { return argFixed; } - private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws InvalidTypeException { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws ValidationException { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { @@ -448,7 +447,7 @@ public abstract class JsonSchema { return castToAllowedTypes(arg.toString(), pathToItem, pathSet); } else { Class argClass = arg.getClass(); - throw new InvalidTypeException("Invalid type passed in for input="+arg+" type="+argClass); + throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); } } diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs index 595e9d0b176..90408f24eee 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/ListSchemaValidator.hbs @@ -1,13 +1,12 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; - OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; + OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException; + BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/LongEnumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/LongEnumValidator.hbs index cc5be44415b..f5045ca0e94 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/LongEnumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/LongEnumValidator.hbs @@ -1,9 +1,8 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public interface LongEnumValidator { - long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs index a82f53bede1..3926cf38ca8 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/MapSchemaValidator.hbs @@ -1,14 +1,13 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import java.util.List; import java.util.Map; public interface MapSchemaValidator { - OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; - OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; + OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException; + BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/NullEnumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/NullEnumValidator.hbs index 4aff986f824..5a99d6e2ca0 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/NullEnumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/NullEnumValidator.hbs @@ -1,9 +1,8 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public interface NullEnumValidator { - Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs index afa624000fb..37a164d633f 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/NullSchemaValidator.hbs @@ -1,10 +1,9 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public interface NullSchemaValidator { - Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs index ad82a87004f..63f4ac97158 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/NumberSchemaValidator.hbs @@ -1,10 +1,9 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public interface NumberSchemaValidator { - Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/StringEnumValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/StringEnumValidator.hbs index 8af27f62161..4731c6f1d9c 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/StringEnumValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/StringEnumValidator.hbs @@ -1,9 +1,8 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public interface StringEnumValidator { - String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs index b4942c62e2e..30724ee6f48 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/StringSchemaValidator.hbs @@ -1,10 +1,9 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; public interface StringSchemaValidator { - String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + String validate(String arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs index e19139dd7a0..4f2f6606f3d 100644 --- a/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs +++ b/src/main/resources/java/src/main/java/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -2,7 +2,6 @@ package {{{packageName}}}.schemas.validation; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; @@ -73,7 +72,7 @@ public class UnsetAnyTypeJsonSchema { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -85,7 +84,7 @@ public class UnsetAnyTypeJsonSchema { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -97,7 +96,7 @@ public class UnsetAnyTypeJsonSchema { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -108,24 +107,24 @@ public class UnsetAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -136,15 +135,15 @@ public class UnsetAnyTypeJsonSchema { return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -167,7 +166,7 @@ public class UnsetAnyTypeJsonSchema { return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public class UnsetAnyTypeJsonSchema { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -232,7 +231,7 @@ public class UnsetAnyTypeJsonSchema { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -247,41 +246,41 @@ public class UnsetAnyTypeJsonSchema { } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -297,7 +296,7 @@ public class UnsetAnyTypeJsonSchema { } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new 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/java/src/main/java/packagename/servers/ServerN.hbs b/src/main/resources/java/src/main/java/packagename/servers/ServerN.hbs index be9db5b7969..386249654e8 100644 --- a/src/main/resources/java/src/main/java/packagename/servers/ServerN.hbs +++ b/src/main/resources/java/src/main/java/packagename/servers/ServerN.hbs @@ -4,7 +4,6 @@ package {{{packageName}}}.{{subpackage}}; {{#with variables}} import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; {{#neq ../subpackage "servers"}} import {{{packageName}}}.servers.ServerWithVariables; @@ -30,7 +29,7 @@ public class {{../jsonPathPiece.pascalCase}} extends ServerWithVariables<{{conta ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) ); - } catch (ValidationException | InvalidTypeException e) { + } catch (ValidationException e) { throw new RuntimeException(e); } } diff --git a/src/main/resources/java/src/test/java/packagename/components/schemas/Schema_test.hbs b/src/main/resources/java/src/test/java/packagename/components/schemas/Schema_test.hbs index a1155141793..b87aae73c8d 100644 --- a/src/main/resources/java/src/test/java/packagename/components/schemas/Schema_test.hbs +++ b/src/main/resources/java/src/test/java/packagename/components/schemas/Schema_test.hbs @@ -5,7 +5,6 @@ import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.exceptions.ValidationException; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -21,7 +20,7 @@ public class {{containerJsonPathPiece.pascalCase}}Test { {{#with this }} @Test - public void test{{@key}}{{#if valid}}Passes() throws ValidationException, InvalidTypeException{{else}}Fails(){{/if}} { + public void test{{@key}}{{#if valid}}Passes() throws ValidationException{{else}}Fails(){{/if}} { // {{description.codeEscaped}} final var schema = {{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(); {{#if valid}} @@ -46,7 +45,7 @@ public class {{containerJsonPathPiece.pascalCase}}Test { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } {{/if}} diff --git a/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs b/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs index 270bd752c0c..9ba7d43cc12 100644 --- a/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/header/ContentHeaderTest.hbs @@ -5,7 +5,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.mediatype.MediaType; @@ -26,7 +25,7 @@ public class ContentHeaderTest { } @Test - public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { + public void testSerialization() throws ValidationException, NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs b/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs index a9ef7a5df2d..e7e046a0615 100644 --- a/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/header/SchemaHeaderTest.hbs @@ -5,7 +5,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; @@ -30,7 +29,7 @@ public class SchemaHeaderTest { } @Test - public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { + public void testSerialization() throws ValidationException, NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -128,7 +127,7 @@ public class SchemaHeaderTest { } @Test - public void testDeserialization() throws ValidationException, NotImplementedException, InvalidTypeException { + public void testDeserialization() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); diff --git a/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs index 7739dd22e74..f0b9a7c1aa6 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/SchemaNonQueryParameterTest.hbs @@ -3,7 +3,6 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; diff --git a/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs b/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs index 115b36b037d..d6e4206daba 100644 --- a/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/parameter/SchemaQueryParameterTest.hbs @@ -3,7 +3,6 @@ package {{{packageName}}}.parameter; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; diff --git a/src/main/resources/java/src/test/java/packagename/requestbody/RequestBodySerializerTest.hbs b/src/main/resources/java/src/test/java/packagename/requestbody/RequestBodySerializerTest.hbs index 90bf6114e41..9cb130f9a46 100644 --- a/src/main/resources/java/src/test/java/packagename/requestbody/RequestBodySerializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/requestbody/RequestBodySerializerTest.hbs @@ -3,7 +3,6 @@ package {{{packageName}}}.requestbody; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.contenttype.ContentTypeDetector; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.AnyTypeJsonSchema; @@ -96,7 +95,7 @@ public final class RequestBodySerializerTest { } @Test - public void testSerializeApplicationJson() throws ValidationException, InvalidTypeException, NotImplementedException { + public void testSerializeApplicationJson() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); String jsonBody; @@ -167,7 +166,7 @@ public final class RequestBodySerializerTest { } @Test - public void testSerializeTextPlain() throws ValidationException, InvalidTypeException, NotImplementedException { + public void testSerializeTextPlain() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); SerializedRequestBody requestBody = serializer.serialize( diff --git a/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs b/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs index f0439e1423a..d2c30db34aa 100644 --- a/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/response/ResponseDeserializerTest.hbs @@ -8,7 +8,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.NotImplementedException; import {{{packageName}}}.exceptions.ApiException; import {{{packageName}}}.exceptions.ValidationException; @@ -68,7 +67,7 @@ public class ResponseDeserializerTest { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, InvalidTypeException { + 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); @@ -152,7 +151,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonNull() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); @@ -168,7 +167,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonTrue() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); @@ -184,7 +183,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonFalse() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); @@ -200,7 +199,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonInt() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); @@ -216,7 +215,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonFloat() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); @@ -232,7 +231,7 @@ public class ResponseDeserializerTest { } @Test - public void testDeserializeApplicationJsonString() throws ValidationException, ApiException, NotImplementedException, InvalidTypeException { + 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"); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/AnyTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/AnyTypeSchemaTest.hbs index f27e26f7b0e..734ad4a080f 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/AnyTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/AnyTypeSchemaTest.hbs @@ -5,7 +5,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.FrozenList; import {{{packageName}}}.schemas.validation.FrozenMap; @@ -28,13 +27,13 @@ public class AnyTypeSchemaTest { } @Test - public void testValidateNull() throws ValidationException, InvalidTypeException { + public void testValidateNull() throws ValidationException { Void validatedValue = schema.validate((Void) null, configuration); assertNull(validatedValue); } @Test - public void testValidateBoolean() throws ValidationException, InvalidTypeException { + public void testValidateBoolean() throws ValidationException { boolean trueValue = schema.validate(true, configuration); Assert.assertTrue(trueValue); @@ -43,49 +42,49 @@ public class AnyTypeSchemaTest { } @Test - public void testValidateInteger() throws ValidationException, InvalidTypeException { + public void testValidateInteger() throws ValidationException { int validatedValue = schema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() throws ValidationException, InvalidTypeException { + public void testValidateLong() throws ValidationException { long validatedValue = schema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() throws ValidationException, InvalidTypeException { + public void testValidateFloat() throws ValidationException { float validatedValue = schema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() throws ValidationException, InvalidTypeException { + public void testValidateDouble() throws ValidationException { double validatedValue = schema.validate(70.6458763d, configuration); Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); } @Test - public void testValidateString() throws ValidationException, InvalidTypeException { + public void testValidateString() throws ValidationException { String validatedValue = schema.validate("a", configuration); Assert.assertEquals(validatedValue, "a"); } @Test - public void testValidateZonedDateTime() throws ValidationException, InvalidTypeException { + public void testValidateZonedDateTime() throws ValidationException { String validatedValue = schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration); Assert.assertEquals(validatedValue, "2017-07-21T17:32:28Z"); } @Test - public void testValidateLocalDate() throws ValidationException, InvalidTypeException { + public void testValidateLocalDate() throws ValidationException { String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); Assert.assertEquals(validatedValue, "2017-07-21"); } @Test - public void testValidateMap() throws ValidationException, InvalidTypeException { + public void testValidateMap() throws ValidationException { LinkedHashMap inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap validatedValue = schema.validate(inMap, configuration); @@ -95,7 +94,7 @@ public class AnyTypeSchemaTest { } @Test - public void testValidateList() throws ValidationException, InvalidTypeException { + public void testValidateList() throws ValidationException { ArrayList inList = new ArrayList<>(); inList.add(LocalDate.of(2017, 7, 21)); FrozenList validatedValue = schema.validate(inList, configuration); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs index 5e69ae24b98..c2b9687a5b2 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ArrayTypeSchemaTest.hbs @@ -5,13 +5,12 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; +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}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -66,7 +65,7 @@ public class ArrayTypeSchemaTest { return new FrozenList<>(items); } - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -77,7 +76,7 @@ public class ArrayTypeSchemaTest { } @Override - public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithItemsSchemaBoxedList(validate(arg, configuration)); } @@ -90,19 +89,19 @@ public class ArrayTypeSchemaTest { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return new ArrayWithItemsSchemaBoxedList(validate(listArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -111,7 +110,7 @@ public class ArrayTypeSchemaTest { super(m); } - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithOutputClsSchema().validate(arg, configuration); } } @@ -152,7 +151,7 @@ public class ArrayTypeSchemaTest { return new ArrayWithOutputClsSchemaList(newInstanceItems); } - public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,7 +162,7 @@ public class ArrayTypeSchemaTest { } @Override - public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)); } @@ -176,19 +175,19 @@ public class ArrayTypeSchemaTest { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return new ArrayWithOutputClsSchemaBoxedList(validate(listArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -202,7 +201,7 @@ public class ArrayTypeSchemaTest { } @Test - public void testValidateArrayWithItemsSchema() throws ValidationException, InvalidTypeException { + public void testValidateArrayWithItemsSchema() throws ValidationException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); @@ -227,7 +226,7 @@ public class ArrayTypeSchemaTest { } @Test - public void testValidateArrayWithOutputClsSchema() throws ValidationException, InvalidTypeException { + public void testValidateArrayWithOutputClsSchema() throws ValidationException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/BooleanSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/BooleanSchemaTest.hbs index 8511da6b07d..39213dd8fd2 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/BooleanSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/BooleanSchemaTest.hbs @@ -4,7 +4,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.PathToSchemasMap; @@ -24,13 +23,13 @@ public class BooleanSchemaTest { ); @Test - public void testValidateTrue() throws ValidationException, InvalidTypeException { + public void testValidateTrue() throws ValidationException { boolean validatedValue = booleanJsonSchema.validate(true, configuration); Assert.assertTrue(validatedValue); } @Test - public void testValidateFalse() throws ValidationException, InvalidTypeException { + public void testValidateFalse() throws ValidationException { boolean validatedValue = booleanJsonSchema.validate(false, configuration); Assert.assertFalse(validatedValue); } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ListSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ListSchemaTest.hbs index eaeb1d1be41..56c0f867483 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ListSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ListSchemaTest.hbs @@ -5,7 +5,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.FrozenList; @@ -36,7 +35,7 @@ public class ListSchemaTest { } @Test - public void testValidateList() throws ValidationException, InvalidTypeException { + public void testValidateList() throws ValidationException { List inList = new ArrayList<>(); inList.add("today"); FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/MapSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/MapSchemaTest.hbs index ab876c35431..9cd90ec8758 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/MapSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/MapSchemaTest.hbs @@ -5,7 +5,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.FrozenMap; @@ -38,7 +37,7 @@ public class MapSchemaTest { } @Test - public void testValidateMap() throws ValidationException, InvalidTypeException { + public void testValidateMap() throws ValidationException { Map inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap<@Nullable Object> validatedValue = mapJsonSchema.validate(inMap, configuration); diff --git a/src/main/resources/java/src/test/java/packagename/schemas/NullSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/NullSchemaTest.hbs index c971a06d62b..b5a0bc3b6fc 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/NullSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/NullSchemaTest.hbs @@ -4,7 +4,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.PathToSchemasMap; @@ -26,7 +25,7 @@ public class NullSchemaTest { @Test @SuppressWarnings("nullness") - public void testValidateNull() throws ValidationException, InvalidTypeException { + public void testValidateNull() throws ValidationException { Void validatedValue = nullJsonSchema.validate(null, configuration); Assert.assertNull(validatedValue); } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/NumberSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/NumberSchemaTest.hbs index 6b5ec12bda7..a757fee8539 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/NumberSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/NumberSchemaTest.hbs @@ -4,7 +4,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.PathToSchemasMap; @@ -24,25 +23,25 @@ public class NumberSchemaTest { ); @Test - public void testValidateInteger() throws ValidationException, InvalidTypeException { + public void testValidateInteger() throws ValidationException { int validatedValue = numberJsonSchema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() throws ValidationException, InvalidTypeException { + public void testValidateLong() throws ValidationException { long validatedValue = numberJsonSchema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() throws ValidationException, InvalidTypeException { + public void testValidateFloat() throws ValidationException { float validatedValue = numberJsonSchema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() throws ValidationException, InvalidTypeException { + public void testValidateDouble() throws ValidationException { double validatedValue = numberJsonSchema.validate(3.14d, configuration); Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs index b659b49f344..10824eef52c 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/ObjectTypeSchemaTest.hbs @@ -5,7 +5,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.JsonSchemaInfo; @@ -79,7 +78,7 @@ public class ObjectTypeSchemaTest { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,7 +89,7 @@ public class ObjectTypeSchemaTest { } @Override - public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)); } @@ -103,19 +102,19 @@ public class ObjectTypeSchemaTest { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -166,7 +165,7 @@ public class ObjectTypeSchemaTest { return new FrozenMap<>(properties); } - public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,24 +176,24 @@ public class ObjectTypeSchemaTest { } @Override - public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -252,7 +251,7 @@ public class ObjectTypeSchemaTest { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -263,24 +262,24 @@ public class ObjectTypeSchemaTest { } @Override - public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -297,7 +296,7 @@ public class ObjectTypeSchemaTest { super(m); } - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); } } @@ -347,7 +346,7 @@ public class ObjectTypeSchemaTest { return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); } - public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -358,24 +357,24 @@ public class ObjectTypeSchemaTest { } @Override - public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithOutputTypeSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -398,7 +397,7 @@ public class ObjectTypeSchemaTest { } @Test - public void testValidateObjectWithPropsSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithPropsSchema() throws ValidationException { ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); // map with only property works @@ -429,7 +428,7 @@ public class ObjectTypeSchemaTest { } @Test - public void testValidateObjectWithAddpropsSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithAddpropsSchema() throws ValidationException { ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); // map with only property works @@ -460,7 +459,7 @@ public class ObjectTypeSchemaTest { } @Test - public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException { ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); // map with only property works @@ -499,7 +498,7 @@ public class ObjectTypeSchemaTest { } @Test - public void testValidateObjectWithOutputTypeSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithOutputTypeSchema() throws ValidationException { ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); // map with only property works diff --git a/src/main/resources/java/src/test/java/packagename/schemas/RefBooleanSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/RefBooleanSchemaTest.hbs index adc70148e20..41fd5c775b2 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/RefBooleanSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/RefBooleanSchemaTest.hbs @@ -4,7 +4,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.validation.JsonSchema; import {{{packageName}}}.schemas.validation.PathToSchemasMap; @@ -28,13 +27,13 @@ public class RefBooleanSchemaTest { ); @Test - public void testValidateTrue() throws ValidationException, InvalidTypeException { + public void testValidateTrue() throws ValidationException { Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); Assert.assertEquals(validatedValue, Boolean.TRUE); } @Test - public void testValidateFalse() throws ValidationException, InvalidTypeException { + public void testValidateFalse() throws ValidationException { Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); Assert.assertEquals(validatedValue, Boolean.FALSE); } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs index 38a8f4e7325..69b1e893316 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs @@ -5,7 +5,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import {{{packageName}}}.schemas.MapJsonSchema; import {{{packageName}}}.schemas.StringJsonSchema; @@ -51,15 +50,15 @@ public class AdditionalPropertiesValidatorTest { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/ItemsValidatorTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/ItemsValidatorTest.hbs index 268ecce8dca..8d71ecef85f 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/ItemsValidatorTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/ItemsValidatorTest.hbs @@ -6,7 +6,6 @@ import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; import {{{packageName}}}.schemas.StringJsonSchema; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import java.util.ArrayList; @@ -41,15 +40,15 @@ public class ItemsValidatorTest { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return validate(listArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithItemsSchemaBoxedList(); } } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs index 2870c89a872..ad24b1854fc 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/JsonSchemaTest.hbs @@ -5,7 +5,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -44,15 +43,15 @@ public class JsonSchemaTest { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new SomeSchemaBoxedString(); } } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/PropertiesValidatorTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/PropertiesValidatorTest.hbs index e3821be2966..5ef9900e320 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/PropertiesValidatorTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/PropertiesValidatorTest.hbs @@ -5,9 +5,8 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; -import {{{packageName}}}.schemas.StringJsonSchema; import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.StringJsonSchema; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -40,15 +39,15 @@ public class PropertiesValidatorTest { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } diff --git a/src/main/resources/java/src/test/java/packagename/schemas/validation/RequiredValidatorTest.hbs b/src/main/resources/java/src/test/java/packagename/schemas/validation/RequiredValidatorTest.hbs index d8fddba015d..8107f561c88 100644 --- a/src/main/resources/java/src/test/java/packagename/schemas/validation/RequiredValidatorTest.hbs +++ b/src/main/resources/java/src/test/java/packagename/schemas/validation/RequiredValidatorTest.hbs @@ -5,7 +5,6 @@ import org.junit.Assert; import org.junit.Test; import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; import {{{packageName}}}.configurations.SchemaConfiguration; -import {{{packageName}}}.exceptions.InvalidTypeException; import {{{packageName}}}.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -36,15 +35,15 @@ public class RequiredValidatorTest { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithRequiredSchemaBoxedMap(); } } From ffbb7d1cb6df2776e7ab8600c0e8eb18964f956c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 3 Apr 2024 11:58:34 -0700 Subject: [PATCH 43/53] Adds response exception catching to the operation docs --- .../java/docs/paths/anotherfakedummy/Patch.md | 13 ++++---- .../docs/paths/commonparamsubdir/Delete.md | 13 ++++---- .../java/docs/paths/commonparamsubdir/Get.md | 13 ++++---- .../java/docs/paths/commonparamsubdir/Post.md | 13 ++++---- .../petstore/java/docs/paths/fake/Delete.md | 19 ++++++------ .../petstore/java/docs/paths/fake/Get.md | 22 ++++++++----- .../petstore/java/docs/paths/fake/Patch.md | 13 ++++---- .../petstore/java/docs/paths/fake/Post.md | 24 ++++++++------ .../Get.md | 13 ++++---- .../docs/paths/fakebodywithfileschema/Put.md | 13 ++++---- .../docs/paths/fakebodywithqueryparams/Put.md | 15 ++++----- .../docs/paths/fakecasesensitiveparams/Put.md | 11 ++++--- .../docs/paths/fakeclassnametest/Patch.md | 19 ++++++------ .../docs/paths/fakedeletecoffeeid/Delete.md | 12 ++++--- .../java/docs/paths/fakehealth/Get.md | 9 +++--- .../fakeinlineadditionalproperties/Post.md | 13 ++++---- .../docs/paths/fakeinlinecomposition/Post.md | 15 ++++----- .../java/docs/paths/fakejsonformdata/Get.md | 13 ++++---- .../java/docs/paths/fakejsonpatch/Patch.md | 13 ++++---- .../docs/paths/fakejsonwithcharset/Post.md | 13 ++++---- .../Post.md | 13 ++++---- .../paths/fakemultipleresponsebodies/Get.md | 10 +++--- .../docs/paths/fakemultiplesecurities/Get.md | 19 ++++++------ .../java/docs/paths/fakeobjinquery/Get.md | 11 ++++--- .../Post.md | 19 ++++++------ .../java/docs/paths/fakepemcontenttype/Get.md | 13 ++++---- .../Post.md | 19 ++++++------ .../fakequeryparamwithjsoncontenttype/Get.md | 11 ++++--- .../java/docs/paths/fakeredirection/Get.md | 10 +++--- .../java/docs/paths/fakerefobjinquery/Get.md | 11 ++++--- .../docs/paths/fakerefsarraymodel/Post.md | 13 ++++---- .../docs/paths/fakerefsarrayofenums/Post.md | 13 ++++---- .../java/docs/paths/fakerefsboolean/Post.md | 13 ++++---- .../Post.md | 13 ++++---- .../java/docs/paths/fakerefsenum/Post.md | 13 ++++---- .../java/docs/paths/fakerefsmammal/Post.md | 13 ++++---- .../java/docs/paths/fakerefsnumber/Post.md | 13 ++++---- .../fakerefsobjectmodelwithrefprops/Post.md | 13 ++++---- .../java/docs/paths/fakerefsstring/Post.md | 13 ++++---- .../paths/fakeresponsewithoutschema/Get.md | 9 +++--- .../docs/paths/faketestqueryparamters/Put.md | 11 ++++--- .../docs/paths/fakeuploaddownloadfile/Post.md | 13 ++++---- .../java/docs/paths/fakeuploadfile/Post.md | 13 ++++---- .../java/docs/paths/fakeuploadfiles/Post.md | 13 ++++---- .../docs/paths/fakewildcardresponses/Get.md | 18 ++++++++--- .../petstore/java/docs/paths/foo/Get.md | 7 +++-- .../petstore/java/docs/paths/pet/Post.md | 24 ++++++++------ .../petstore/java/docs/paths/pet/Put.md | 25 +++++++++------ .../java/docs/paths/petfindbystatus/Get.md | 24 ++++++++------ .../java/docs/paths/petfindbytags/Get.md | 24 ++++++++------ .../java/docs/paths/petpetid/Delete.md | 23 ++++++++------ .../petstore/java/docs/paths/petpetid/Get.md | 23 +++++++++----- .../petstore/java/docs/paths/petpetid/Post.md | 23 ++++++++------ .../docs/paths/petpetiduploadimage/Post.md | 20 ++++++------ .../petstore/java/docs/paths/solidus/Get.md | 9 +++--- .../java/docs/paths/storeinventory/Get.md | 16 +++++----- .../java/docs/paths/storeorder/Post.md | 18 +++++++---- .../docs/paths/storeorderorderid/Delete.md | 16 +++++++--- .../java/docs/paths/storeorderorderid/Get.md | 17 +++++++--- .../petstore/java/docs/paths/user/Post.md | 13 ++++---- .../docs/paths/usercreatewitharray/Post.md | 13 ++++---- .../docs/paths/usercreatewithlist/Post.md | 13 ++++---- .../petstore/java/docs/paths/userlogin/Get.md | 17 +++++++--- .../java/docs/paths/userlogout/Get.md | 9 +++--- .../java/docs/paths/userusername/Delete.md | 16 +++++++--- .../java/docs/paths/userusername/Get.md | 17 +++++++--- .../java/docs/paths/userusername/Put.md | 20 +++++++----- .../path/verb/_OperationDocCodeSample.hbs | 31 +++++++++++++------ .../path/verb/_OperationDocExcCodeSample.hbs | 11 +++++++ 69 files changed, 618 insertions(+), 430 deletions(-) create mode 100644 src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 2b15b83b225..2ab77481d6e 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named patch ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.RequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.RequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.Code200Response; import org.openapijsonschematools.client.paths.anotherfakedummy.Patch; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index 1a331dc2358..32bd2408a66 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named delete ### Code Sample ``` -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.HeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.commonparamsubdir.delete.HeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.Code200Response; import org.openapijsonschematools.client.paths.commonparamsubdir.Delete; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index 5693cefd4e0..b77882d8c9e 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.paths.commonparamsubdir.get.QueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.get.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.commonparamsubdir.get.QueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.Code200Response; import org.openapijsonschematools.client.paths.commonparamsubdir.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index 8393342e4d3..5387a8437ea 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.commonparamsubdir.post.HeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.post.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.commonparamsubdir.post.HeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.Code200Response; import org.openapijsonschematools.client.paths.commonparamsubdir.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index 9c825256fd7..37921c57f77 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -26,15 +26,6 @@ a class that allows one to call the endpoint using a method named delete ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.fake.delete.HeaderParameters; -import org.openapijsonschematools.client.paths.fake.delete.QueryParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.BearerTest; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -44,6 +35,16 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.delete.FakeDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.fake.delete.HeaderParameters; +import org.openapijsonschematools.client.paths.fake.delete.QueryParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.BearerTest; +import org.openapijsonschematools.client.paths.fake.delete.responses.Code200Response; import org.openapijsonschematools.client.paths.fake.Delete; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index ab3d0b96b43..9fd15f7a58b 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -22,14 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.paths.fake.get.RequestBody; -import org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; -import org.openapijsonschematools.client.paths.fake.get.HeaderParameters; -import org.openapijsonschematools.client.paths.fake.get.QueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +31,16 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fake.get.RequestBody; +import org.openapijsonschematools.client.paths.fake.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; +import org.openapijsonschematools.client.paths.fake.get.HeaderParameters; +import org.openapijsonschematools.client.paths.fake.get.QueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fake.get.responses.Code200Response; +import org.openapijsonschematools.client.paths.fake.get.responses.Code404Response; import org.openapijsonschematools.client.paths.fake.Get; import java.io.IOException; @@ -68,6 +70,10 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); +} catch (Get.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index e5558317f07..458939a0730 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named patch ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.patch.RequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.patch.RequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fake.patch.responses.Code200Response; import org.openapijsonschematools.client.paths.fake.Patch; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index 3397d9641e1..d098d920f36 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -22,15 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fake.post.RequestBody; -import org.openapijsonschematools.client.paths.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -40,6 +31,17 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fake.post.RequestBody; +import org.openapijsonschematools.client.paths.fake.post.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; +import org.openapijsonschematools.client.paths.fake.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fake.post.responses.Code404Response; import org.openapijsonschematools.client.paths.fake.Post; import java.io.IOException; @@ -77,6 +79,10 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); +} catch (Post.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index e56f2f652d1..ce6b9150bac 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.RequestBody; -import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeadditionalpropertieswitharrayofenums.get.RequestBody; +import org.openapijsonschematools.client.components.schemas.AdditionalPropertiesWithArrayOfEnums; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index 94ad2fc1850..bed3ab68d6c 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named put ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.RequestBody; -import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.RequestBody; +import org.openapijsonschematools.client.components.schemas.FileSchemaTestClass; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.Code200Response; import org.openapijsonschematools.client.paths.fakebodywithfileschema.Put; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index 09e3e53e092..adc5a93297c 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -26,13 +26,6 @@ a class that allows one to call the endpoint using a method named put ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.RequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.QueryParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -42,6 +35,14 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.RequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.QueryParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.Code200Response; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.Put; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index d56e914e211..da32c83d498 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -24,11 +24,6 @@ a class that allows one to call the endpoint using a method named put ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.QueryParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -38,6 +33,12 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.QueryParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.Code200Response; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.Put; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index 7416464f935..08cbb4820e9 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -24,15 +24,6 @@ a class that allows one to call the endpoint using a method named patch ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; -import org.openapijsonschematools.client.paths.fakeclassnametest.patch.RequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -42,6 +33,16 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.RequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKeyQuery; +import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.Code200Response; import org.openapijsonschematools.client.paths.fakeclassnametest.Patch; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index 8fb4a384faa..978c522016c 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -24,11 +24,6 @@ a class that allows one to call the endpoint using a method named delete ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -38,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.CodedefaultResponse; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.Delete; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index 0066f020084..b4f58458049 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -22,10 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -35,6 +31,11 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakehealth.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakehealth.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index 20d932e19c0..c926858f6c2 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.RequestBody; -import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 3ccb6b9a95f..fde0dfc7e6b 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -22,13 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.RequestBody; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.QueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -38,6 +31,14 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeinlinecomposition.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.QueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakeinlinecomposition.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index c8f3b63f10b..a68a50c0d1a 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakejsonformdata.get.RequestBody; -import org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakejsonformdata.get.RequestBody; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.requestbody.content.applicationxwwwformurlencoded.ApplicationxwwwformurlencodedSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakejsonformdata.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index 556aa86f8c4..939aedb7cee 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named patch ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.RequestBody; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakejsonpatch.patch.RequestBody; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.Code200Response; import org.openapijsonschematools.client.paths.fakejsonpatch.Patch; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index b520197c4a4..974486b62ae 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.RequestBody; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakejsonwithcharset.post.RequestBody; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakejsonwithcharset.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index db5c9ed1ffa..3e95e603b8f 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.RequestBody; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakemultiplerequestbodycontenttypes.post.RequestBody; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index 7815b433b2f..47976f2b7bd 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -22,10 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -35,6 +31,12 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.Code202Response; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index 5eaec1839b0..a48be35e4c2 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -22,15 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -40,6 +31,16 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.HttpBasicTest; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakemultiplesecurities.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index 5d69a57ac25..d7b3047c0c0 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -22,11 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakeobjinquery.get.QueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -36,6 +31,12 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeobjinquery.get.QueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakeobjinquery.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index 7b14516a567..57e353ae75d 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -24,15 +24,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.RequestBody; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.HeaderParameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.QueryParameters; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.CookieParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -42,6 +33,16 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeparametercollisions1ababselfab.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.HeaderParameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.QueryParameters; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.CookieParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index 56957c87be7..7829f925171 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.RequestBody; -import org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile.ApplicationxpemfileSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakepemcontenttype.get.RequestBody; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile.ApplicationxpemfileSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakepemcontenttype.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index ffad2328057..3d50d95e2ef 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -24,15 +24,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.RequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -42,6 +33,16 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakepetiduploadimagewithrequiredfile.post.RequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index 98a41007ebd..181e39ceb43 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -24,11 +24,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.QueryParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -38,6 +33,12 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.QueryParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index 9a9d7ee7180..60bb45ce843 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -22,10 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -35,6 +31,12 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeredirection.get.responses.Code303Response; +import org.openapijsonschematools.client.paths.fakeredirection.get.responses.Code3XXResponse; import org.openapijsonschematools.client.paths.fakeredirection.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index b5f03558e89..afcadc2ef10 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -22,11 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakerefobjinquery.get.QueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -36,6 +31,12 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefobjinquery.get.QueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakerefobjinquery.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index eba2826f61a..08110becf17 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.AnimalFarm; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsarraymodel.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.AnimalFarm; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakerefsarraymodel.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index b8784714854..c6baf8390e8 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsarrayofenums.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakerefsarrayofenums.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index cd6f05d5f39..1a56ce83e57 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakerefsboolean.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.BooleanSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsboolean.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.BooleanSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakerefsboolean.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index 340cd0908fc..9938956a174 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefscomposedoneofnumberwithvalidations.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index 17fbe100933..642df9c5346 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakerefsenum.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.StringEnum; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsenum.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.StringEnum; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakerefsenum.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index e7f56851f63..d9c199a527e 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.Mammal; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.Mammal; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakerefsmammal.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index 3f0e8edc17c..af7697eb585 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakerefsnumber.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.NumberWithValidations; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsnumber.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.NumberWithValidations; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakerefsnumber.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 17fb878b34f..376241e3121 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsobjectmodelwithrefprops.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index c2da5b72f67..717a32e9bfb 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakerefsstring.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.StringSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakerefsstring.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.StringSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakerefsstring.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index 45a84d29d08..e0c2dc6d4aa 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -22,10 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -35,6 +31,11 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index 6479c0642ba..d4ba80e7a03 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -24,11 +24,6 @@ a class that allows one to call the endpoint using a method named put ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.faketestqueryparamters.put.QueryParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -38,6 +33,12 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.QueryParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.Code200Response; import org.openapijsonschematools.client.paths.faketestqueryparamters.Put; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index 645873c22ff..1aac880aec9 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.RequestBody; -import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream.ApplicationoctetstreamSchema; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.requestbody.content.applicationoctetstream.ApplicationoctetstreamSchema; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index 147dc01bbe3..d867d2f460b 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakeuploadfile.post.RequestBody; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeuploadfile.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakeuploadfile.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index d317227e802..98ce6e256aa 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -22,12 +22,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.RequestBody; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -37,6 +31,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.fakeuploadfiles.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fakeuploadfiles.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index 5d9315ff60a..e877fabb558 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -22,10 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -35,6 +31,16 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code1XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code2XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code3XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code4XXResponse; +import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code5XXResponse; import org.openapijsonschematools.client.paths.fakewildcardresponses.Get; import java.io.IOException; @@ -64,6 +70,10 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); +} catch (Get.ResponseApiException | Get.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index 582931a2d6c..af3ca1290cf 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -22,9 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; -import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer0; -import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer1; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -34,6 +31,10 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.foo.get.FooGetServerInfo; +import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer0; +import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer1; +import org.openapijsonschematools.client.paths.foo.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.paths.foo.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index f0eaadd409f..3124d5c0a22 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -24,6 +24,15 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.RootServerInfo; import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; import org.openapijsonschematools.client.paths.pet.post.RequestBody; @@ -35,15 +44,8 @@ import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.pet.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.pet.post.responses.Code405Response; import org.openapijsonschematools.client.paths.pet.Post; import java.io.IOException; @@ -124,6 +126,10 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); +} catch (Post.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index 8cbec2ec85c..8efade3d2ec 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -24,6 +24,15 @@ a class that allows one to call the endpoint using a method named put ### Code Sample ``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.RootServerInfo; import org.openapijsonschematools.client.paths.pet.put.PetPutSecurityInfo; import org.openapijsonschematools.client.paths.pet.put.RequestBody; @@ -34,15 +43,9 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.pet.put.responses.Code400Response; +import org.openapijsonschematools.client.paths.pet.put.responses.Code404Response; +import org.openapijsonschematools.client.paths.pet.put.responses.Code405Response; import org.openapijsonschematools.client.paths.pet.Put; import java.io.IOException; @@ -120,6 +123,10 @@ var request = new PutRequestBuilder() try { Void response = apiClient.put(request); +} catch (Put.ResponseApiException | Put.ResponseApiException | Put.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 6009a4a27f6..11a1dc0ef07 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -24,15 +24,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.paths.petfindbystatus.PetfindbystatusServerInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbystatus.get.QueryParameters; -import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer0; -import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer1; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -42,6 +33,17 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.petfindbystatus.PetfindbystatusServerInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.get.PetfindbystatusGetSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbystatus.get.QueryParameters; +import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer0; +import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer1; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.Code200Response; +import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.Code400Response; import org.openapijsonschematools.client.paths.petfindbystatus.Get; import java.io.IOException; @@ -93,6 +95,10 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); +} catch (Get.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index fc5b085793a..e98dadc280a 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -24,15 +24,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetSecurityInfo; -import org.openapijsonschematools.client.paths.petfindbytags.get.QueryParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -42,6 +33,17 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.petfindbytags.get.PetfindbytagsGetSecurityInfo; +import org.openapijsonschematools.client.paths.petfindbytags.get.QueryParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.petfindbytags.get.responses.Code200Response; +import org.openapijsonschematools.client.paths.petfindbytags.get.responses.Code400Response; import org.openapijsonschematools.client.paths.petfindbytags.Get; import java.io.IOException; @@ -91,6 +93,10 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); +} catch (Get.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index a3117b65623..ee3dbb0f018 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -24,6 +24,15 @@ a class that allows one to call the endpoint using a method named delete ### Code Sample ``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.petpetid.delete.HeaderParameters; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; @@ -34,15 +43,7 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.petpetid.delete.responses.Code400Response; import org.openapijsonschematools.client.paths.petpetid.Delete; import java.io.IOException; @@ -92,6 +93,10 @@ var request = new DeleteRequestBuilder() try { Void response = apiClient.delete(request); +} catch (Delete.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index a1fd16340a5..0b0a27834db 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -24,14 +24,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.get.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -41,6 +33,17 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.get.PetpetidGetSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.get.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.paths.petpetid.get.responses.Code200Response; +import org.openapijsonschematools.client.paths.petpetid.get.responses.Code400Response; +import org.openapijsonschematools.client.paths.petpetid.get.responses.Code404Response; import org.openapijsonschematools.client.paths.petpetid.Get; import java.io.IOException; @@ -90,6 +93,10 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); +} catch (Get.ResponseApiException | Get.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index dfc0d1e7d9e..e0dda2bc8ef 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -24,6 +24,15 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.petpetid.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; @@ -34,15 +43,7 @@ import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.securityschemes.SecurityScheme; import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.petpetid.post.responses.Code405Response; import org.openapijsonschematools.client.paths.petpetid.Post; import java.io.IOException; @@ -92,6 +93,10 @@ var request = new PostRequestBuilder() try { Void response = apiClient.post(request); +} catch (Post.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index d826b72b6fb..6843773ba9b 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -24,15 +24,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.RequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -42,6 +33,17 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.paths.petpetiduploadimage.post.RequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.Code200Response; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; import org.openapijsonschematools.client.paths.petpetiduploadimage.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index f82b01da205..d20d4e9deeb 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -22,10 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -35,6 +31,11 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.solidus.get.responses.Code200Response; import org.openapijsonschematools.client.paths.solidus.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index 92d16d5ffbb..c7bc08f522a 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -22,13 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -38,6 +31,15 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.paths.storeinventory.get.responses.Code200Response; +import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; import org.openapijsonschematools.client.paths.storeinventory.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index 8453fa63514..95e7da9f34c 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.storeorder.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.Order; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,14 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.storeorder.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.Order; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.storeorder.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.storeorder.post.responses.Code400Response; import org.openapijsonschematools.client.paths.storeorder.Post; import java.io.IOException; @@ -90,6 +92,10 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); +} catch (Post.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index 9e66a24a4eb..b1210cff13a 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -24,11 +24,6 @@ a class that allows one to call the endpoint using a method named delete ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -38,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code400Response; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code404Response; import org.openapijsonschematools.client.paths.storeorderorderid.Delete; import java.io.IOException; @@ -79,6 +81,10 @@ var request = new DeleteRequestBuilder() try { Void response = apiClient.delete(request); +} catch (Delete.ResponseApiException | Delete.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index c8267e7ac7e..0688cac7901 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -24,11 +24,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.storeorderorderid.get.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -38,6 +33,14 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.storeorderorderid.get.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code200Response; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code400Response; +import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code404Response; import org.openapijsonschematools.client.paths.storeorderorderid.Get; import java.io.IOException; @@ -79,6 +82,10 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); +} catch (Get.ResponseApiException | Get.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index e7e762bec9f..b638ab1935b 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.user.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.user.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.user.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.paths.user.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index a17f4ab4f09..3f81a58069d 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.usercreatewitharray.post.RequestBody; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.RequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.paths.usercreatewitharray.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index 15bb49e8bdd..755af77d9ca 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -24,12 +24,6 @@ a class that allows one to call the endpoint using a method named post ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.usercreatewithlist.post.RequestBody; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -39,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.RequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.paths.usercreatewithlist.Post; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index 43677f438f0..6de48f99e3a 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -24,11 +24,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.userlogin.get.QueryParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -38,6 +33,14 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.userlogin.get.QueryParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.userlogin.get.responses.Code200Response; +import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.Code200ResponseHeadersSchema; +import org.openapijsonschematools.client.paths.userlogin.get.responses.Code400Response; import org.openapijsonschematools.client.paths.userlogin.Get; import java.io.IOException; @@ -81,6 +84,10 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); +} catch (Get.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index 8afbea89768..c740efa88f4 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -22,10 +22,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -35,6 +31,11 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.userlogout.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.paths.userlogout.Get; import java.io.IOException; diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index e5744a8e325..f3642421b00 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -24,11 +24,6 @@ a class that allows one to call the endpoint using a method named delete ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.userusername.delete.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -38,6 +33,13 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.userusername.delete.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.userusername.delete.responses.Code200Response; +import org.openapijsonschematools.client.paths.userusername.delete.responses.Code404Response; import org.openapijsonschematools.client.paths.userusername.Delete; import java.io.IOException; @@ -79,6 +81,10 @@ var request = new DeleteRequestBuilder() try { Responses.EndpointResponse response = apiClient.delete(request); +} catch (Delete.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index 5162ba1924b..0c565f21ab8 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -24,11 +24,6 @@ a class that allows one to call the endpoint using a method named get ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.userusername.get.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -38,6 +33,14 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.userusername.get.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.userusername.get.responses.Code200Response; +import org.openapijsonschematools.client.paths.userusername.get.responses.Code400Response; +import org.openapijsonschematools.client.paths.userusername.get.responses.Code404Response; import org.openapijsonschematools.client.paths.userusername.Get; import java.io.IOException; @@ -79,6 +82,10 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); +} catch (Get.ResponseApiException | Get.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index 9118a5b6d52..9f64a43c191 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -26,13 +26,6 @@ a class that allows one to call the endpoint using a method named put ### Code Sample ``` -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.userusername.put.RequestBody; -import org.openapijsonschematools.client.components.schemas.User; -import org.openapijsonschematools.client.paths.userusername.put.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; @@ -42,6 +35,15 @@ import org.openapijsonschematools.client.exceptions.ApiException; 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.RootServerInfo; +import org.openapijsonschematools.client.paths.userusername.put.RequestBody; +import org.openapijsonschematools.client.components.schemas.User; +import org.openapijsonschematools.client.paths.userusername.put.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.userusername.put.responses.Code400Response; +import org.openapijsonschematools.client.paths.userusername.put.responses.Code404Response; import org.openapijsonschematools.client.paths.userusername.Put; import java.io.IOException; @@ -110,6 +112,10 @@ var request = new PutRequestBuilder() try { Void response = apiClient.put(request); +} catch (Put.ResponseApiException | Put.ResponseApiException + e) { + // server returned an error response defined in the openapi document + throw e; } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index 2bf31ba3b0b..f19ce5e7e65 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -1,5 +1,14 @@ ``` {{#with operation}} +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}} @@ -62,15 +71,14 @@ import {{packageName}}.components.securityschemes.{{jsonPathPiece.pascalCase}}; {{/each}} {{/if}} {{/each}} -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 responses}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{#with getSelfOrDeepestRef}} + {{#with headersObjectSchema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/with}} + {{/each}} import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; import java.io.IOException; @@ -205,6 +213,11 @@ var request = new {{className.pascalCase}}() try { {{#if nonErrorResponses }}{{responses.jsonPathPiece.pascalCase}}.EndpointResponse{{else}}Void{{/if}} response = apiClient.{{jsonPathPiece.camelCase}}(request); +{{#or errorStatusCodes errorWildcardStatusCodes}} +} catch ({{> src/main/java/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; diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs new file mode 100644 index 00000000000..986cb34c60f --- /dev/null +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs @@ -0,0 +1,11 @@ +{{#and errorStatusCodes errorWildcardStatusCodes}} +{{#each errorStatusCodes}}{{jsonPathPiece.pascalCase}}.ResponseApiException | {{/each}}{{#each errorWildcardStatusCodes}}{{jsonPathPiece.pascalCase}}.ResponseApiException{{#unless @last}} | {{/unless}}{{/each}} +{{else}} + {{#or errorStatusCodes errorWildcardStatusCodes}} + {{#if errorStatusCodes}} +{{#each errorStatusCodes}}{{#unless @first}} | {{/unless}}{{jsonPathPiece.pascalCase}}.ResponseApiException{{/each}} + {{else}} +{{#each errorWildcardStatusCodes}}{{#unless @first}} | {{/unless}}{{jsonPathPiece.pascalCase}}.ResponseApiException{{/each}} + {{/if}} + {{/or}} +{{/and}} From 76c3a89db9043d93aeeedffbf261b6778eb5d327 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 3 Apr 2024 13:09:12 -0700 Subject: [PATCH 44/53] Adjusts operation docs --- .../codegen/generators/DefaultGenerator.java | 4 ++-- .../generators/openapimodels/CodegenOperation.java | 4 ++-- .../paths/path/verb/_OperationDocExcCodeSample.hbs | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java index 839df655b73..6d5daca1765 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java @@ -2814,7 +2814,7 @@ public CodegenOperation fromOperation(Operation operation, String jsonPath, Link TreeMap nonDefaultResponses = null; TreeMap wildcardCodeResponses = null; TreeMap statusCodeResponses = null; - LinkedHashSet errorStatusCodes = null; + LinkedHashSet errorStatusCodes = null; LinkedHashSet errorWildcardStatusCodes = null; LinkedHashSet nonErrorStatusCodes = null; LinkedHashSet nonErrorWildcardStatusCodes = null; @@ -2873,7 +2873,7 @@ public CodegenOperation fromOperation(Operation operation, String jsonPath, Link if (errorStatusCodes == null) { errorStatusCodes = new LinkedHashSet<>(); } - errorStatusCodes.add(key); + errorStatusCodes.add(statusCode); } else { if (nonErrorStatusCodes == null) { nonErrorStatusCodes = new LinkedHashSet<>(); diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenOperation.java b/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenOperation.java index f725f38ae0a..a3510dd105b 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenOperation.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/openapimodels/CodegenOperation.java @@ -25,7 +25,7 @@ public class CodegenOperation { public final Boolean deprecated; public final LinkedHashSet nonErrorStatusCodes; // values like 201 public final LinkedHashSet nonErrorWildcardStatusCodes; // values like 2 for @2XX - public final LinkedHashSet errorStatusCodes; // values like 401 + public final LinkedHashSet errorStatusCodes; // values like 401 public final LinkedHashSet errorWildcardStatusCodes; // values like 4 for 4XX public final CodegenText summary, description; public final LinkedHashSet produces; @@ -57,7 +57,7 @@ public CodegenOperation( Boolean deprecated, LinkedHashSet nonErrorStatusCodes, LinkedHashSet nonErrorWildcardStatusCodes, - LinkedHashSet errorStatusCodes, + LinkedHashSet errorStatusCodes, LinkedHashSet errorWildcardStatusCodes, CodegenText summary, CodegenText description, diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs index 986cb34c60f..a7d5c3c8c9d 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs @@ -1,11 +1,11 @@ {{#and errorStatusCodes errorWildcardStatusCodes}} -{{#each errorStatusCodes}}{{jsonPathPiece.pascalCase}}.ResponseApiException | {{/each}}{{#each errorWildcardStatusCodes}}{{jsonPathPiece.pascalCase}}.ResponseApiException{{#unless @last}} | {{/unless}}{{/each}} -{{else}} +{{#each errorStatusCodes}}{{#with (lookup ../statusCodeResponses @key)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException | {{/each}}{{#each errorWildcardStatusCodes}}{{#with (lookup ../wildcardCodeResponses @key)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{#unless @last}} | {{/unless}}{{/each}} +{{~else}} {{#or errorStatusCodes errorWildcardStatusCodes}} {{#if errorStatusCodes}} -{{#each errorStatusCodes}}{{#unless @first}} | {{/unless}}{{jsonPathPiece.pascalCase}}.ResponseApiException{{/each}} - {{else}} -{{#each errorWildcardStatusCodes}}{{#unless @first}} | {{/unless}}{{jsonPathPiece.pascalCase}}.ResponseApiException{{/each}} - {{/if}} +{{#each errorStatusCodes}}{{#unless @first}} | {{/unless}}{{#with (lookup ../statusCodeResponses @key)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{/each}} + {{~else}} +{{#each errorWildcardStatusCodes}}{{#unless @first}} | {{/unless}}{{#with (lookup ../wildcardCodeResponses @key)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{/each}} + {{~/if}} {{/or}} {{/and}} From b5551d003faec15082945bc722f141e44f5e1777 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 3 Apr 2024 19:55:55 -0700 Subject: [PATCH 45/53] Adds exception catching for error response exceptions --- samples/client/petstore/java/docs/paths/fake/Get.md | 3 +-- samples/client/petstore/java/docs/paths/fake/Post.md | 3 +-- .../java/docs/paths/fakewildcardresponses/Get.md | 3 +-- samples/client/petstore/java/docs/paths/pet/Post.md | 3 +-- samples/client/petstore/java/docs/paths/pet/Put.md | 3 +-- .../petstore/java/docs/paths/petfindbystatus/Get.md | 3 +-- .../petstore/java/docs/paths/petfindbytags/Get.md | 3 +-- .../petstore/java/docs/paths/petpetid/Delete.md | 3 +-- .../client/petstore/java/docs/paths/petpetid/Get.md | 3 +-- .../client/petstore/java/docs/paths/petpetid/Post.md | 3 +-- .../petstore/java/docs/paths/storeorder/Post.md | 3 +-- .../java/docs/paths/storeorderorderid/Delete.md | 3 +-- .../java/docs/paths/storeorderorderid/Get.md | 3 +-- .../client/petstore/java/docs/paths/userlogin/Get.md | 3 +-- .../petstore/java/docs/paths/userusername/Delete.md | 3 +-- .../petstore/java/docs/paths/userusername/Get.md | 3 +-- .../petstore/java/docs/paths/userusername/Put.md | 3 +-- .../codegen/templating/handlebars/CustomHelpers.java | 12 ++++++++++++ .../paths/path/verb/_OperationDocExcCodeSample.hbs | 6 +++--- 19 files changed, 32 insertions(+), 37 deletions(-) diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index 9fd15f7a58b..708db47751a 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -70,8 +70,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (Get.ResponseApiException - e) { +} catch (Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index d098d920f36..f7fb2ffd9e4 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -79,8 +79,7 @@ var request = new PostRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.post(request); -} catch (Post.ResponseApiException - e) { +} catch (Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index e877fabb558..b1a9967c662 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -70,8 +70,7 @@ var request = new GetRequestBuilder().build(); try { Responses.EndpointResponse response = apiClient.get(request); -} catch (Get.ResponseApiException | Get.ResponseApiException - e) { +} catch (Code4XXResponse.ResponseApiException | Code5XXResponse.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index 3124d5c0a22..fc169f43eec 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -126,8 +126,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (Post.ResponseApiException - e) { +} catch (Code405Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index 8efade3d2ec..c0bade42eab 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -123,8 +123,7 @@ var request = new PutRequestBuilder() try { Void response = apiClient.put(request); -} catch (Put.ResponseApiException | Put.ResponseApiException | Put.ResponseApiException - e) { +} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException | Code405Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 11a1dc0ef07..14f6f1978b4 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -95,8 +95,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (Get.ResponseApiException - e) { +} catch (Code400Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index e98dadc280a..4c07df50efc 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -93,8 +93,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (Get.ResponseApiException - e) { +} catch (Code400Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index ee3dbb0f018..b3c6a9906a3 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -93,8 +93,7 @@ var request = new DeleteRequestBuilder() try { Void response = apiClient.delete(request); -} catch (Delete.ResponseApiException - e) { +} catch (Code400Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index 0b0a27834db..cfa9e998803 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -93,8 +93,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (Get.ResponseApiException | Get.ResponseApiException - e) { +} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index e0dda2bc8ef..2165f84948d 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -93,8 +93,7 @@ var request = new PostRequestBuilder() try { Void response = apiClient.post(request); -} catch (Post.ResponseApiException - e) { +} catch (Code405Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index 95e7da9f34c..e12f9782803 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -92,8 +92,7 @@ var request = new PostRequestBuilder() try { Responses.EndpointResponse response = apiClient.post(request); -} catch (Post.ResponseApiException - e) { +} catch (Code400Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index b1210cff13a..7c0dd2c980d 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -81,8 +81,7 @@ var request = new DeleteRequestBuilder() try { Void response = apiClient.delete(request); -} catch (Delete.ResponseApiException | Delete.ResponseApiException - e) { +} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index 0688cac7901..d845e02762c 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -82,8 +82,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (Get.ResponseApiException | Get.ResponseApiException - e) { +} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index 6de48f99e3a..2c6a906645d 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -84,8 +84,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (Get.ResponseApiException - e) { +} catch (Code400Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index f3642421b00..6284400646e 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -81,8 +81,7 @@ var request = new DeleteRequestBuilder() try { Responses.EndpointResponse response = apiClient.delete(request); -} catch (Delete.ResponseApiException - e) { +} catch (Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index 0c565f21ab8..2769673cc99 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -82,8 +82,7 @@ var request = new GetRequestBuilder() try { Responses.EndpointResponse response = apiClient.get(request); -} catch (Get.ResponseApiException | Get.ResponseApiException - e) { +} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index 9f64a43c191..31cbd3e5c15 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -112,8 +112,7 @@ var request = new PutRequestBuilder() try { Void response = apiClient.put(request); -} catch (Put.ResponseApiException | Put.ResponseApiException - e) { +} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; } catch (ApiException e) { diff --git a/src/main/java/org/openapijsonschematools/codegen/templating/handlebars/CustomHelpers.java b/src/main/java/org/openapijsonschematools/codegen/templating/handlebars/CustomHelpers.java index fc7aff6857b..4f601018217 100644 --- a/src/main/java/org/openapijsonschematools/codegen/templating/handlebars/CustomHelpers.java +++ b/src/main/java/org/openapijsonschematools/codegen/templating/handlebars/CustomHelpers.java @@ -47,6 +47,18 @@ public enum CustomHelpers implements Helper { } }, + mapLookup { + @Override public Object apply(final Object a, final Options options) throws IOException { + // lookup converts keys into strings even if they are not, so ue a custom helper instead + Object key = options.param(0, null); + if (!(a instanceof Map)) { + throw new IOException("invalid lookup first arg input"); + } + return ((Map) a).get(key); + } + }, + + /** * Makes an empty array of strings */ diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs index a7d5c3c8c9d..27e3a690131 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs @@ -1,11 +1,11 @@ {{#and errorStatusCodes errorWildcardStatusCodes}} -{{#each errorStatusCodes}}{{#with (lookup ../statusCodeResponses @key)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException | {{/each}}{{#each errorWildcardStatusCodes}}{{#with (lookup ../wildcardCodeResponses @key)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{#unless @last}} | {{/unless}}{{/each}} +{{#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 (lookup ../statusCodeResponses @key)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{/each}} +{{#each errorStatusCodes}}{{#unless @first}} | {{/unless}}{{#with (mapLookup ../statusCodeResponses .)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{/each}} {{~else}} -{{#each errorWildcardStatusCodes}}{{#unless @first}} | {{/unless}}{{#with (lookup ../wildcardCodeResponses @key)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{/each}} +{{#each errorWildcardStatusCodes}}{{#unless @first}} | {{/unless}}{{#with (mapLookup ../wildcardCodeResponses .)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{/each}} {{~/if}} {{/or}} {{/and}} From 14b4504bfb4cba1d65e2ba4dc39b30569b0d3c37 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 3 Apr 2024 20:42:03 -0700 Subject: [PATCH 46/53] Adds responses casting to operation docs --- .../java/docs/paths/anotherfakedummy/Patch.md | 4 ++- .../docs/paths/commonparamsubdir/Delete.md | 4 ++- .../java/docs/paths/commonparamsubdir/Get.md | 4 ++- .../java/docs/paths/commonparamsubdir/Post.md | 4 ++- .../petstore/java/docs/paths/fake/Delete.md | 4 ++- .../petstore/java/docs/paths/fake/Get.md | 4 ++- .../petstore/java/docs/paths/fake/Patch.md | 4 ++- .../petstore/java/docs/paths/fake/Post.md | 4 ++- .../Get.md | 4 ++- .../docs/paths/fakebodywithfileschema/Put.md | 4 ++- .../docs/paths/fakebodywithqueryparams/Put.md | 4 ++- .../docs/paths/fakecasesensitiveparams/Put.md | 4 ++- .../docs/paths/fakeclassnametest/Patch.md | 4 ++- .../docs/paths/fakedeletecoffeeid/Delete.md | 9 ++++++- .../java/docs/paths/fakehealth/Get.md | 4 ++- .../fakeinlineadditionalproperties/Post.md | 4 ++- .../docs/paths/fakeinlinecomposition/Post.md | 4 ++- .../java/docs/paths/fakejsonformdata/Get.md | 4 ++- .../java/docs/paths/fakejsonpatch/Patch.md | 4 ++- .../docs/paths/fakejsonwithcharset/Post.md | 4 ++- .../Post.md | 4 ++- .../paths/fakemultipleresponsebodies/Get.md | 9 ++++++- .../docs/paths/fakemultiplesecurities/Get.md | 4 ++- .../java/docs/paths/fakeobjinquery/Get.md | 4 ++- .../Post.md | 4 ++- .../java/docs/paths/fakepemcontenttype/Get.md | 4 ++- .../Post.md | 4 ++- .../fakequeryparamwithjsoncontenttype/Get.md | 4 ++- .../java/docs/paths/fakeredirection/Get.md | 9 ++++++- .../java/docs/paths/fakerefobjinquery/Get.md | 4 ++- .../docs/paths/fakerefsarraymodel/Post.md | 4 ++- .../docs/paths/fakerefsarrayofenums/Post.md | 4 ++- .../java/docs/paths/fakerefsboolean/Post.md | 4 ++- .../Post.md | 4 ++- .../java/docs/paths/fakerefsenum/Post.md | 4 ++- .../java/docs/paths/fakerefsmammal/Post.md | 4 ++- .../java/docs/paths/fakerefsnumber/Post.md | 4 ++- .../fakerefsobjectmodelwithrefprops/Post.md | 4 ++- .../java/docs/paths/fakerefsstring/Post.md | 4 ++- .../paths/fakeresponsewithoutschema/Get.md | 4 ++- .../docs/paths/faketestqueryparamters/Put.md | 4 ++- .../docs/paths/fakeuploaddownloadfile/Post.md | 4 ++- .../java/docs/paths/fakeuploadfile/Post.md | 4 ++- .../java/docs/paths/fakeuploadfiles/Post.md | 4 ++- .../docs/paths/fakewildcardresponses/Get.md | 13 +++++++++- .../petstore/java/docs/paths/foo/Get.md | 4 ++- .../petstore/java/docs/paths/pet/Post.md | 4 ++- .../petstore/java/docs/paths/pet/Put.md | 3 ++- .../java/docs/paths/petfindbystatus/Get.md | 4 ++- .../java/docs/paths/petfindbytags/Get.md | 4 ++- .../java/docs/paths/petpetid/Delete.md | 3 ++- .../petstore/java/docs/paths/petpetid/Get.md | 4 ++- .../petstore/java/docs/paths/petpetid/Post.md | 3 ++- .../docs/paths/petpetiduploadimage/Post.md | 4 ++- .../petstore/java/docs/paths/solidus/Get.md | 4 ++- .../java/docs/paths/storeinventory/Get.md | 4 ++- .../java/docs/paths/storeorder/Post.md | 4 ++- .../docs/paths/storeorderorderid/Delete.md | 3 ++- .../java/docs/paths/storeorderorderid/Get.md | 4 ++- .../petstore/java/docs/paths/user/Post.md | 4 ++- .../docs/paths/usercreatewitharray/Post.md | 4 ++- .../docs/paths/usercreatewithlist/Post.md | 4 ++- .../petstore/java/docs/paths/userlogin/Get.md | 4 ++- .../java/docs/paths/userlogout/Get.md | 4 ++- .../java/docs/paths/userusername/Delete.md | 4 ++- .../java/docs/paths/userusername/Get.md | 4 ++- .../java/docs/paths/userusername/Put.md | 3 ++- .../path/verb/_OperationDocCodeSample.hbs | 25 ++++++++++++++++++- 68 files changed, 244 insertions(+), 68 deletions(-) diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 2ab77481d6e..b48f32d4641 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -79,8 +79,9 @@ var request = new PatchRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.patch(request); + response = apiClient.patch(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -95,6 +96,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index 32bd2408a66..f766eb05a79 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -79,8 +79,9 @@ var request = new DeleteRequestBuilder() .pathParameters(pathParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.delete(request); + response = apiClient.delete(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -95,6 +96,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index b77882d8c9e..4cc89d8ffc0 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -79,8 +79,9 @@ var request = new GetRequestBuilder() .pathParameters(pathParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -95,6 +96,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md index 5387a8437ea..b30536aadd5 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Post.md @@ -79,8 +79,9 @@ var request = new PostRequestBuilder() .pathParameters(pathParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -95,6 +96,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Delete.md b/samples/client/petstore/java/docs/paths/fake/Delete.md index 37921c57f77..e19bf051094 100644 --- a/samples/client/petstore/java/docs/paths/fake/Delete.md +++ b/samples/client/petstore/java/docs/paths/fake/Delete.md @@ -111,8 +111,9 @@ var request = new DeleteRequestBuilder() .queryParameters(queryParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.delete(request); + response = apiClient.delete(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -127,6 +128,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index 708db47751a..eaaac40d53d 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -68,8 +68,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -87,6 +88,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index 458939a0730..59c5cc6f9df 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -79,8 +79,9 @@ var request = new PatchRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.patch(request); + response = apiClient.patch(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -95,6 +96,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Post.md b/samples/client/petstore/java/docs/paths/fake/Post.md index f7fb2ffd9e4..c2f25dbe7f3 100644 --- a/samples/client/petstore/java/docs/paths/fake/Post.md +++ b/samples/client/petstore/java/docs/paths/fake/Post.md @@ -77,8 +77,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -96,6 +97,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index ce6b9150bac..e5de5271bb1 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -65,8 +65,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index bed3ab68d6c..1418fafcf3f 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -81,8 +81,9 @@ var request = new PutRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.put(request); + response = apiClient.put(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -97,6 +98,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index adc5a93297c..5b044c5f4e7 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -109,8 +109,9 @@ var request = new PutRequestBuilder() .queryParameters(queryParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.put(request); + response = apiClient.put(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -125,6 +126,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index da32c83d498..866755c2812 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -82,8 +82,9 @@ var request = new PutRequestBuilder() .queryParameters(queryParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.put(request); + response = apiClient.put(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -98,6 +99,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index 08cbb4820e9..518210d5c05 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -90,8 +90,9 @@ var request = new PatchRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.patch(request); + response = apiClient.patch(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -106,6 +107,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index 978c522016c..1d8c015f617 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -79,8 +79,9 @@ var request = new DeleteRequestBuilder() .pathParameters(pathParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.delete(request); + response = apiClient.delete(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -95,6 +96,12 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +if (response instanceof Responses.EndpointCode200Response castResponse) { + // todo add handling for sealed body +} else { + Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; + // todo add handling for sealed body +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index b4f58458049..0456cde3b48 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -63,8 +63,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -79,6 +80,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md index c926858f6c2..f7b49550451 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlineadditionalproperties/Post.md @@ -79,8 +79,9 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -95,6 +96,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index fde0dfc7e6b..0663933dfde 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -66,8 +66,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -82,6 +83,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index a68a50c0d1a..1e911fb538b 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -65,8 +65,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index 939aedb7cee..a186afc0763 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -65,8 +65,9 @@ Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration) var request = new PatchRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.patch(request); + response = apiClient.patch(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index 974486b62ae..c32b8fc9704 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 3e95e603b8f..bbc6eee9612 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index 47976f2b7bd..9cd6463c224 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -64,8 +64,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -80,6 +81,12 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +if (response instanceof Responses.EndpointCode200Response castResponse) { + // todo add handling for sealed body +} else { + Responses.EndpointCode202Response castResponse = (Responses.EndpointCode202Response) response; + // todo add handling for sealed body +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index a48be35e4c2..ebba961f631 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -79,8 +79,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -95,6 +96,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index d7b3047c0c0..c54fe28b951 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -64,8 +64,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -80,6 +81,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index 57e353ae75d..570d7e20da2 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -90,8 +90,9 @@ var request = new PostRequestBuilder() .pathParameters(pathParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -106,6 +107,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index 7829f925171..a6fcfbb3076 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -65,8 +65,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index 3d50d95e2ef..8f910cab960 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -87,8 +87,9 @@ var request = new PostRequestBuilder() .pathParameters(pathParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -103,6 +104,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index 181e39ceb43..52e35d03fb2 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -76,8 +76,9 @@ var request = new GetRequestBuilder() .queryParameters(queryParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -92,6 +93,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index 60bb45ce843..057f83026e6 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -64,8 +64,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -80,6 +81,12 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +if (response instanceof Responses.EndpointCode3XXResponse castResponse) { + // todo add handling for sealed body +} else { + Responses.EndpointCode303Response castResponse = (Responses.EndpointCode303Response) response; + // todo add handling for sealed body +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md index afcadc2ef10..7b8c3d1a09e 100644 --- a/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakerefobjinquery/Get.md @@ -64,8 +64,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -80,6 +81,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index 08110becf17..cc1416a500b 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index c6baf8390e8..bfad239d8a7 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index 1a56ce83e57..c2e43ef0f9c 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index 9938956a174..00b3bb0bd42 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index 642df9c5346..8f7672ecbd8 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index d9c199a527e..127d01c16ea 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -70,8 +70,9 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -86,6 +87,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index af7697eb585..77c2b29aa89 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 376241e3121..c0a34b0cdd5 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 717a32e9bfb..897fdf5b9d1 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index e0c2dc6d4aa..71e144d57ba 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -63,8 +63,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -79,6 +80,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md index d4ba80e7a03..3a27ddf7502 100644 --- a/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md +++ b/samples/client/petstore/java/docs/paths/faketestqueryparamters/Put.md @@ -103,8 +103,9 @@ var request = new PutRequestBuilder() .queryParameters(queryParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.put(request); + response = apiClient.put(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -119,6 +120,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index 1aac880aec9..d89dc502acb 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -75,8 +75,9 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -91,6 +92,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index d867d2f460b..57ae0cbebe0 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index 98ce6e256aa..3eb41784601 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -65,8 +65,9 @@ Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); var request = new PostRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -81,6 +82,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index b1a9967c662..bea7c962d3f 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -68,8 +68,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (Code4XXResponse.ResponseApiException | Code5XXResponse.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -87,6 +88,16 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +if (response instanceof Responses.EndpointCode1XXResponse castResponse) { + // todo add handling for sealed body +} else if (response instanceof Responses.EndpointCode2XXResponse castResponse) { + // todo add handling for sealed body +} else if (response instanceof Responses.EndpointCode200Response castResponse) { + // todo add handling for sealed body +} else { + Responses.EndpointCode3XXResponse castResponse = (Responses.EndpointCode3XXResponse) response; + // todo add handling for sealed body +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index af3ca1290cf..bad1ae18602 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -61,8 +61,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -77,6 +78,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index fc169f43eec..f23d6c37030 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -124,8 +124,9 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (Code405Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -143,6 +144,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index c0bade42eab..26a031cc6ef 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -121,8 +121,9 @@ var request = new PutRequestBuilder() .requestBody(requestBody) .build(); +Void response; try { - Void response = apiClient.put(request); + response = apiClient.put(request); } catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException | Code405Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 14f6f1978b4..eb5a43374f4 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -93,8 +93,9 @@ var request = new GetRequestBuilder() .queryParameters(queryParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (Code400Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -112,6 +113,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index 4c07df50efc..ae878eed77c 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -91,8 +91,9 @@ var request = new GetRequestBuilder() .queryParameters(queryParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (Code400Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -110,6 +111,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index b3c6a9906a3..1f5d91cb3a3 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -91,8 +91,9 @@ var request = new DeleteRequestBuilder() .pathParameters(pathParameters) .build(); +Void response; try { - Void response = apiClient.delete(request); + response = apiClient.delete(request); } catch (Code400Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index cfa9e998803..6e1b13b68a9 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -91,8 +91,9 @@ var request = new GetRequestBuilder() .pathParameters(pathParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -110,6 +111,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index 2165f84948d..ae19e21515d 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -91,8 +91,9 @@ var request = new PostRequestBuilder() .pathParameters(pathParameters) .build(); +Void response; try { - Void response = apiClient.post(request); + response = apiClient.post(request); } catch (Code405Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index 6843773ba9b..cf9354b359b 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -88,8 +88,9 @@ var request = new PostRequestBuilder() .pathParameters(pathParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -104,6 +105,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index d20d4e9deeb..e98e2da79f5 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -63,8 +63,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -79,6 +80,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index c7bc08f522a..f0ff9209659 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -75,8 +75,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -91,6 +92,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index e12f9782803..fdd7bcf5455 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -90,8 +90,9 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (Code400Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -109,6 +110,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index 7c0dd2c980d..e84a5ca3713 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -79,8 +79,9 @@ var request = new DeleteRequestBuilder() .pathParameters(pathParameters) .build(); +Void response; try { - Void response = apiClient.delete(request); + response = apiClient.delete(request); } catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index d845e02762c..aa8ae20e6d9 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -80,8 +80,9 @@ var request = new GetRequestBuilder() .pathParameters(pathParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -99,6 +100,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/user/Post.md b/samples/client/petstore/java/docs/paths/user/Post.md index b638ab1935b..7758fa2ea5b 100644 --- a/samples/client/petstore/java/docs/paths/user/Post.md +++ b/samples/client/petstore/java/docs/paths/user/Post.md @@ -95,8 +95,9 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -111,6 +112,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index 3f81a58069d..4a59f7a599d 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -117,8 +117,9 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -133,6 +134,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index 755af77d9ca..1692dc67f66 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -117,8 +117,9 @@ var request = new PostRequestBuilder() .requestBody(requestBody) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.post(request); + response = apiClient.post(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -133,6 +134,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index 2c6a906645d..4c2e38b8c98 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -82,8 +82,9 @@ var request = new GetRequestBuilder() .queryParameters(queryParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (Code400Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -101,6 +102,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogout/Get.md b/samples/client/petstore/java/docs/paths/userlogout/Get.md index c740efa88f4..ec1c6bf2d35 100644 --- a/samples/client/petstore/java/docs/paths/userlogout/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogout/Get.md @@ -63,8 +63,9 @@ Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); var request = new GetRequestBuilder().build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (ApiException e) { // server returned a response/contentType not defined in the openapi document throw e; @@ -79,6 +80,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Delete.md b/samples/client/petstore/java/docs/paths/userusername/Delete.md index 6284400646e..dac43b70fae 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Delete.md +++ b/samples/client/petstore/java/docs/paths/userusername/Delete.md @@ -79,8 +79,9 @@ var request = new DeleteRequestBuilder() .pathParameters(pathParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.delete(request); + response = apiClient.delete(request); } catch (Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -98,6 +99,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index 2769673cc99..0e6a8ea90ca 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -80,8 +80,9 @@ var request = new GetRequestBuilder() .pathParameters(pathParameters) .build(); +Responses.EndpointResponse response; try { - Responses.EndpointResponse response = apiClient.get(request); + response = apiClient.get(request); } catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; @@ -99,6 +100,7 @@ try { // or the header content type deserialization has not yet been implemented for this contentType throw e; } +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Put.md b/samples/client/petstore/java/docs/paths/userusername/Put.md index 31cbd3e5c15..8f551a39d78 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Put.md +++ b/samples/client/petstore/java/docs/paths/userusername/Put.md @@ -110,8 +110,9 @@ var request = new PutRequestBuilder() .pathParameters(pathParameters) .build(); +Void response; try { - Void response = apiClient.put(request); + response = apiClient.put(request); } catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { // server returned an error response defined in the openapi document throw e; diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index f19ce5e7e65..4038250aeca 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -211,8 +211,9 @@ var request = new {{className.pascalCase}}() {{/each}} {{/eq}} +{{#if nonErrorResponses }}{{responses.jsonPathPiece.pascalCase}}.EndpointResponse{{else}}Void{{/if}} response; try { - {{#if nonErrorResponses }}{{responses.jsonPathPiece.pascalCase}}.EndpointResponse{{else}}Void{{/if}} response = apiClient.{{jsonPathPiece.camelCase}}(request); + response = apiClient.{{jsonPathPiece.camelCase}}(request); {{#or errorStatusCodes errorWildcardStatusCodes}} } catch ({{> src/main/java/packagename/paths/path/verb/_OperationDocExcCodeSample }} e) { // server returned an error response defined in the openapi document @@ -232,5 +233,27 @@ try { // 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; + {{/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}} + // todo add handling for sealed body + {{/each}} +} + {{/eq}} +{{/if}} {{/with}} ``` \ No newline at end of file From c04581d3b18b82b0ae15f3b3fbf7c028dc6fc458 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 4 Apr 2024 13:17:06 -0700 Subject: [PATCH 47/53] Adds response body if else to operation docs --- .../java/docs/paths/anotherfakedummy/Patch.md | 2 ++ .../petstore/java/docs/paths/fake/Patch.md | 2 ++ .../Get.md | 2 ++ .../docs/paths/fakeclassnametest/Patch.md | 2 ++ .../docs/paths/fakedeletecoffeeid/Delete.md | 2 -- .../java/docs/paths/fakehealth/Get.md | 2 ++ .../docs/paths/fakeinlinecomposition/Post.md | 6 ++++++ .../docs/paths/fakejsonwithcharset/Post.md | 2 ++ .../Post.md | 2 ++ .../paths/fakemultipleresponsebodies/Get.md | 6 ++++-- .../docs/paths/fakemultiplesecurities/Get.md | 2 ++ .../Post.md | 2 ++ .../java/docs/paths/fakepemcontenttype/Get.md | 2 ++ .../Post.md | 2 ++ .../fakequeryparamwithjsoncontenttype/Get.md | 2 ++ .../java/docs/paths/fakeredirection/Get.md | 2 -- .../docs/paths/fakerefsarraymodel/Post.md | 2 ++ .../docs/paths/fakerefsarrayofenums/Post.md | 2 ++ .../java/docs/paths/fakerefsboolean/Post.md | 2 ++ .../Post.md | 2 ++ .../java/docs/paths/fakerefsenum/Post.md | 2 ++ .../java/docs/paths/fakerefsmammal/Post.md | 2 ++ .../java/docs/paths/fakerefsnumber/Post.md | 2 ++ .../fakerefsobjectmodelwithrefprops/Post.md | 2 ++ .../java/docs/paths/fakerefsstring/Post.md | 2 ++ .../docs/paths/fakeuploaddownloadfile/Post.md | 2 ++ .../java/docs/paths/fakeuploadfile/Post.md | 2 ++ .../java/docs/paths/fakeuploadfiles/Post.md | 2 ++ .../docs/paths/fakewildcardresponses/Get.md | 12 +++++++---- .../petstore/java/docs/paths/foo/Get.md | 2 ++ .../java/docs/paths/petfindbystatus/Get.md | 1 + .../java/docs/paths/petfindbytags/Get.md | 1 + .../petstore/java/docs/paths/petpetid/Get.md | 6 ++++++ .../docs/paths/petpetiduploadimage/Post.md | 1 + .../java/docs/paths/storeinventory/Get.md | 1 + .../java/docs/paths/storeorder/Post.md | 6 ++++++ .../java/docs/paths/storeorderorderid/Get.md | 6 ++++++ .../petstore/java/docs/paths/userlogin/Get.md | 6 ++++++ .../java/docs/paths/userusername/Get.md | 6 ++++++ .../path/verb/_OperationDocCodeSample.hbs | 7 ++++++- .../verb/_OperationDocResBodyCodeSample.hbs | 21 +++++++++++++++++++ 41 files changed, 129 insertions(+), 11 deletions(-) create mode 100644 src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocResBodyCodeSample.hbs diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index b48f32d4641..8ce9988a2f5 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -97,6 +97,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/Patch.md b/samples/client/petstore/java/docs/paths/fake/Patch.md index 59c5cc6f9df..846bd4a6b2c 100644 --- a/samples/client/petstore/java/docs/paths/fake/Patch.md +++ b/samples/client/petstore/java/docs/paths/fake/Patch.md @@ -97,6 +97,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index e5de5271bb1..e1599769a32 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md index 518210d5c05..a6452a89049 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/Patch.md @@ -108,6 +108,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index 1d8c015f617..3a5bdb7bc60 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -97,10 +97,8 @@ try { throw e; } if (response instanceof Responses.EndpointCode200Response castResponse) { - // todo add handling for sealed body } else { Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; - // todo add handling for sealed body } ``` ### Constructor Summary diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index 0456cde3b48..32d3de4ba5c 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -81,6 +81,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 0663933dfde..6f01f31fd31 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -84,6 +84,12 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +if (castResponse.body instanceof Code200Response.ApplicationjsonResponseBody deserializedBody) { + // handle deserialized body here +} else { + Code200Response.MultipartformdataResponseBody deserializedBody = (Code200Response.MultipartformdataResponseBody) castResponse.body; + // handle deserialized body here +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index c32b8fc9704..c600ed01aee 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.Applicationjsoncharsetutf8ResponseBody deserializedBody = (Code200Response.Applicationjsoncharsetutf8ResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index bbc6eee9612..0c5ce872d6c 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index 9cd6463c224..2b87ae47a1c 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -82,10 +82,12 @@ try { throw e; } if (response instanceof Responses.EndpointCode200Response castResponse) { - // todo add handling for sealed body +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here } else { Responses.EndpointCode202Response castResponse = (Responses.EndpointCode202Response) response; - // todo add handling for sealed body +Code202Response.ApplicationjsonResponseBody deserializedBody = (Code202Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here } ``` ### Constructor Summary diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md index ebba961f631..4109176530a 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/Get.md @@ -97,6 +97,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md index 570d7e20da2..1db9e1228a5 100644 --- a/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeparametercollisions1ababselfab/Post.md @@ -108,6 +108,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index a6fcfbb3076..77a14552f9d 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationxpemfileResponseBody deserializedBody = (Code200Response.ApplicationxpemfileResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index 8f910cab960..a9346a188ed 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -105,6 +105,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index 52e35d03fb2..a1734c23862 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -94,6 +94,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md index 057f83026e6..01756bfff4a 100644 --- a/samples/client/petstore/java/docs/paths/fakeredirection/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeredirection/Get.md @@ -82,10 +82,8 @@ try { throw e; } if (response instanceof Responses.EndpointCode3XXResponse castResponse) { - // todo add handling for sealed body } else { Responses.EndpointCode303Response castResponse = (Responses.EndpointCode303Response) response; - // todo add handling for sealed body } ``` ### Constructor Summary diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md index cc1416a500b..f2b86fd0629 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index bfad239d8a7..05581875a20 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index c2e43ef0f9c..d2eb60a0c7a 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index 00b3bb0bd42..5e1b8b12e96 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index 8f7672ecbd8..77f32d0c789 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index 127d01c16ea..cdcf9614119 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -88,6 +88,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index 77c2b29aa89..076da420c03 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index c0a34b0cdd5..4b07291c56b 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 897fdf5b9d1..5ef61bea0e5 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md index d89dc502acb..6d8880074b4 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploaddownloadfile/Post.md @@ -93,6 +93,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationoctetstreamResponseBody deserializedBody = (Code200Response.ApplicationoctetstreamResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index 57ae0cbebe0..7501fc1831a 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index 3eb41784601..e3775d87065 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -83,6 +83,8 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index bea7c962d3f..15119587928 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -89,14 +89,18 @@ try { throw e; } if (response instanceof Responses.EndpointCode1XXResponse castResponse) { - // todo add handling for sealed body +Code1XXResponse.ApplicationjsonResponseBody deserializedBody = (Code1XXResponse.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here } else if (response instanceof Responses.EndpointCode2XXResponse castResponse) { - // todo add handling for sealed body +Code2XXResponse.ApplicationjsonResponseBody deserializedBody = (Code2XXResponse.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here } else if (response instanceof Responses.EndpointCode200Response castResponse) { - // todo add handling for sealed body +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here } else { Responses.EndpointCode3XXResponse castResponse = (Responses.EndpointCode3XXResponse) response; - // todo add handling for sealed body +Code3XXResponse.ApplicationjsonResponseBody deserializedBody = (Code3XXResponse.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here } ``` ### Constructor Summary diff --git a/samples/client/petstore/java/docs/paths/foo/Get.md b/samples/client/petstore/java/docs/paths/foo/Get.md index bad1ae18602..3b3249d5662 100644 --- a/samples/client/petstore/java/docs/paths/foo/Get.md +++ b/samples/client/petstore/java/docs/paths/foo/Get.md @@ -79,6 +79,8 @@ try { throw e; } Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; +CodedefaultResponse.ApplicationjsonResponseBody deserializedBody = (CodedefaultResponse.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index eb5a43374f4..3c051b1b538 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -114,6 +114,7 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index ae878eed77c..685df8f5a4b 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -112,6 +112,7 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index 6e1b13b68a9..7716f7374fc 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -112,6 +112,12 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +if (castResponse.body instanceof Code200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index cf9354b359b..b2cb8065834 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -106,6 +106,7 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/Get.md b/samples/client/petstore/java/docs/paths/storeinventory/Get.md index f0ff9209659..c5bdf7b4831 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/Get.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/Get.md @@ -93,6 +93,7 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index fdd7bcf5455..e8b7295b563 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -111,6 +111,12 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +if (castResponse.body instanceof Code200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index aa8ae20e6d9..21415665295 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -101,6 +101,12 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +if (castResponse.body instanceof Code200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index 4c2e38b8c98..e7361ffeef9 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -103,6 +103,12 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +if (castResponse.body instanceof Code200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} ``` ### Constructor Summary | Constructor and Description | diff --git a/samples/client/petstore/java/docs/paths/userusername/Get.md b/samples/client/petstore/java/docs/paths/userusername/Get.md index 0e6a8ea90ca..e2dc2eeb1c6 100644 --- a/samples/client/petstore/java/docs/paths/userusername/Get.md +++ b/samples/client/petstore/java/docs/paths/userusername/Get.md @@ -101,6 +101,12 @@ try { throw e; } Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +if (castResponse.body instanceof Code200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} ``` ### Constructor Summary | Constructor and Description | diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index 4038250aeca..9a712b2b7b9 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -237,6 +237,9 @@ try { {{#eq nonErrorResponses.size 1}} {{#each nonErrorResponses}} {{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}} castResponse = ({{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}}) response; + {{#if hasContentSchema}} +{{> src/main/java/packagename/paths/path/verb/_OperationDocResBodyCodeSample }} + {{/if}} {{/each}} {{else}} {{#each nonErrorResponses}} @@ -250,7 +253,9 @@ if (response instanceof {{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPat } else if (response instanceof {{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}} castResponse) { {{/if}} {{/if}} - // todo add handling for sealed body + {{#if hasContentSchema}} +{{> src/main/java/packagename/paths/path/verb/_OperationDocResBodyCodeSample }} + {{/if}} {{/each}} } {{/eq}} diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocResBodyCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocResBodyCodeSample.hbs new file mode 100644 index 00000000000..89c6499989c --- /dev/null +++ b/src/main/resources/java/src/main/java/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}} From 7533ca3c9bd3872e5409780d9e3e69b2da08454e Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 4 Apr 2024 13:35:20 -0700 Subject: [PATCH 48/53] Samples and docs regen --- docs/generators/java.md | 2 +- .../java/.openapi-generator/FILES | 2 - .../java/docs/RootServerInfo.md | 23 - .../client/RootServerInfo.java | 60 ++- ...rtiesAllowsASchemaWhichShouldValidate.java | 12 +- ...ditionalpropertiesAreAllowedByDefault.java | 28 +- .../AdditionalpropertiesCanExistByItself.java | 14 +- ...lpropertiesShouldNotLookInApplicators.java | 60 +-- .../client/components/schemas/Allof.java | 86 +-- .../schemas/AllofCombinedWithAnyofOneof.java | 104 ++-- .../components/schemas/AllofSimpleTypes.java | 78 +-- .../schemas/AllofWithBaseSchema.java | 90 ++-- .../schemas/AllofWithOneEmptySchema.java | 26 +- .../schemas/AllofWithTheFirstEmptySchema.java | 26 +- .../schemas/AllofWithTheLastEmptySchema.java | 26 +- .../schemas/AllofWithTwoEmptySchemas.java | 26 +- .../client/components/schemas/Anyof.java | 52 +- .../components/schemas/AnyofComplexTypes.java | 86 +-- .../schemas/AnyofWithBaseSchema.java | 58 +-- .../schemas/AnyofWithOneEmptySchema.java | 26 +- .../schemas/ArrayTypeMatchesArrays.java | 10 +- .../client/components/schemas/ByInt.java | 26 +- .../client/components/schemas/ByNumber.java | 26 +- .../components/schemas/BySmallNumber.java | 26 +- .../components/schemas/DateTimeFormat.java | 26 +- .../components/schemas/EmailFormat.java | 26 +- .../schemas/EnumWith0DoesNotMatchFalse.java | 22 +- .../schemas/EnumWith1DoesNotMatchTrue.java | 22 +- .../schemas/EnumWithEscapedCharacters.java | 8 +- .../schemas/EnumWithFalseDoesNotMatch0.java | 8 +- .../schemas/EnumWithTrueDoesNotMatch1.java | 8 +- .../components/schemas/EnumsInProperties.java | 30 +- .../components/schemas/ForbiddenProperty.java | 28 +- .../components/schemas/HostnameFormat.java | 26 +- ...ouldNotRaiseErrorWhenFloatDivisionInf.java | 14 +- .../schemas/InvalidStringValueForDefault.java | 38 +- .../client/components/schemas/Ipv4Format.java | 26 +- .../client/components/schemas/Ipv6Format.java | 26 +- .../components/schemas/JsonPointerFormat.java | 26 +- .../components/schemas/MaximumValidation.java | 26 +- .../MaximumValidationWithUnsignedInteger.java | 26 +- .../schemas/MaxitemsValidation.java | 26 +- .../schemas/MaxlengthValidation.java | 26 +- .../Maxproperties0MeansTheObjectIsEmpty.java | 26 +- .../schemas/MaxpropertiesValidation.java | 26 +- .../components/schemas/MinimumValidation.java | 26 +- .../MinimumValidationWithSignedInteger.java | 26 +- .../schemas/MinitemsValidation.java | 26 +- .../schemas/MinlengthValidation.java | 26 +- .../schemas/MinpropertiesValidation.java | 26 +- ...NestedAllofToCheckValidationSemantics.java | 52 +- ...NestedAnyofToCheckValidationSemantics.java | 52 +- .../components/schemas/NestedItems.java | 48 +- ...NestedOneofToCheckValidationSemantics.java | 52 +- .../client/components/schemas/Not.java | 26 +- .../schemas/NotMoreComplexSchema.java | 38 +- .../schemas/NulCharactersInStrings.java | 8 +- .../schemas/ObjectPropertiesValidation.java | 32 +- .../client/components/schemas/Oneof.java | 52 +- .../components/schemas/OneofComplexTypes.java | 86 +-- .../schemas/OneofWithBaseSchema.java | 58 +-- .../schemas/OneofWithEmptySchema.java | 26 +- .../components/schemas/OneofWithRequired.java | 88 ++-- .../schemas/PatternIsNotAnchored.java | 26 +- .../components/schemas/PatternValidation.java | 26 +- .../PropertiesWithEscapedCharacters.java | 28 +- .../PropertyNamedRefThatIsNotAReference.java | 28 +- .../schemas/RefInAdditionalproperties.java | 12 +- .../client/components/schemas/RefInAllof.java | 26 +- .../client/components/schemas/RefInAnyof.java | 26 +- .../client/components/schemas/RefInItems.java | 12 +- .../client/components/schemas/RefInNot.java | 26 +- .../client/components/schemas/RefInOneof.java | 26 +- .../components/schemas/RefInProperty.java | 30 +- .../schemas/RequiredDefaultValidation.java | 28 +- .../schemas/RequiredValidation.java | 34 +- .../schemas/RequiredWithEmptyArray.java | 28 +- .../RequiredWithEscapedCharacters.java | 28 +- .../schemas/SimpleEnumValidation.java | 22 +- ...esNotDoAnythingIfThePropertyIsMissing.java | 26 +- .../schemas/UniqueitemsFalseValidation.java | 26 +- .../schemas/UniqueitemsValidation.java | 26 +- .../client/components/schemas/UriFormat.java | 26 +- .../schemas/UriReferenceFormat.java | 26 +- .../components/schemas/UriTemplateFormat.java | 26 +- .../configurations/ApiConfiguration.java | 35 +- .../client/exceptions/BaseException.java | 2 +- .../client/header/ContentHeader.java | 11 +- .../client/header/Header.java | 7 +- .../client/header/Rfc6570Serializer.java | 57 +- .../client/header/SchemaHeader.java | 17 +- .../client/header/StyleSerializer.java | 13 +- .../client/parameter/ContentParameter.java | 8 +- .../client/parameter/CookieSerializer.java | 4 +- .../client/parameter/HeadersSerializer.java | 4 +- .../client/parameter/Parameter.java | 4 +- .../client/parameter/PathSerializer.java | 4 +- .../client/parameter/QuerySerializer.java | 4 +- .../client/parameter/SchemaParameter.java | 5 +- .../requestbody/RequestBodySerializer.java | 7 +- .../client/response/HeadersDeserializer.java | 5 +- .../client/response/ResponseDeserializer.java | 25 +- .../response/ResponsesDeserializer.java | 7 +- .../client/schemas/AnyTypeJsonSchema.java | 22 +- .../client/schemas/BooleanJsonSchema.java | 2 +- .../client/schemas/DateJsonSchema.java | 4 +- .../client/schemas/DateTimeJsonSchema.java | 4 +- .../client/schemas/DecimalJsonSchema.java | 2 +- .../client/schemas/DoubleJsonSchema.java | 4 +- .../client/schemas/FloatJsonSchema.java | 4 +- .../client/schemas/Int32JsonSchema.java | 6 +- .../client/schemas/Int64JsonSchema.java | 10 +- .../client/schemas/IntJsonSchema.java | 10 +- .../client/schemas/ListJsonSchema.java | 4 +- .../client/schemas/MapJsonSchema.java | 6 +- .../client/schemas/NotAnyTypeJsonSchema.java | 22 +- .../client/schemas/NullJsonSchema.java | 2 +- .../client/schemas/NumberJsonSchema.java | 10 +- .../client/schemas/StringJsonSchema.java | 8 +- .../client/schemas/UuidJsonSchema.java | 4 +- .../AdditionalPropertiesValidator.java | 4 +- .../schemas/validation/AllOfValidator.java | 4 +- .../schemas/validation/AnyOfValidator.java | 2 +- .../validation/BigDecimalValidator.java | 2 +- .../schemas/validation/ConstValidator.java | 2 +- .../schemas/validation/ContainsValidator.java | 2 +- .../validation/DefaultValueMethod.java | 4 +- .../DependentRequiredValidator.java | 2 +- .../validation/DependentSchemasValidator.java | 3 +- .../schemas/validation/ElseValidator.java | 2 +- .../schemas/validation/EnumValidator.java | 2 +- .../validation/ExclusiveMaximumValidator.java | 2 +- .../validation/ExclusiveMinimumValidator.java | 2 +- .../schemas/validation/FormatValidator.java | 6 +- .../schemas/validation/IfValidator.java | 2 +- .../schemas/validation/ItemsValidator.java | 3 +- .../client/schemas/validation/JsonSchema.java | 16 +- .../validation/ListSchemaValidator.java | 2 +- .../validation/MapSchemaValidator.java | 2 +- .../validation/MaxContainsValidator.java | 2 +- .../schemas/validation/MaxItemsValidator.java | 2 +- .../validation/MaxLengthValidator.java | 2 +- .../validation/MaxPropertiesValidator.java | 2 +- .../schemas/validation/MaximumValidator.java | 2 +- .../validation/MinContainsValidator.java | 2 +- .../schemas/validation/MinItemsValidator.java | 2 +- .../validation/MinLengthValidator.java | 2 +- .../validation/MinPropertiesValidator.java | 2 +- .../schemas/validation/MinimumValidator.java | 2 +- .../validation/MultipleOfValidator.java | 2 +- .../schemas/validation/NotValidator.java | 2 +- .../validation/NullSchemaValidator.java | 3 + .../schemas/validation/OneOfValidator.java | 2 +- .../schemas/validation/PatternValidator.java | 2 +- .../validation/PrefixItemsValidator.java | 3 +- .../validation/PropertiesValidator.java | 3 +- .../validation/PropertyNamesValidator.java | 3 +- .../schemas/validation/RequiredValidator.java | 4 +- .../schemas/validation/ThenValidator.java | 3 +- .../schemas/validation/TypeValidator.java | 4 +- .../validation/UnevaluatedItemsValidator.java | 3 +- .../UnevaluatedPropertiesValidator.java | 6 +- .../validation/UniqueItemsValidator.java | 4 +- .../validation/UnsetAnyTypeJsonSchema.java | 22 +- .../client/servers/ServerProvider.java | 4 +- ...sAllowsASchemaWhichShouldValidateTest.java | 4 +- ...onalpropertiesAreAllowedByDefaultTest.java | 2 +- ...itionalpropertiesCanExistByItselfTest.java | 2 +- ...pertiesShouldNotLookInApplicatorsTest.java | 2 +- .../AllofCombinedWithAnyofOneofTest.java | 2 +- .../schemas/AllofSimpleTypesTest.java | 2 +- .../client/components/schemas/AllofTest.java | 2 +- .../schemas/AllofWithBaseSchemaTest.java | 2 +- .../schemas/AllofWithOneEmptySchemaTest.java | 2 +- .../AllofWithTheFirstEmptySchemaTest.java | 2 +- .../AllofWithTheLastEmptySchemaTest.java | 2 +- .../schemas/AllofWithTwoEmptySchemasTest.java | 2 +- .../schemas/AnyofComplexTypesTest.java | 6 +- .../client/components/schemas/AnyofTest.java | 6 +- .../schemas/AnyofWithBaseSchemaTest.java | 2 +- .../schemas/AnyofWithOneEmptySchemaTest.java | 4 +- .../schemas/ArrayTypeMatchesArraysTest.java | 2 +- .../BooleanTypeMatchesBooleansTest.java | 4 +- .../client/components/schemas/ByIntTest.java | 4 +- .../components/schemas/ByNumberTest.java | 4 +- .../components/schemas/BySmallNumberTest.java | 2 +- .../schemas/DateTimeFormatTest.java | 12 +- .../components/schemas/EmailFormatTest.java | 12 +- .../EnumWith0DoesNotMatchFalseTest.java | 4 +- .../EnumWith1DoesNotMatchTrueTest.java | 4 +- .../EnumWithEscapedCharactersTest.java | 4 +- .../EnumWithFalseDoesNotMatch0Test.java | 2 +- .../EnumWithTrueDoesNotMatch1Test.java | 2 +- .../schemas/EnumsInPropertiesTest.java | 4 +- .../schemas/ForbiddenPropertyTest.java | 2 +- .../schemas/HostnameFormatTest.java | 12 +- .../IntegerTypeMatchesIntegersTest.java | 4 +- ...NotRaiseErrorWhenFloatDivisionInfTest.java | 2 +- .../InvalidStringValueForDefaultTest.java | 4 +- .../components/schemas/Ipv4FormatTest.java | 12 +- .../components/schemas/Ipv6FormatTest.java | 12 +- .../schemas/JsonPointerFormatTest.java | 12 +- .../schemas/MaximumValidationTest.java | 6 +- ...imumValidationWithUnsignedIntegerTest.java | 6 +- .../schemas/MaxitemsValidationTest.java | 6 +- .../schemas/MaxlengthValidationTest.java | 8 +- ...xproperties0MeansTheObjectIsEmptyTest.java | 2 +- .../schemas/MaxpropertiesValidationTest.java | 10 +- .../schemas/MinimumValidationTest.java | 6 +- ...inimumValidationWithSignedIntegerTest.java | 10 +- .../schemas/MinitemsValidationTest.java | 6 +- .../schemas/MinlengthValidationTest.java | 6 +- .../schemas/MinpropertiesValidationTest.java | 10 +- ...edAllofToCheckValidationSemanticsTest.java | 2 +- ...edAnyofToCheckValidationSemanticsTest.java | 2 +- .../components/schemas/NestedItemsTest.java | 2 +- ...edOneofToCheckValidationSemanticsTest.java | 2 +- .../schemas/NotMoreComplexSchemaTest.java | 4 +- .../client/components/schemas/NotTest.java | 2 +- .../schemas/NulCharactersInStringsTest.java | 2 +- .../NullTypeMatchesOnlyTheNullObjectTest.java | 2 +- .../schemas/NumberTypeMatchesNumbersTest.java | 6 +- .../ObjectPropertiesValidationTest.java | 8 +- .../schemas/ObjectTypeMatchesObjectsTest.java | 2 +- .../schemas/OneofComplexTypesTest.java | 4 +- .../client/components/schemas/OneofTest.java | 4 +- .../schemas/OneofWithBaseSchemaTest.java | 2 +- .../schemas/OneofWithEmptySchemaTest.java | 2 +- .../schemas/OneofWithRequiredTest.java | 4 +- .../schemas/PatternIsNotAnchoredTest.java | 2 +- .../schemas/PatternValidationTest.java | 14 +- .../PropertiesWithEscapedCharactersTest.java | 2 +- ...opertyNamedRefThatIsNotAReferenceTest.java | 2 +- .../RefInAdditionalpropertiesTest.java | 2 +- .../components/schemas/RefInAllofTest.java | 2 +- .../components/schemas/RefInAnyofTest.java | 2 +- .../components/schemas/RefInItemsTest.java | 2 +- .../components/schemas/RefInNotTest.java | 2 +- .../components/schemas/RefInOneofTest.java | 2 +- .../components/schemas/RefInPropertyTest.java | 2 +- .../RequiredDefaultValidationTest.java | 2 +- .../schemas/RequiredValidationTest.java | 8 +- .../schemas/RequiredWithEmptyArrayTest.java | 2 +- .../RequiredWithEscapedCharactersTest.java | 2 +- .../schemas/SimpleEnumValidationTest.java | 2 +- .../schemas/StringTypeMatchesStringsTest.java | 6 +- ...tDoAnythingIfThePropertyIsMissingTest.java | 4 +- .../UniqueitemsFalseValidationTest.java | 30 +- .../schemas/UniqueitemsValidationTest.java | 30 +- .../components/schemas/UriFormatTest.java | 12 +- .../schemas/UriReferenceFormatTest.java | 12 +- .../schemas/UriTemplateFormatTest.java | 12 +- .../client/header/ContentHeaderTest.java | 5 +- .../client/header/SchemaHeaderTest.java | 8 +- .../parameter/CookieSerializerTest.java | 4 +- .../parameter/HeadersSerializerTest.java | 4 +- .../client/parameter/PathSerializerTest.java | 4 +- .../client/parameter/QuerySerializerTest.java | 4 +- .../SchemaNonQueryParameterTest.java | 17 +- .../parameter/SchemaQueryParameterTest.java | 9 +- .../RequestBodySerializerTest.java | 9 +- .../response/ResponseDeserializerTest.java | 18 +- .../client/schemas/AnyTypeSchemaTest.java | 24 +- .../client/schemas/ArrayTypeSchemaTest.java | 18 +- .../client/schemas/BooleanSchemaTest.java | 8 +- .../client/schemas/ListSchemaTest.java | 5 +- .../client/schemas/MapSchemaTest.java | 5 +- .../client/schemas/NullSchemaTest.java | 6 +- .../client/schemas/NumberSchemaTest.java | 11 +- .../client/schemas/ObjectTypeSchemaTest.java | 38 +- .../client/schemas/RefBooleanSchemaTest.java | 8 +- .../AdditionalPropertiesValidatorTest.java | 7 +- .../validation/FormatValidatorTest.java | 28 +- .../validation/ItemsValidatorTest.java | 6 +- .../schemas/validation/JsonSchemaTest.java | 4 +- .../validation/PropertiesValidatorTest.java | 6 +- .../validation/RequiredValidatorTest.java | 6 +- .../schemas/validation/TypeValidatorTest.java | 2 +- .../java/.openapi-generator/FILES | 143 +++++ .../ContainsWithNullInstanceElementsTest.java | 2 +- ...ateditemsWithNullInstanceElementsTest.java | 2 +- .../petstore/java/.openapi-generator/FILES | 10 +- .../petstore/java/docs/RootServerInfo.md | 25 - .../headers/Int32JsonContentTypeHeader.md | 2 +- .../headers/RefContentSchemaHeader.md | 2 +- .../ComponentRefSchemaStringWithValidation.md | 2 +- .../components/requestbodies/RefUserArray.md | 2 +- .../java/docs/paths/anotherfakedummy/Patch.md | 80 +-- .../anotherfakedummy/patch/RequestBody.md | 4 +- .../docs/paths/commonparamsubdir/Delete.md | 78 +-- .../java/docs/paths/commonparamsubdir/Get.md | 78 +-- .../java/docs/paths/commonparamsubdir/Post.md | 78 +-- .../petstore/java/docs/paths/fake/Delete.md | 108 +--- .../petstore/java/docs/paths/fake/Get.md | 72 +-- .../petstore/java/docs/paths/fake/Patch.md | 80 +-- .../petstore/java/docs/paths/fake/Post.md | 81 +-- .../fake/delete/FakeDeleteSecurityInfo.md | 4 +- .../FakeDeleteSecurityRequirementObject0.md | 2 +- .../java/docs/paths/fake/get/RequestBody.md | 10 +- .../java/docs/paths/fake/patch/RequestBody.md | 4 +- .../paths/fake/post/FakePostSecurityInfo.md | 4 +- .../java/docs/paths/fake/post/RequestBody.md | 10 +- .../FakePostSecurityRequirementObject0.md | 2 +- .../Get.md | 68 +-- .../get/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/fakebodywithfileschema/Put.md | 80 +-- .../fakebodywithfileschema/put/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/fakebodywithqueryparams/Put.md | 106 +--- .../put/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/fakecasesensitiveparams/Put.md | 81 +-- .../docs/paths/fakeclassnametest/Patch.md | 91 +--- .../FakeclassnametestPatchSecurityInfo.md | 4 +- .../fakeclassnametest/patch/RequestBody.md | 4 +- ...nametestPatchSecurityRequirementObject0.md | 2 +- .../docs/paths/fakedeletecoffeeid/Delete.md | 81 +-- .../java/docs/paths/fakehealth/Get.md | 66 +-- .../fakeinlineadditionalproperties/Post.md | 78 +-- .../post/RequestBody.md | 10 +- .../docs/paths/fakeinlinecomposition/Post.md | 73 +-- .../fakeinlinecomposition/post/RequestBody.md | 20 +- .../java/docs/paths/fakejsonformdata/Get.md | 66 +-- .../paths/fakejsonformdata/get/RequestBody.md | 10 +- .../java/docs/paths/fakejsonpatch/Patch.md | 66 +-- .../paths/fakejsonpatch/patch/RequestBody.md | 10 +- .../ApplicationjsonpatchjsonSchema.md | 4 +- .../docs/paths/fakejsonwithcharset/Post.md | 68 +-- .../fakejsonwithcharset/post/RequestBody.md | 4 +- .../Post.md | 68 +-- .../post/RequestBody.md | 20 +- .../paths/fakemultipleresponsebodies/Get.md | 72 +-- .../docs/paths/fakemultiplesecurities/Get.md | 82 +-- .../FakemultiplesecuritiesGetSecurityInfo.md | 6 +- ...securitiesGetSecurityRequirementObject1.md | 2 +- ...securitiesGetSecurityRequirementObject2.md | 2 +- .../java/docs/paths/fakeobjinquery/Get.md | 65 +-- .../Post.md | 91 +--- .../post/RequestBody.md | 4 +- .../java/docs/paths/fakepemcontenttype/Get.md | 68 +-- .../fakepemcontenttype/get/RequestBody.md | 4 +- .../Post.md | 88 +--- ...adimagewithrequiredfilePostSecurityInfo.md | 4 +- .../post/RequestBody.md | 10 +- ...uiredfilePostSecurityRequirementObject0.md | 2 +- .../fakequeryparamwithjsoncontenttype/Get.md | 77 +-- .../java/docs/paths/fakeredirection/Get.md | 68 +-- .../java/docs/paths/fakerefobjinquery/Get.md | 65 +-- .../docs/paths/fakerefsarraymodel/Post.md | 68 +-- .../fakerefsarraymodel/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/fakerefsarrayofenums/Post.md | 68 +-- .../fakerefsarrayofenums/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../java/docs/paths/fakerefsboolean/Post.md | 68 +-- .../paths/fakerefsboolean/post/RequestBody.md | 4 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../Post.md | 68 +-- .../post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../java/docs/paths/fakerefsenum/Post.md | 68 +-- .../paths/fakerefsenum/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../java/docs/paths/fakerefsmammal/Post.md | 71 +-- .../paths/fakerefsmammal/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../java/docs/paths/fakerefsnumber/Post.md | 68 +-- .../paths/fakerefsnumber/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../fakerefsobjectmodelwithrefprops/Post.md | 68 +-- .../post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../java/docs/paths/fakerefsstring/Post.md | 68 +-- .../paths/fakerefsstring/post/RequestBody.md | 4 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../paths/fakeresponsewithoutschema/Get.md | 64 +-- .../docs/paths/faketestqueryparamters/Put.md | 102 +--- .../docs/paths/fakeuploaddownloadfile/Post.md | 76 +-- .../post/RequestBody.md | 4 +- .../java/docs/paths/fakeuploadfile/Post.md | 68 +-- .../paths/fakeuploadfile/post/RequestBody.md | 10 +- .../java/docs/paths/fakeuploadfiles/Post.md | 68 +-- .../paths/fakeuploadfiles/post/RequestBody.md | 10 +- .../docs/paths/fakewildcardresponses/Get.md | 85 +-- .../petstore/java/docs/paths/foo/Get.md | 64 +-- .../docs/paths/foo/get/FooGetServerInfo.md | 24 - .../petstore/java/docs/paths/pet/Post.md | 126 +---- .../petstore/java/docs/paths/pet/Put.md | 122 +---- .../paths/pet/post/PetPostSecurityInfo.md | 6 +- .../java/docs/paths/pet/post/RequestBody.md | 4 +- .../PetPostSecurityRequirementObject0.md | 2 +- .../PetPostSecurityRequirementObject1.md | 2 +- .../PetPostSecurityRequirementObject2.md | 2 +- .../docs/paths/pet/put/PetPutSecurityInfo.md | 5 +- .../java/docs/paths/pet/put/RequestBody.md | 4 +- .../PetPutSecurityRequirementObject0.md | 2 +- .../PetPutSecurityRequirementObject1.md | 2 +- .../java/docs/paths/petfindbystatus/Get.md | 96 +--- .../PetfindbystatusServerInfo.md | 24 - .../get/PetfindbystatusGetSecurityInfo.md | 6 +- ...ndbystatusGetSecurityRequirementObject0.md | 2 +- ...ndbystatusGetSecurityRequirementObject1.md | 2 +- ...ndbystatusGetSecurityRequirementObject2.md | 2 +- .../java/docs/paths/petfindbytags/Get.md | 94 +--- .../get/PetfindbytagsGetSecurityInfo.md | 5 +- ...findbytagsGetSecurityRequirementObject0.md | 2 +- ...findbytagsGetSecurityRequirementObject1.md | 2 +- .../java/docs/paths/petpetid/Delete.md | 92 +--- .../petstore/java/docs/paths/petpetid/Get.md | 99 +--- .../petstore/java/docs/paths/petpetid/Post.md | 92 +--- .../delete/PetpetidDeleteSecurityInfo.md | 5 +- ...etpetidDeleteSecurityRequirementObject0.md | 2 +- ...etpetidDeleteSecurityRequirementObject1.md | 2 +- .../petpetid/get/PetpetidGetSecurityInfo.md | 4 +- .../PetpetidGetSecurityRequirementObject0.md | 2 +- .../petpetid/post/PetpetidPostSecurityInfo.md | 5 +- .../docs/paths/petpetid/post/RequestBody.md | 10 +- .../PetpetidPostSecurityRequirementObject0.md | 2 +- .../PetpetidPostSecurityRequirementObject1.md | 2 +- .../docs/paths/petpetiduploadimage/Post.md | 88 +--- .../PetpetiduploadimagePostSecurityInfo.md | 4 +- .../petpetiduploadimage/post/RequestBody.md | 10 +- ...loadimagePostSecurityRequirementObject0.md | 2 +- .../petstore/java/docs/paths/solidus/Get.md | 64 +-- .../java/docs/paths/storeinventory/Get.md | 77 +-- .../get/StoreinventoryGetSecurityInfo.md | 4 +- ...einventoryGetSecurityRequirementObject0.md | 2 +- .../java/docs/paths/storeorder/Post.md | 98 +--- .../docs/paths/storeorder/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/storeorderorderid/Delete.md | 80 +-- .../java/docs/paths/storeorderorderid/Get.md | 88 +--- .../petstore/java/docs/paths/user/Post.md | 94 +--- .../java/docs/paths/user/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/usercreatewitharray/Post.md | 116 +---- .../usercreatewitharray/post/RequestBody.md | 4 +- .../docs/paths/usercreatewithlist/Post.md | 116 +---- .../usercreatewithlist/post/RequestBody.md | 4 +- .../petstore/java/docs/paths/userlogin/Get.md | 90 +--- .../java/docs/paths/userlogout/Get.md | 64 +-- .../java/docs/paths/userusername/Delete.md | 81 +-- .../java/docs/paths/userusername/Get.md | 88 +--- .../java/docs/paths/userusername/Put.md | 109 +--- .../paths/userusername/put/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../petstore/java/docs/servers/Server0.md | 491 +++++++++++++++++- .../petstore/java/docs/servers/Server1.md | 360 ++++++++++++- .../client/RootServerInfo.java | 87 +++- .../headers/Int32JsonContentTypeHeader.java | 5 +- .../headers/RefContentSchemaHeader.java | 5 +- ...omponentRefSchemaStringWithValidation.java | 5 +- .../components/requestbodies/Client.java | 3 +- .../client/components/requestbodies/Pet.java | 3 +- .../components/requestbodies/UserArray.java | 3 +- .../ApplicationjsonSchema.java | 19 +- .../responses/HeadersWithNoBody.java | 6 +- .../responses/SuccessDescriptionOnly.java | 4 +- .../SuccessInlineContentAndHeader.java | 18 +- .../responses/SuccessWithJsonApiResponse.java | 18 +- .../SuccessfulXmlAndJsonArrayOfPet.java | 12 +- .../HeadersWithNoBodyHeadersSchema.java | 23 +- .../ApplicationjsonSchema.java | 19 +- .../applicationxml/ApplicationxmlSchema.java | 19 +- ...ssInlineContentAndHeaderHeadersSchema.java | 23 +- .../ApplicationjsonSchema.java | 23 +- ...ccessWithJsonApiResponseHeadersSchema.java | 27 +- .../schemas/AbstractStepMessage.java | 35 +- .../schemas/AdditionalPropertiesClass.java | 163 +++--- .../schemas/AdditionalPropertiesSchema.java | 177 +++---- .../AdditionalPropertiesWithArrayOfEnums.java | 43 +- .../client/components/schemas/Address.java | 23 +- .../client/components/schemas/Animal.java | 43 +- .../client/components/schemas/AnimalFarm.java | 19 +- .../components/schemas/AnyTypeAndFormat.java | 453 ++++++++-------- .../components/schemas/AnyTypeNotString.java | 49 +- .../components/schemas/ApiResponseSchema.java | 27 +- .../client/components/schemas/Apple.java | 55 +- .../client/components/schemas/AppleReq.java | 27 +- .../schemas/ArrayHoldingAnyType.java | 17 +- .../schemas/ArrayOfArrayOfNumberOnly.java | 59 +-- .../components/schemas/ArrayOfEnums.java | 19 +- .../components/schemas/ArrayOfNumberOnly.java | 41 +- .../client/components/schemas/ArrayTest.java | 117 ++--- .../schemas/ArrayWithValidationsInItems.java | 33 +- .../client/components/schemas/Banana.java | 23 +- .../client/components/schemas/BananaReq.java | 27 +- .../client/components/schemas/Bar.java | 19 +- .../client/components/schemas/BasquePig.java | 37 +- .../components/schemas/BooleanEnum.java | 15 +- .../components/schemas/Capitalization.java | 33 +- .../client/components/schemas/Cat.java | 71 +-- .../client/components/schemas/Category.java | 43 +- .../client/components/schemas/ChildCat.java | 71 +-- .../client/components/schemas/ClassModel.java | 49 +- .../client/components/schemas/Client.java | 23 +- .../schemas/ComplexQuadrilateral.java | 85 +-- ...posedAnyOfDifferentTypesNoValidations.java | 65 +-- .../components/schemas/ComposedArray.java | 17 +- .../components/schemas/ComposedBool.java | 15 +- .../components/schemas/ComposedNone.java | 15 +- .../components/schemas/ComposedNumber.java | 15 +- .../components/schemas/ComposedObject.java | 21 +- .../schemas/ComposedOneOfDifferentTypes.java | 99 ++-- .../components/schemas/ComposedString.java | 15 +- .../client/components/schemas/Currency.java | 15 +- .../client/components/schemas/DanishPig.java | 37 +- .../components/schemas/DateTimeTest.java | 19 +- .../schemas/DateTimeWithValidations.java | 15 +- .../schemas/DateWithValidations.java | 15 +- .../client/components/schemas/Dog.java | 71 +-- .../client/components/schemas/Drawing.java | 49 +- .../client/components/schemas/EnumArrays.java | 71 +-- .../client/components/schemas/EnumClass.java | 19 +- .../client/components/schemas/EnumTest.java | 95 ++-- .../schemas/EquilateralTriangle.java | 85 +-- .../client/components/schemas/File.java | 23 +- .../schemas/FileSchemaTestClass.java | 43 +- .../client/components/schemas/Foo.java | 23 +- .../client/components/schemas/FormatTest.java | 193 +++---- .../client/components/schemas/FromSchema.java | 25 +- .../client/components/schemas/Fruit.java | 51 +- .../client/components/schemas/FruitReq.java | 49 +- .../client/components/schemas/GmFruit.java | 51 +- .../components/schemas/GrandparentAnimal.java | 23 +- .../components/schemas/HasOnlyReadOnly.java | 25 +- .../components/schemas/HealthCheckResult.java | 39 +- .../components/schemas/IntegerEnum.java | 15 +- .../components/schemas/IntegerEnumBig.java | 15 +- .../schemas/IntegerEnumOneValue.java | 15 +- .../schemas/IntegerEnumWithDefaultValue.java | 15 +- .../components/schemas/IntegerMax10.java | 15 +- .../components/schemas/IntegerMin15.java | 15 +- .../components/schemas/IsoscelesTriangle.java | 85 +-- .../client/components/schemas/Items.java | 19 +- .../components/schemas/JSONPatchRequest.java | 65 +-- .../JSONPatchRequestAddReplaceTest.java | 45 +- .../schemas/JSONPatchRequestMoveCopy.java | 51 +- .../schemas/JSONPatchRequestRemove.java | 45 +- .../client/components/schemas/Mammal.java | 49 +- .../client/components/schemas/MapTest.java | 133 ++--- ...ropertiesAndAdditionalPropertiesClass.java | 45 +- .../client/components/schemas/Money.java | 25 +- .../components/schemas/MyObjectDto.java | 23 +- .../client/components/schemas/Name.java | 55 +- .../schemas/NoAdditionalProperties.java | 29 +- .../components/schemas/NullableClass.java | 383 +++++++------- .../components/schemas/NullableShape.java | 49 +- .../components/schemas/NullableString.java | 17 +- .../client/components/schemas/NumberOnly.java | 23 +- .../schemas/NumberWithExclusiveMinMax.java | 15 +- .../schemas/NumberWithValidations.java | 15 +- .../schemas/ObjWithRequiredProps.java | 23 +- .../schemas/ObjWithRequiredPropsBase.java | 23 +- .../ObjectModelWithArgAndArgsProperties.java | 25 +- .../schemas/ObjectModelWithRefProps.java | 27 +- ...hAllOfWithReqTestPropFromUnsetAddProp.java | 77 ++- .../ObjectWithCollidingProperties.java | 25 +- .../schemas/ObjectWithDecimalProperties.java | 27 +- .../ObjectWithDifficultlyNamedProps.java | 21 +- .../ObjectWithInlineCompositionProperty.java | 83 +-- ...ObjectWithInvalidNamedRefedProperties.java | 23 +- .../ObjectWithNonIntersectingValues.java | 27 +- .../schemas/ObjectWithOnlyOptionalProps.java | 27 +- .../schemas/ObjectWithOptionalTestProp.java | 23 +- .../schemas/ObjectWithValidations.java | 21 +- .../client/components/schemas/Order.java | 47 +- .../schemas/PaginatedResultMyObjectDto.java | 45 +- .../client/components/schemas/ParentPet.java | 21 +- .../client/components/schemas/Pet.java | 83 +-- .../client/components/schemas/Pig.java | 49 +- .../client/components/schemas/Player.java | 25 +- .../client/components/schemas/PublicKey.java | 23 +- .../components/schemas/Quadrilateral.java | 49 +- .../schemas/QuadrilateralInterface.java | 67 +-- .../components/schemas/ReadOnlyFirst.java | 25 +- .../schemas/ReqPropsFromExplicitAddProps.java | 29 +- .../schemas/ReqPropsFromTrueAddProps.java | 27 +- .../schemas/ReqPropsFromUnsetAddProps.java | 27 +- .../components/schemas/ReturnSchema.java | 49 +- .../components/schemas/ScaleneTriangle.java | 85 +-- .../components/schemas/Schema200Response.java | 51 +- .../schemas/SelfReferencingArrayModel.java | 19 +- .../schemas/SelfReferencingObjectModel.java | 25 +- .../client/components/schemas/Shape.java | 49 +- .../components/schemas/ShapeOrNull.java | 49 +- .../schemas/SimpleQuadrilateral.java | 85 +-- .../client/components/schemas/SomeObject.java | 49 +- .../components/schemas/SpecialModelname.java | 23 +- .../components/schemas/StringBooleanMap.java | 25 +- .../client/components/schemas/StringEnum.java | 17 +- .../schemas/StringEnumWithDefaultValue.java | 19 +- .../schemas/StringWithValidation.java | 15 +- .../client/components/schemas/Tag.java | 25 +- .../client/components/schemas/Triangle.java | 49 +- .../components/schemas/TriangleInterface.java | 67 +-- .../client/components/schemas/UUIDString.java | 15 +- .../client/components/schemas/User.java | 111 ++-- .../client/components/schemas/Whale.java | 41 +- .../client/components/schemas/Zebra.java | 53 +- .../configurations/ApiConfiguration.java | 170 +++--- .../client/exceptions/BaseException.java | 2 +- .../client/header/ContentHeader.java | 41 +- .../client/header/Header.java | 6 +- .../client/header/Rfc6570Serializer.java | 55 +- .../client/header/SchemaHeader.java | 16 +- .../client/header/StyleSerializer.java | 13 +- .../client/parameter/ContentParameter.java | 22 +- .../client/parameter/CookieSerializer.java | 3 +- .../client/parameter/HeadersSerializer.java | 3 +- .../client/parameter/Parameter.java | 3 +- .../client/parameter/PathSerializer.java | 3 +- .../client/parameter/QuerySerializer.java | 3 +- .../client/parameter/SchemaParameter.java | 5 +- .../client/paths/anotherfakedummy/Patch.java | 9 +- .../anotherfakedummy/patch/Responses.java | 4 +- .../patch/responses/Code200Response.java | 16 +- .../paths/commonparamsubdir/Delete.java | 9 +- .../client/paths/commonparamsubdir/Get.java | 9 +- .../client/paths/commonparamsubdir/Post.java | 9 +- .../delete/HeaderParameters.java | 23 +- .../delete/PathParameters.java | 29 +- .../commonparamsubdir/delete/Responses.java | 4 +- .../delete/parameters/parameter1/Schema1.java | 15 +- .../commonparamsubdir/get/PathParameters.java | 29 +- .../get/QueryParameters.java | 23 +- .../commonparamsubdir/get/Responses.java | 4 +- .../routeparameter0/RouteParamSchema0.java | 15 +- .../post/HeaderParameters.java | 23 +- .../post/PathParameters.java | 29 +- .../commonparamsubdir/post/Responses.java | 4 +- .../client/paths/fake/Delete.java | 9 +- .../client/paths/fake/Get.java | 9 +- .../client/paths/fake/Patch.java | 9 +- .../client/paths/fake/Post.java | 9 +- .../fake/delete/FakeDeleteSecurityInfo.java | 13 +- .../paths/fake/delete/HeaderParameters.java | 25 +- .../paths/fake/delete/QueryParameters.java | 29 +- .../client/paths/fake/delete/Responses.java | 4 +- .../delete/parameters/parameter1/Schema1.java | 15 +- .../delete/parameters/parameter4/Schema4.java | 15 +- .../paths/fake/get/HeaderParameters.java | 25 +- .../paths/fake/get/QueryParameters.java | 29 +- .../client/paths/fake/get/RequestBody.java | 3 +- .../client/paths/fake/get/Responses.java | 4 +- .../get/parameters/parameter0/Schema0.java | 37 +- .../get/parameters/parameter1/Schema1.java | 19 +- .../get/parameters/parameter2/Schema2.java | 37 +- .../get/parameters/parameter3/Schema3.java | 19 +- .../get/parameters/parameter4/Schema4.java | 15 +- .../get/parameters/parameter5/Schema5.java | 15 +- .../ApplicationxwwwformurlencodedSchema.java | 79 +-- .../fake/get/responses/Code404Response.java | 16 +- .../client/paths/fake/patch/Responses.java | 4 +- .../fake/patch/responses/Code200Response.java | 16 +- .../paths/fake/post/FakePostSecurityInfo.java | 13 +- .../client/paths/fake/post/RequestBody.java | 3 +- .../client/paths/fake/post/Responses.java | 4 +- .../ApplicationxwwwformurlencodedSchema.java | 167 +++--- .../fake/post/responses/Code404Response.java | 4 +- .../Get.java | 9 +- .../get/RequestBody.java | 3 +- .../get/Responses.java | 4 +- .../get/responses/Code200Response.java | 16 +- .../paths/fakebodywithfileschema/Put.java | 9 +- .../put/RequestBody.java | 3 +- .../fakebodywithfileschema/put/Responses.java | 4 +- .../paths/fakebodywithqueryparams/Put.java | 9 +- .../put/QueryParameters.java | 29 +- .../put/RequestBody.java | 3 +- .../put/Responses.java | 4 +- .../paths/fakecasesensitiveparams/Put.java | 9 +- .../put/QueryParameters.java | 27 +- .../put/Responses.java | 4 +- .../client/paths/fakeclassnametest/Patch.java | 9 +- .../FakeclassnametestPatchSecurityInfo.java | 13 +- .../fakeclassnametest/patch/Responses.java | 4 +- .../patch/responses/Code200Response.java | 16 +- .../paths/fakedeletecoffeeid/Delete.java | 9 +- .../delete/PathParameters.java | 29 +- .../fakedeletecoffeeid/delete/Responses.java | 4 +- .../delete/responses/CodedefaultResponse.java | 4 +- .../client/paths/fakehealth/Get.java | 9 +- .../paths/fakehealth/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 16 +- .../fakeinlineadditionalproperties/Post.java | 9 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../ApplicationjsonSchema.java | 23 +- .../paths/fakeinlinecomposition/Post.java | 9 +- .../post/QueryParameters.java | 25 +- .../post/RequestBody.java | 3 +- .../fakeinlinecomposition/post/Responses.java | 4 +- .../post/parameters/parameter0/Schema0.java | 63 +-- .../post/parameters/parameter1/Schema1.java | 83 +-- .../ApplicationjsonSchema.java | 63 +-- .../MultipartformdataSchema.java | 83 +-- .../post/responses/Code200Response.java | 12 +- .../ApplicationjsonSchema.java | 63 +-- .../MultipartformdataSchema.java | 83 +-- .../client/paths/fakejsonformdata/Get.java | 9 +- .../fakejsonformdata/get/RequestBody.java | 3 +- .../paths/fakejsonformdata/get/Responses.java | 4 +- .../ApplicationxwwwformurlencodedSchema.java | 25 +- .../client/paths/fakejsonpatch/Patch.java | 9 +- .../fakejsonpatch/patch/RequestBody.java | 3 +- .../paths/fakejsonpatch/patch/Responses.java | 4 +- .../paths/fakejsonwithcharset/Post.java | 9 +- .../fakejsonwithcharset/post/RequestBody.java | 3 +- .../fakejsonwithcharset/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../Post.java | 9 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../ApplicationjsonSchema.java | 23 +- .../MultipartformdataSchema.java | 23 +- .../post/responses/Code200Response.java | 16 +- .../paths/fakemultipleresponsebodies/Get.java | 9 +- .../get/Responses.java | 4 +- .../get/responses/Code200Response.java | 16 +- .../get/responses/Code202Response.java | 16 +- .../paths/fakemultiplesecurities/Get.java | 9 +- ...FakemultiplesecuritiesGetSecurityInfo.java | 26 +- .../fakemultiplesecurities/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 16 +- .../client/paths/fakeobjinquery/Get.java | 9 +- .../fakeobjinquery/get/QueryParameters.java | 23 +- .../paths/fakeobjinquery/get/Responses.java | 4 +- .../get/parameters/parameter0/Schema0.java | 23 +- .../Post.java | 9 +- .../post/CookieParameters.java | 27 +- .../post/HeaderParameters.java | 25 +- .../post/PathParameters.java | 27 +- .../post/QueryParameters.java | 27 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakepemcontenttype/Get.java | 9 +- .../fakepemcontenttype/get/RequestBody.java | 3 +- .../fakepemcontenttype/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 16 +- .../Post.java | 9 +- ...imagewithrequiredfilePostSecurityInfo.java | 13 +- .../post/PathParameters.java | 29 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../MultipartformdataSchema.java | 25 +- .../post/responses/Code200Response.java | 16 +- .../Get.java | 9 +- .../get/QueryParameters.java | 29 +- .../get/Responses.java | 4 +- .../get/parameters/Parameter0.java | 5 +- .../get/responses/Code200Response.java | 16 +- .../client/paths/fakeredirection/Get.java | 9 +- .../paths/fakeredirection/get/Responses.java | 4 +- .../get/responses/Code303Response.java | 4 +- .../get/responses/Code3XXResponse.java | 4 +- .../client/paths/fakerefobjinquery/Get.java | 9 +- .../get/QueryParameters.java | 23 +- .../fakerefobjinquery/get/Responses.java | 4 +- .../client/paths/fakerefsarraymodel/Post.java | 9 +- .../fakerefsarraymodel/post/RequestBody.java | 3 +- .../fakerefsarraymodel/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../paths/fakerefsarrayofenums/Post.java | 9 +- .../post/RequestBody.java | 3 +- .../fakerefsarrayofenums/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakerefsboolean/Post.java | 9 +- .../fakerefsboolean/post/RequestBody.java | 3 +- .../paths/fakerefsboolean/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../Post.java | 9 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakerefsenum/Post.java | 9 +- .../paths/fakerefsenum/post/RequestBody.java | 3 +- .../paths/fakerefsenum/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakerefsmammal/Post.java | 9 +- .../fakerefsmammal/post/RequestBody.java | 3 +- .../paths/fakerefsmammal/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakerefsnumber/Post.java | 9 +- .../fakerefsnumber/post/RequestBody.java | 3 +- .../paths/fakerefsnumber/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../fakerefsobjectmodelwithrefprops/Post.java | 9 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakerefsstring/Post.java | 9 +- .../fakerefsstring/post/RequestBody.java | 3 +- .../paths/fakerefsstring/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../paths/fakeresponsewithoutschema/Get.java | 9 +- .../get/Responses.java | 4 +- .../get/responses/Code200Response.java | 4 +- .../paths/faketestqueryparamters/Put.java | 9 +- .../put/QueryParameters.java | 33 +- .../faketestqueryparamters/put/Responses.java | 4 +- .../put/parameters/parameter0/Schema0.java | 19 +- .../put/parameters/parameter1/Schema1.java | 19 +- .../put/parameters/parameter2/Schema2.java | 19 +- .../put/parameters/parameter3/Schema3.java | 19 +- .../put/parameters/parameter4/Schema4.java | 19 +- .../paths/fakeuploaddownloadfile/Post.java | 9 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakeuploadfile/Post.java | 9 +- .../fakeuploadfile/post/RequestBody.java | 3 +- .../paths/fakeuploadfile/post/Responses.java | 4 +- .../MultipartformdataSchema.java | 25 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakeuploadfiles/Post.java | 9 +- .../fakeuploadfiles/post/RequestBody.java | 3 +- .../paths/fakeuploadfiles/post/Responses.java | 4 +- .../MultipartformdataSchema.java | 41 +- .../post/responses/Code200Response.java | 16 +- .../paths/fakewildcardresponses/Get.java | 9 +- .../fakewildcardresponses/get/Responses.java | 4 +- .../get/responses/Code1XXResponse.java | 16 +- .../get/responses/Code200Response.java | 16 +- .../get/responses/Code2XXResponse.java | 16 +- .../get/responses/Code3XXResponse.java | 16 +- .../get/responses/Code4XXResponse.java | 16 +- .../get/responses/Code5XXResponse.java | 16 +- .../client/paths/foo/Get.java | 9 +- .../paths/foo/get/FooGetServerInfo.java | 74 ++- .../client/paths/foo/get/Responses.java | 4 +- .../get/responses/CodedefaultResponse.java | 16 +- .../ApplicationjsonSchema.java | 21 +- .../paths/foo/get/servers/FooGetServer1.java | 20 +- .../foo/get/servers/server1/Variables.java | 47 +- .../client/paths/pet/Post.java | 9 +- .../client/paths/pet/Put.java | 9 +- .../paths/pet/post/PetPostSecurityInfo.java | 26 +- .../client/paths/pet/post/Responses.java | 4 +- .../pet/post/responses/Code405Response.java | 4 +- .../paths/pet/put/PetPutSecurityInfo.java | 21 +- .../client/paths/pet/put/Responses.java | 4 +- .../pet/put/responses/Code400Response.java | 4 +- .../pet/put/responses/Code404Response.java | 4 +- .../pet/put/responses/Code405Response.java | 4 +- .../client/paths/petfindbystatus/Get.java | 9 +- .../PetfindbystatusServerInfo.java | 74 ++- .../get/PetfindbystatusGetSecurityInfo.java | 26 +- .../petfindbystatus/get/QueryParameters.java | 29 +- .../paths/petfindbystatus/get/Responses.java | 4 +- .../get/parameters/parameter0/Schema0.java | 37 +- .../get/responses/Code400Response.java | 4 +- .../servers/PetfindbystatusServer1.java | 20 +- .../servers/server1/Variables.java | 47 +- .../client/paths/petfindbytags/Get.java | 9 +- .../get/PetfindbytagsGetSecurityInfo.java | 21 +- .../petfindbytags/get/QueryParameters.java | 29 +- .../paths/petfindbytags/get/Responses.java | 4 +- .../get/parameters/parameter0/Schema0.java | 19 +- .../get/responses/Code400Response.java | 4 +- .../client/paths/petpetid/Delete.java | 9 +- .../client/paths/petpetid/Get.java | 9 +- .../client/paths/petpetid/Post.java | 9 +- .../petpetid/delete/HeaderParameters.java | 23 +- .../paths/petpetid/delete/PathParameters.java | 29 +- .../delete/PetpetidDeleteSecurityInfo.java | 21 +- .../paths/petpetid/delete/Responses.java | 4 +- .../delete/responses/Code400Response.java | 4 +- .../paths/petpetid/get/PathParameters.java | 29 +- .../petpetid/get/PetpetidGetSecurityInfo.java | 13 +- .../client/paths/petpetid/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 12 +- .../get/responses/Code400Response.java | 4 +- .../get/responses/Code404Response.java | 4 +- .../paths/petpetid/post/PathParameters.java | 29 +- .../post/PetpetidPostSecurityInfo.java | 21 +- .../paths/petpetid/post/RequestBody.java | 3 +- .../client/paths/petpetid/post/Responses.java | 4 +- .../ApplicationxwwwformurlencodedSchema.java | 25 +- .../post/responses/Code405Response.java | 4 +- .../paths/petpetiduploadimage/Post.java | 9 +- .../post/PathParameters.java | 29 +- .../PetpetiduploadimagePostSecurityInfo.java | 13 +- .../petpetiduploadimage/post/RequestBody.java | 3 +- .../petpetiduploadimage/post/Responses.java | 4 +- .../MultipartformdataSchema.java | 25 +- .../client/paths/solidus/Get.java | 9 +- .../client/paths/solidus/get/Responses.java | 4 +- .../client/paths/storeinventory/Get.java | 9 +- .../paths/storeinventory/get/Responses.java | 4 +- .../get/StoreinventoryGetSecurityInfo.java | 13 +- .../client/paths/storeorder/Post.java | 9 +- .../paths/storeorder/post/RequestBody.java | 3 +- .../paths/storeorder/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 12 +- .../post/responses/Code400Response.java | 4 +- .../paths/storeorderorderid/Delete.java | 9 +- .../client/paths/storeorderorderid/Get.java | 9 +- .../delete/PathParameters.java | 29 +- .../storeorderorderid/delete/Responses.java | 4 +- .../delete/responses/Code400Response.java | 4 +- .../delete/responses/Code404Response.java | 4 +- .../storeorderorderid/get/PathParameters.java | 29 +- .../storeorderorderid/get/Responses.java | 4 +- .../get/parameters/parameter0/Schema0.java | 15 +- .../get/responses/Code200Response.java | 12 +- .../get/responses/Code400Response.java | 4 +- .../get/responses/Code404Response.java | 4 +- .../client/paths/user/Post.java | 9 +- .../client/paths/user/post/RequestBody.java | 3 +- .../client/paths/user/post/Responses.java | 4 +- .../post/responses/CodedefaultResponse.java | 4 +- .../paths/usercreatewitharray/Post.java | 9 +- .../usercreatewitharray/post/Responses.java | 4 +- .../post/responses/CodedefaultResponse.java | 4 +- .../client/paths/usercreatewithlist/Post.java | 9 +- .../usercreatewithlist/post/Responses.java | 4 +- .../post/responses/CodedefaultResponse.java | 4 +- .../client/paths/userlogin/Get.java | 9 +- .../paths/userlogin/get/QueryParameters.java | 25 +- .../client/paths/userlogin/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 14 +- .../get/responses/Code400Response.java | 4 +- .../Code200ResponseHeadersSchema.java | 25 +- .../code200response/headers/XRateLimit.java | 5 +- .../client/paths/userlogout/Get.java | 9 +- .../paths/userlogout/get/Responses.java | 4 +- .../client/paths/userusername/Delete.java | 9 +- .../client/paths/userusername/Get.java | 9 +- .../client/paths/userusername/Put.java | 9 +- .../userusername/delete/PathParameters.java | 29 +- .../paths/userusername/delete/Responses.java | 4 +- .../delete/responses/Code404Response.java | 4 +- .../userusername/get/PathParameters.java | 29 +- .../paths/userusername/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 12 +- .../get/responses/Code400Response.java | 4 +- .../get/responses/Code404Response.java | 4 +- .../userusername/put/PathParameters.java | 29 +- .../paths/userusername/put/RequestBody.java | 3 +- .../paths/userusername/put/Responses.java | 4 +- .../put/responses/Code400Response.java | 4 +- .../put/responses/Code404Response.java | 4 +- .../requestbody/RequestBodySerializer.java | 7 +- .../client/response/HeadersDeserializer.java | 4 +- .../client/response/ResponseDeserializer.java | 37 +- .../response/ResponsesDeserializer.java | 5 +- .../client/schemas/AnyTypeJsonSchema.java | 49 +- .../client/schemas/BooleanJsonSchema.java | 15 +- .../client/schemas/DateJsonSchema.java | 17 +- .../client/schemas/DateTimeJsonSchema.java | 17 +- .../client/schemas/DecimalJsonSchema.java | 15 +- .../client/schemas/DoubleJsonSchema.java | 17 +- .../client/schemas/FloatJsonSchema.java | 17 +- .../client/schemas/Int32JsonSchema.java | 19 +- .../client/schemas/Int64JsonSchema.java | 21 +- .../client/schemas/IntJsonSchema.java | 21 +- .../client/schemas/ListJsonSchema.java | 19 +- .../client/schemas/MapJsonSchema.java | 21 +- .../client/schemas/NotAnyTypeJsonSchema.java | 49 +- .../client/schemas/NullJsonSchema.java | 15 +- .../client/schemas/NumberJsonSchema.java | 25 +- .../client/schemas/StringJsonSchema.java | 17 +- .../client/schemas/UuidJsonSchema.java | 17 +- .../AdditionalPropertiesValidator.java | 4 +- .../schemas/validation/AllOfValidator.java | 4 +- .../schemas/validation/AnyOfValidator.java | 2 +- .../validation/BigDecimalValidator.java | 2 +- .../validation/BooleanEnumValidator.java | 3 +- .../validation/BooleanSchemaValidator.java | 5 +- .../schemas/validation/ConstValidator.java | 2 +- .../schemas/validation/ContainsValidator.java | 2 +- .../validation/DefaultValueMethod.java | 4 +- .../DependentRequiredValidator.java | 2 +- .../validation/DependentSchemasValidator.java | 3 +- .../validation/DoubleEnumValidator.java | 3 +- .../schemas/validation/ElseValidator.java | 3 +- .../schemas/validation/EnumValidator.java | 2 +- .../validation/ExclusiveMaximumValidator.java | 2 +- .../validation/ExclusiveMinimumValidator.java | 2 +- .../validation/FloatEnumValidator.java | 3 +- .../schemas/validation/FormatValidator.java | 6 +- .../schemas/validation/IfValidator.java | 2 +- .../validation/IntegerEnumValidator.java | 3 +- .../schemas/validation/ItemsValidator.java | 3 +- .../client/schemas/validation/JsonSchema.java | 27 +- .../validation/ListSchemaValidator.java | 7 +- .../schemas/validation/LongEnumValidator.java | 3 +- .../validation/MapSchemaValidator.java | 7 +- .../validation/MaxContainsValidator.java | 2 +- .../schemas/validation/MaxItemsValidator.java | 2 +- .../validation/MaxLengthValidator.java | 2 +- .../validation/MaxPropertiesValidator.java | 2 +- .../schemas/validation/MaximumValidator.java | 2 +- .../validation/MinContainsValidator.java | 2 +- .../schemas/validation/MinItemsValidator.java | 2 +- .../validation/MinLengthValidator.java | 2 +- .../validation/MinPropertiesValidator.java | 2 +- .../schemas/validation/MinimumValidator.java | 2 +- .../validation/MultipleOfValidator.java | 2 +- .../schemas/validation/NotValidator.java | 2 +- .../schemas/validation/NullEnumValidator.java | 3 +- .../validation/NullSchemaValidator.java | 8 +- .../validation/NumberSchemaValidator.java | 5 +- .../schemas/validation/OneOfValidator.java | 2 +- .../schemas/validation/PatternValidator.java | 2 +- .../validation/PrefixItemsValidator.java | 3 +- .../validation/PropertiesValidator.java | 3 +- .../validation/PropertyNamesValidator.java | 3 +- .../schemas/validation/RequiredValidator.java | 4 +- .../validation/StringEnumValidator.java | 3 +- .../validation/StringSchemaValidator.java | 5 +- .../schemas/validation/ThenValidator.java | 3 +- .../schemas/validation/TypeValidator.java | 4 +- .../validation/UnevaluatedItemsValidator.java | 3 +- .../UnevaluatedPropertiesValidator.java | 6 +- .../validation/UniqueItemsValidator.java | 4 +- .../validation/UnsetAnyTypeJsonSchema.java | 49 +- .../SecurityRequirementObjectProvider.java | 5 +- .../client/servers/Server0.java | 20 +- .../client/servers/Server1.java | 20 +- .../client/servers/ServerProvider.java | 4 +- .../client/servers/server0/Variables.java | 63 +-- .../client/servers/server1/Variables.java | 47 +- .../client/header/ContentHeaderTest.java | 7 +- .../client/header/SchemaHeaderTest.java | 9 +- .../parameter/CookieSerializerTest.java | 3 +- .../parameter/HeadersSerializerTest.java | 3 +- .../client/parameter/PathSerializerTest.java | 3 +- .../client/parameter/QuerySerializerTest.java | 3 +- .../SchemaNonQueryParameterTest.java | 18 +- .../parameter/SchemaQueryParameterTest.java | 10 +- .../RequestBodySerializerTest.java | 8 +- .../response/ResponseDeserializerTest.java | 21 +- .../client/schemas/AnyTypeSchemaTest.java | 23 +- .../client/schemas/ArrayTypeSchemaTest.java | 45 +- .../client/schemas/BooleanSchemaTest.java | 7 +- .../client/schemas/ListSchemaTest.java | 4 +- .../client/schemas/MapSchemaTest.java | 4 +- .../client/schemas/NullSchemaTest.java | 5 +- .../client/schemas/NumberSchemaTest.java | 10 +- .../client/schemas/ObjectTypeSchemaTest.java | 87 ++-- .../client/schemas/RefBooleanSchemaTest.java | 7 +- .../AdditionalPropertiesValidatorTest.java | 14 +- .../validation/FormatValidatorTest.java | 28 +- .../validation/ItemsValidatorTest.java | 13 +- .../schemas/validation/JsonSchemaTest.java | 11 +- .../validation/PropertiesValidatorTest.java | 15 +- .../validation/RequiredValidatorTest.java | 13 +- .../schemas/validation/TypeValidatorTest.java | 2 +- .../generators/JavaClientGenerator.java | 3 +- 1053 files changed, 9663 insertions(+), 14137 deletions(-) diff --git a/docs/generators/java.md b/docs/generators/java.md index 78a18338180..83844d3c5fa 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -235,7 +235,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ---- | --------- | ---------- | |Info|✓|OAS2,OAS3 |Servers|✓|OAS3 -|Paths|✗|OAS2,OAS3 +|Paths|✓|OAS2,OAS3 |Webhooks|✗|OAS3 |Components|✓|OAS3 |Security|✓|OAS2,OAS3 diff --git a/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES b/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES index f42a790caea..d2ab4d20baf 100644 --- a/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES +++ b/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES @@ -188,8 +188,6 @@ src/main/java/org/openapijsonschematools/client/exceptions/ApiException.java src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidTypeException.java -src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java -src/main/java/org/openapijsonschematools/client/exceptions/OpenapiDocumentException.java src/main/java/org/openapijsonschematools/client/exceptions/UnsetPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/ValidationException.java src/main/java/org/openapijsonschematools/client/header/ContentHeader.java diff --git a/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md b/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md index 02e74ac57a6..e1624a56d1f 100644 --- a/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md +++ b/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md @@ -4,36 +4,13 @@ RootServerInfo.java public class RootServerInfo A class that provides a server, and any needed server info classes -- a class that is a 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 | | 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()
Creates an instance using default server variable values | -| RootServerInfo1(@Nullable [Server0](servers/Server0.md) server0)
Creates an instance using passed in servers | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [Server0](servers/Server0.md) | server0 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Server | getServer([ServerIndex](#serverindex) serverIndex) | - ## ServerIndex enum ServerIndex
diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java index 7194d05eda1..d5c2f5cb5fd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java @@ -1,33 +1,73 @@ package org.openapijsonschematools.client; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server; import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; +import java.util.AbstractMap; +import java.util.Map; import java.util.Objects; +import java.util.EnumMap; -public class RootServerInfo { - public static class RootServerInfo1 implements ServerProvider { - public final Server0 server0; +public class RootServerInfo implements ServerProvider { + final private Servers servers; + final private ServerIndex serverIndex; - public RootServerInfo1() { - server0 = new Server0(); + public RootServerInfo() { + this.servers = new Servers(); + this.serverIndex = ServerIndex.SERVER_0; + } + + public RootServerInfo(Servers servers, ServerIndex serverIndex) { + this.servers = servers; + this.serverIndex = serverIndex; + } + + public static class Servers { + private final EnumMap servers; + + public Servers() { + servers = new EnumMap<>( + Map.ofEntries( + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_0, + new Server0() + ) + ) + ); } - public RootServerInfo1( + public Servers( @Nullable Server0 server0 ) { - this.server0 = Objects.requireNonNullElseGet(server0, Server0::new); + servers = new EnumMap<>( + Map.ofEntries( + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_0, + Objects.requireNonNullElseGet(server0, Server0::new) + ) + ) + ); } - @Override - public Server getServer(ServerIndex serverIndex) { - return server0; + public Server get(ServerIndex serverIndex) { + if (servers.containsKey(serverIndex)) { + return get(serverIndex); + } + throw new UnsetPropertyException(serverIndex+" is unset"); } } public enum ServerIndex { SERVER_0 } + + public Server getServer(@Nullable ServerIndex serverIndex) { + if (serverIndex == null) { + return servers.get(this.serverIndex); + } + return servers.get(serverIndex); + } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index 5e6abe6fc5d..b91c994ef9b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -72,7 +72,7 @@ protected AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(FrozenMap<@Nul "foo", "bar" ); - public static AdditionalpropertiesAllowsASchemaWhichShouldValidateMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AdditionalpropertiesAllowsASchemaWhichShouldValidateMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance().validate(arg, configuration); } @@ -88,7 +88,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException, throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for " + name); + throw new InvalidTypeException("Invalid value stored for " + name); } return (boolean) value; } @@ -299,7 +299,7 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(Ma for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -307,7 +307,7 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(Ma Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -336,11 +336,11 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index a94cc959104..e6517f75b10 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -69,7 +69,7 @@ protected AdditionalpropertiesAreAllowedByDefaultMap(FrozenMap<@Nullable Object> "foo", "bar" ); - public static AdditionalpropertiesAreAllowedByDefaultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AdditionalpropertiesAreAllowedByDefaultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return AdditionalpropertiesAreAllowedByDefault1.getInstance().validate(arg, configuration); } @@ -344,19 +344,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -372,15 +372,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -393,7 +393,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -404,7 +404,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -420,7 +420,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(Map arg, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -428,7 +428,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(Map arg, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -468,7 +468,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, Schema throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -483,7 +483,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, Schema } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalpropertiesAreAllowedByDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index 1add26d91a0..649e69307db 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -45,7 +45,7 @@ protected AdditionalpropertiesCanExistByItselfMap(FrozenMap m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AdditionalpropertiesCanExistByItselfMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AdditionalpropertiesCanExistByItselfMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return AdditionalpropertiesCanExistByItself1.getInstance().validate(arg, configuration); } @@ -53,7 +53,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new RuntimeException("Value may not be null"); + throw new InvalidTypeException("Value may not be null"); } return (boolean) value; } @@ -133,7 +133,7 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(Map arg, Lis for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -141,12 +141,12 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(Map arg, Lis Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -173,11 +173,11 @@ public AdditionalpropertiesCanExistByItselfMap validate(Map arg, SchemaCon throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalpropertiesCanExistByItself1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index 6000d454536..46155636adf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -70,7 +70,7 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema0.getInstance().validate(arg, configuration); } @@ -271,19 +271,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -299,15 +299,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -320,7 +320,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -331,7 +331,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -347,7 +347,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -355,7 +355,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -395,7 +395,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -410,7 +410,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -463,7 +463,7 @@ protected AdditionalpropertiesShouldNotLookInApplicatorsMap(FrozenMap m } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static AdditionalpropertiesShouldNotLookInApplicatorsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AdditionalpropertiesShouldNotLookInApplicatorsMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return AdditionalpropertiesShouldNotLookInApplicators1.getInstance().validate(arg, configuration); } @@ -471,7 +471,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new RuntimeException("Value may not be null"); + throw new InvalidTypeException("Value may not be null"); } return (boolean) value; } @@ -619,19 +619,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -647,15 +647,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -668,7 +668,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -679,7 +679,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -695,7 +695,7 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(Map entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -703,12 +703,12 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(Map, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -746,7 +746,7 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap validate(Map arg, throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -761,7 +761,7 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap validate(Map arg, } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index e19e222b2e4..f2c3bac9dfb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -58,14 +58,14 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { "bar" ); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema0.getInstance().validate(arg, configuration); } public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for bar"); + throw new InvalidTypeException("Invalid value stored for bar"); } return (Number) value; } @@ -246,19 +246,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -274,15 +274,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -295,7 +295,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -322,7 +322,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +330,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -370,7 +370,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,7 +385,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -451,14 +451,14 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for foo"); + throw new InvalidTypeException("Invalid value stored for foo"); } return (String) value; } @@ -621,19 +621,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -649,15 +649,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -670,7 +670,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -681,7 +681,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -697,7 +697,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +705,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -745,7 +745,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,7 +760,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -915,19 +915,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -943,15 +943,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -964,7 +964,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -975,7 +975,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -991,7 +991,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +999,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1039,7 +1039,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,7 +1054,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Allof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index f342708a0b3..e17daac12ce 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -135,19 +135,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -163,15 +163,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -184,7 +184,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -195,7 +195,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -211,7 +211,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -259,7 +259,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -274,7 +274,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema02BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -420,19 +420,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -448,15 +448,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -469,7 +469,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -480,7 +480,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -496,7 +496,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -504,7 +504,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -544,7 +544,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -559,7 +559,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -705,19 +705,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -733,15 +733,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -754,7 +754,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -765,7 +765,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -781,7 +781,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -789,7 +789,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -829,7 +829,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -844,7 +844,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1004,19 +1004,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -1032,15 +1032,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -1053,7 +1053,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1064,7 +1064,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1080,7 +1080,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1088,7 +1088,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1128,7 +1128,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1143,7 +1143,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofCombinedWithAnyofOneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index cfdfe8f7d24..4c9d473a2f9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -134,19 +134,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -162,15 +162,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -183,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -194,7 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -210,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -258,7 +258,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,7 +273,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -419,19 +419,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -447,15 +447,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -468,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -479,7 +479,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -495,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -543,7 +543,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,7 +558,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -713,19 +713,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -741,15 +741,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -762,7 +762,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -773,7 +773,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -789,7 +789,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -797,7 +797,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -837,7 +837,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -852,7 +852,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofSimpleTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index a05bd71d7c3..a67e189c9e4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -59,14 +59,14 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema0.getInstance().validate(arg, configuration); } public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for foo"); + throw new InvalidTypeException("Invalid value stored for foo"); } return (String) value; } @@ -229,19 +229,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -257,15 +257,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -278,7 +278,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -289,7 +289,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -305,7 +305,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -313,7 +313,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -353,7 +353,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -368,7 +368,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -434,14 +434,14 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { "baz" ); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } public Void baz() { @Nullable Object value = get("baz"); if (!(value == null || value instanceof Void)) { - throw new RuntimeException("Invalid value stored for baz"); + throw new InvalidTypeException("Invalid value stored for baz"); } return (Void) value; } @@ -604,19 +604,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -632,15 +632,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -653,7 +653,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -664,7 +664,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -680,7 +680,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -688,7 +688,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -728,7 +728,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -743,7 +743,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -809,14 +809,14 @@ protected AllofWithBaseSchemaMap(FrozenMap<@Nullable Object> m) { "bar" ); public static final Set optionalKeys = Set.of(); - public static AllofWithBaseSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static AllofWithBaseSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return AllofWithBaseSchema1.getInstance().validate(arg, configuration); } public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for bar"); + throw new InvalidTypeException("Invalid value stored for bar"); } return (Number) value; } @@ -1007,19 +1007,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -1035,15 +1035,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -1056,7 +1056,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1067,7 +1067,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1083,7 +1083,7 @@ public AllofWithBaseSchemaMap getNewInstance(Map arg, List pathToI for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1091,7 +1091,7 @@ public AllofWithBaseSchemaMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1131,7 +1131,7 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration config throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1146,7 +1146,7 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration config } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofWithBaseSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index df7ff6e1661..6ad17067551 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -154,19 +154,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -182,15 +182,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -203,7 +203,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -214,7 +214,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -230,7 +230,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -238,7 +238,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -278,7 +278,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -293,7 +293,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 48afc2705eb..77063ed5e5c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -167,19 +167,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -195,15 +195,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofWithTheFirstEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index 49eebf5cd46..0ea5f48a712 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -167,19 +167,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -195,15 +195,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofWithTheLastEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index 03a387d112d..6430ce42fd0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -166,19 +166,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -194,15 +194,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -215,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -226,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -250,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -290,7 +290,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -305,7 +305,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AllofWithTwoEmptySchemas1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index 5dafc9805a3..901e8939216 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -146,19 +146,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -174,15 +174,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -195,7 +195,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -206,7 +206,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -222,7 +222,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,7 +230,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -270,7 +270,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -285,7 +285,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -440,19 +440,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -468,15 +468,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -489,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -500,7 +500,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -516,7 +516,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -524,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -564,7 +564,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -579,7 +579,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Anyof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index 76ac59d0e64..1057b9bce71 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -58,14 +58,14 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { "bar" ); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema0.getInstance().validate(arg, configuration); } public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for bar"); + throw new InvalidTypeException("Invalid value stored for bar"); } return (Number) value; } @@ -246,19 +246,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -274,15 +274,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -295,7 +295,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -322,7 +322,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +330,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -370,7 +370,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,7 +385,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -451,14 +451,14 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for foo"); + throw new InvalidTypeException("Invalid value stored for foo"); } return (String) value; } @@ -621,19 +621,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -649,15 +649,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -670,7 +670,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -681,7 +681,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -697,7 +697,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +705,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -745,7 +745,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,7 +760,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -915,19 +915,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -943,15 +943,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -964,7 +964,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -975,7 +975,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -991,7 +991,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +999,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1039,7 +1039,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,7 +1054,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AnyofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index f8740297732..c3885e3556d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -134,19 +134,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -162,15 +162,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -183,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -194,7 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -210,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -258,7 +258,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,7 +273,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -419,19 +419,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -447,15 +447,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -468,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -479,7 +479,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -495,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -543,7 +543,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,7 +558,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -647,7 +647,7 @@ public static AnyofWithBaseSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -665,11 +665,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AnyofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index a550e0b04b8..8566d7392b2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -167,19 +167,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -195,15 +195,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AnyofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java index 008bbe651a4..4a31884a01b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java @@ -39,7 +39,7 @@ public static class ArrayTypeMatchesArraysList extends FrozenList<@Nullable Obje protected ArrayTypeMatchesArraysList(FrozenList<@Nullable Object> m) { super(m); } - public static ArrayTypeMatchesArraysList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ArrayTypeMatchesArraysList of(List arg, SchemaConfiguration configuration) throws ValidationException { return ArrayTypeMatchesArrays1.getInstance().validate(arg, configuration); } } @@ -152,7 +152,7 @@ public ArrayTypeMatchesArraysList getNewInstance(List arg, List pathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -163,7 +163,7 @@ public ArrayTypeMatchesArraysList getNewInstance(List arg, List pathT return new ArrayTypeMatchesArraysList(newInstanceItems); } - public ArrayTypeMatchesArraysList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayTypeMatchesArraysList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -181,11 +181,11 @@ public ArrayTypeMatchesArraysList validate(List arg, SchemaConfiguration conf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ArrayTypeMatchesArrays1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index d5326a3a257..ebcbb032fc3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -141,19 +141,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -169,15 +169,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -190,7 +190,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -201,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -217,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -265,7 +265,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,7 +280,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ByInt1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index ffa183d94ab..828c756720c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -141,19 +141,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -169,15 +169,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -190,7 +190,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -201,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -217,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -265,7 +265,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,7 +280,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ByNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index 2a7aca739ad..c91371daa4a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -141,19 +141,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -169,15 +169,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -190,7 +190,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -201,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -217,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -265,7 +265,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,7 +280,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public BySmallNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index 5fa41afb598..fd3953683af 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public DateTimeFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index 6c1fbceb093..97090800803 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EmailFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java index 3c4c61d7168..925c8e678d9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java @@ -121,7 +121,7 @@ public static EnumWith0DoesNotMatchFalse1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,39 +131,39 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public int validate(IntegerEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public long validate(LongEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public float validate(FloatEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public double validate(DoubleEnumWith0DoesNotMatchFalseEnums arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } @@ -175,11 +175,11 @@ public double validate(DoubleEnumWith0DoesNotMatchFalseEnums arg,SchemaConfigura throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumWith0DoesNotMatchFalse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java index c728c06820a..3fc1f77d7d0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java @@ -121,7 +121,7 @@ public static EnumWith1DoesNotMatchTrue1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,39 +131,39 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public int validate(IntegerEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public long validate(LongEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public float validate(FloatEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public double validate(DoubleEnumWith1DoesNotMatchTrueEnums arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } @@ -175,11 +175,11 @@ public double validate(DoubleEnumWith1DoesNotMatchTrueEnums arg,SchemaConfigurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumWith1DoesNotMatchTrue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java index ef586e9bf0f..d5dab170d98 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java @@ -77,7 +77,7 @@ public static EnumWithEscapedCharacters1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -88,7 +88,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringEnumWithEscapedCharactersEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringEnumWithEscapedCharactersEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @@ -100,11 +100,11 @@ public String validate(StringEnumWithEscapedCharactersEnums arg,SchemaConfigurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java index b9b58c3b67a..bfc0223b2f7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java @@ -73,7 +73,7 @@ public static EnumWithFalseDoesNotMatch01 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -84,7 +84,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public boolean validate(BooleanEnumWithFalseDoesNotMatch0Enums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public boolean validate(BooleanEnumWithFalseDoesNotMatch0Enums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @@ -97,12 +97,12 @@ public boolean validate(BooleanEnumWithFalseDoesNotMatch0Enums arg,SchemaConfigu throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumWithFalseDoesNotMatch01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java index 718dbc2a618..4581de4b395 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java @@ -73,7 +73,7 @@ public static EnumWithTrueDoesNotMatch11 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -84,7 +84,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public boolean validate(BooleanEnumWithTrueDoesNotMatch1Enums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public boolean validate(BooleanEnumWithTrueDoesNotMatch1Enums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @@ -97,12 +97,12 @@ public boolean validate(BooleanEnumWithTrueDoesNotMatch1Enums arg,SchemaConfigur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumWithTrueDoesNotMatch11BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index f4249e42cde..3822c82493e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -79,7 +79,7 @@ public static Foo getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,7 +90,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringFooEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringFooEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @@ -102,11 +102,11 @@ public String validate(StringFooEnums arg,SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public FooBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -168,7 +168,7 @@ public static Bar getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -179,7 +179,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringBarEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringBarEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @@ -191,11 +191,11 @@ public String validate(StringBarEnums arg,SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public BarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -220,14 +220,14 @@ protected EnumsInPropertiesMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static EnumsInPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static EnumsInPropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return EnumsInProperties1.getInstance().validate(arg, configuration); } public String bar() { @Nullable Object value = get("bar"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for bar"); + throw new InvalidTypeException("Invalid value stored for bar"); } return (String) value; } @@ -237,7 +237,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for foo"); + throw new InvalidTypeException("Invalid value stored for foo"); } return (String) value; } @@ -369,7 +369,7 @@ public EnumsInPropertiesMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -377,7 +377,7 @@ public EnumsInPropertiesMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -406,11 +406,11 @@ public EnumsInPropertiesMap validate(Map arg, SchemaConfiguration configur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public EnumsInProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index 91ba47899c1..75ee6ca186a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -59,7 +59,7 @@ protected ForbiddenPropertyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static ForbiddenPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ForbiddenPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ForbiddenProperty1.getInstance().validate(arg, configuration); } @@ -266,19 +266,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -294,15 +294,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -315,7 +315,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -326,7 +326,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -342,7 +342,7 @@ public ForbiddenPropertyMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -350,7 +350,7 @@ public ForbiddenPropertyMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -390,7 +390,7 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -405,7 +405,7 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ForbiddenProperty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index ef8f7abd410..da84ef4c6ed 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public HostnameFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java index 4d4a898835b..e473cb0c78d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java @@ -63,7 +63,7 @@ public static InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1 getInstanc } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -73,19 +73,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -97,11 +97,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index c173a66a3ae..bcb1f0ca8e1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -72,7 +72,7 @@ public static Bar getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,13 +90,13 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws InvalidTypeException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } @@ -123,7 +123,7 @@ protected InvalidStringValueForDefaultMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "bar" ); - public static InvalidStringValueForDefaultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static InvalidStringValueForDefaultMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return InvalidStringValueForDefault1.getInstance().validate(arg, configuration); } @@ -132,7 +132,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for bar"); + throw new InvalidTypeException("Invalid value stored for bar"); } return (String) value; } @@ -288,19 +288,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -316,15 +316,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -337,7 +337,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -348,7 +348,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -364,7 +364,7 @@ public InvalidStringValueForDefaultMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -372,7 +372,7 @@ public InvalidStringValueForDefaultMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -412,7 +412,7 @@ public InvalidStringValueForDefaultMap validate(Map arg, SchemaConfigurati throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -427,7 +427,7 @@ public InvalidStringValueForDefaultMap validate(Map arg, SchemaConfigurati } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public InvalidStringValueForDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index 2e41d768129..9db27444b5d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Ipv4Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index 44bb1ad124c..f52011acf83 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Ipv6Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index be1979a67e9..fce4b261f1d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public JsonPointerFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index c7f2c5a8e50..ff2f9aec232 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MaximumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index 7526a6c6aba..9f2eefdd7cd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MaximumValidationWithUnsignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index ecc731f4c5b..dfbadbb5e68 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MaxitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index 7b9aa8b0ab2..02d41b936b7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MaxlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index f68ad0814ad..c71474bd82f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Maxproperties0MeansTheObjectIsEmpty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 921938fc2ea..5386164471a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MaxpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index 95951f93bef..29325be0f63 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MinimumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 6505e110b19..531298768ff 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MinimumValidationWithSignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index 96d61a607a9..13a669101d6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MinitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index 036f3fcbc84..835bdc24f37 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MinlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index 9b3a02c1d92..1802917d267 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public MinpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index 3402fe153be..b7648383ba2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -148,19 +148,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -176,15 +176,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -197,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -208,7 +208,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +232,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -272,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,7 +287,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -441,19 +441,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -469,15 +469,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -490,7 +490,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -501,7 +501,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -517,7 +517,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -565,7 +565,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,7 +580,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NestedAllofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index 6b7545a33c8..7709bbbf75c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -148,19 +148,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -176,15 +176,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -197,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -208,7 +208,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +232,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -272,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,7 +287,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -441,19 +441,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -469,15 +469,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -490,7 +490,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -501,7 +501,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -517,7 +517,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -565,7 +565,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,7 +580,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NestedAnyofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index 72122316653..9e6928c1b4c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -38,7 +38,7 @@ public static class ItemsList extends FrozenList { protected ItemsList(FrozenList m) { super(m); } - public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { return Items2.getInstance().validate(arg, configuration); } } @@ -120,12 +120,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -134,7 +134,7 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche return new ItemsList(newInstanceItems); } - public ItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,11 +152,11 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Items2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -175,7 +175,7 @@ public static class ItemsList1 extends FrozenList { protected ItemsList1(FrozenList m) { super(m); } - public static ItemsList1 of(List> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ItemsList1 of(List> arg, SchemaConfiguration configuration) throws ValidationException { return Items1.getInstance().validate(arg, configuration); } } @@ -242,12 +242,12 @@ public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((ItemsList) itemInstance); i += 1; @@ -256,7 +256,7 @@ public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSch return new ItemsList1(newInstanceItems); } - public ItemsList1 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ItemsList1 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -274,11 +274,11 @@ public ItemsList1 validate(List arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -297,7 +297,7 @@ public static class ItemsList2 extends FrozenList { protected ItemsList2(FrozenList m) { super(m); } - public static ItemsList2 of(List>> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ItemsList2 of(List>> arg, SchemaConfiguration configuration) throws ValidationException { return Items.getInstance().validate(arg, configuration); } } @@ -364,12 +364,12 @@ public ItemsList2 getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList1)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((ItemsList1) itemInstance); i += 1; @@ -378,7 +378,7 @@ public ItemsList2 getNewInstance(List arg, List pathToItem, PathToSch return new ItemsList2(newInstanceItems); } - public ItemsList2 validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ItemsList2 validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -396,11 +396,11 @@ public ItemsList2 validate(List arg, SchemaConfiguration configuration) throw throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -419,7 +419,7 @@ public static class NestedItemsList extends FrozenList { protected NestedItemsList(FrozenList m) { super(m); } - public static NestedItemsList of(List>>> arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static NestedItemsList of(List>>> arg, SchemaConfiguration configuration) throws ValidationException { return NestedItems1.getInstance().validate(arg, configuration); } } @@ -492,12 +492,12 @@ public NestedItemsList getNewInstance(List arg, List pathToItem, Path itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList2)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((ItemsList2) itemInstance); i += 1; @@ -506,7 +506,7 @@ public NestedItemsList getNewInstance(List arg, List pathToItem, Path return new NestedItemsList(newInstanceItems); } - public NestedItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public NestedItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -524,11 +524,11 @@ public NestedItemsList validate(List arg, SchemaConfiguration configuration) throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NestedItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index 7de97629ae1..e75084fe04d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -148,19 +148,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -176,15 +176,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -197,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -208,7 +208,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +232,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -272,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,7 +287,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -441,19 +441,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -469,15 +469,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -490,7 +490,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -501,7 +501,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -517,7 +517,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -565,7 +565,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,7 +580,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NestedOneofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index fa609f4724a..98514e1cbff 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -152,19 +152,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -180,15 +180,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -201,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -212,7 +212,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -276,7 +276,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Not1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index 55f4dc27279..0e92dc9eac8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -57,7 +57,7 @@ protected NotMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static NotMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static NotMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Not.getInstance().validate(arg, configuration); } @@ -66,7 +66,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for foo"); + throw new InvalidTypeException("Invalid value stored for foo"); } return (String) value; } @@ -151,7 +151,7 @@ public NotMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -159,7 +159,7 @@ public NotMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -188,11 +188,11 @@ public NotMap validate(Map arg, SchemaConfiguration configuration) throws throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NotBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -313,19 +313,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -341,15 +341,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -362,7 +362,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -373,7 +373,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -389,7 +389,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -397,7 +397,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -437,7 +437,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -452,7 +452,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NotMoreComplexSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java index ca9182d5ba5..cccbac4a8ff 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java @@ -75,7 +75,7 @@ public static NulCharactersInStrings1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,7 +86,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public String validate(StringNulCharactersInStringsEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public String validate(StringNulCharactersInStringsEnums arg,SchemaConfiguration configuration) throws ValidationException { return validate(arg.value(), configuration); } @@ -98,11 +98,11 @@ public String validate(StringNulCharactersInStringsEnums arg,SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public NulCharactersInStrings1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index a4a8c741d46..01f7f868c52 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -70,7 +70,7 @@ protected ObjectPropertiesValidationMap(FrozenMap<@Nullable Object> m) { "foo", "bar" ); - public static ObjectPropertiesValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectPropertiesValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectPropertiesValidation1.getInstance().validate(arg, configuration); } @@ -79,7 +79,7 @@ public Number foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for foo"); + throw new InvalidTypeException("Invalid value stored for foo"); } return (Number) value; } @@ -89,7 +89,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for bar"); + throw new InvalidTypeException("Invalid value stored for bar"); } return (String) value; } @@ -279,19 +279,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -307,15 +307,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -328,7 +328,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -339,7 +339,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -355,7 +355,7 @@ public ObjectPropertiesValidationMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -363,7 +363,7 @@ public ObjectPropertiesValidationMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -403,7 +403,7 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -418,7 +418,7 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public ObjectPropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index edecb920633..86951cf5e63 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -146,19 +146,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -174,15 +174,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -195,7 +195,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -206,7 +206,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -222,7 +222,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,7 +230,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -270,7 +270,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -285,7 +285,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -440,19 +440,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -468,15 +468,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -489,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -500,7 +500,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -516,7 +516,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -524,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -564,7 +564,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -579,7 +579,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Oneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index 142c5352ac3..ee1966faee0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -58,14 +58,14 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { "bar" ); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema0.getInstance().validate(arg, configuration); } public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for bar"); + throw new InvalidTypeException("Invalid value stored for bar"); } return (Number) value; } @@ -246,19 +246,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -274,15 +274,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -295,7 +295,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -322,7 +322,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +330,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -370,7 +370,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,7 +385,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -451,14 +451,14 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for foo"); + throw new InvalidTypeException("Invalid value stored for foo"); } return (String) value; } @@ -621,19 +621,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -649,15 +649,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -670,7 +670,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -681,7 +681,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -697,7 +697,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +705,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -745,7 +745,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,7 +760,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -915,19 +915,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -943,15 +943,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -964,7 +964,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -975,7 +975,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -991,7 +991,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +999,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1039,7 +1039,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,7 +1054,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OneofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index 498c42e870d..e9d3f27028e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -134,19 +134,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -162,15 +162,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -183,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -194,7 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -210,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -258,7 +258,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,7 +273,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -419,19 +419,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -447,15 +447,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -468,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -479,7 +479,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -495,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -543,7 +543,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,7 +558,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -647,7 +647,7 @@ public static OneofWithBaseSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -665,11 +665,11 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OneofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index 55451f8710c..96c4c68034b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -167,19 +167,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -195,15 +195,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -291,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OneofWithEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index cc46195ec67..b62dc7bf97e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -45,24 +45,16 @@ protected Schema0Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema0Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema0.getInstance().validate(arg, configuration); } public @Nullable Object bar() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("bar"); } public @Nullable Object foo() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("foo"); } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -358,19 +350,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -386,15 +378,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -407,7 +399,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -418,7 +410,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -434,7 +426,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -442,7 +434,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -482,7 +474,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -497,7 +489,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -553,24 +545,16 @@ protected Schema1Map(FrozenMap<@Nullable Object> m) { "foo" ); public static final Set optionalKeys = Set.of(); - public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static Schema1Map of(Map arg, SchemaConfiguration configuration) throws ValidationException { return Schema1.getInstance().validate(arg, configuration); } public @Nullable Object baz() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("baz"); } public @Nullable Object foo() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("foo"); } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -866,19 +850,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -894,15 +878,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -915,7 +899,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -926,7 +910,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -942,7 +926,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -950,7 +934,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -990,7 +974,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1005,7 +989,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -1095,7 +1079,7 @@ public static OneofWithRequired1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1103,7 +1087,7 @@ public static OneofWithRequired1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1132,11 +1116,11 @@ public static OneofWithRequired1 getInstance() { throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public OneofWithRequired1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index 2cef4137dea..49d4017ae06 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -143,19 +143,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -171,15 +171,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -192,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -203,7 +203,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -219,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -267,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PatternIsNotAnchored1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index e55c2ae533f..7e0ffabd596 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -143,19 +143,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -171,15 +171,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -192,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -203,7 +203,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -219,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -267,7 +267,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PatternValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index 5b9c6730970..6e99b7bfe97 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -117,7 +117,7 @@ protected PropertiesWithEscapedCharactersMap(FrozenMap<@Nullable Object> m) { "foo\tbar", "foo\fbar" ); - public static PropertiesWithEscapedCharactersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PropertiesWithEscapedCharactersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PropertiesWithEscapedCharacters1.getInstance().validate(arg, configuration); } @@ -460,19 +460,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -488,15 +488,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -509,7 +509,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -520,7 +520,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -536,7 +536,7 @@ public PropertiesWithEscapedCharactersMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -544,7 +544,7 @@ public PropertiesWithEscapedCharactersMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -584,7 +584,7 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfigur throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -599,7 +599,7 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfigur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PropertiesWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index bd38cb5ac49..070d7d5977f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -57,7 +57,7 @@ protected PropertyNamedRefThatIsNotAReferenceMap(FrozenMap<@Nullable Object> m) public static final Set optionalKeys = Set.of( "$ref" ); - public static PropertyNamedRefThatIsNotAReferenceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static PropertyNamedRefThatIsNotAReferenceMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PropertyNamedRefThatIsNotAReference1.getInstance().validate(arg, configuration); } @@ -212,19 +212,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -240,15 +240,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -261,7 +261,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -272,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -288,7 +288,7 @@ public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -296,7 +296,7 @@ public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -336,7 +336,7 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConf throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -351,7 +351,7 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConf } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public PropertyNamedRefThatIsNotAReference1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java index 6135d033ee5..efa1e208ac7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java @@ -33,7 +33,7 @@ protected RefInAdditionalpropertiesMap(FrozenMap<@Nullable Object> m) { } public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); - public static RefInAdditionalpropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static RefInAdditionalpropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return RefInAdditionalproperties1.getInstance().validate(arg, configuration); } @@ -172,7 +172,7 @@ public RefInAdditionalpropertiesMap getNewInstance(Map arg, List p for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -180,12 +180,12 @@ public RefInAdditionalpropertiesMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } 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"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable Object) propertyInstance); } @@ -212,11 +212,11 @@ public RefInAdditionalpropertiesMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInAdditionalproperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index 6dc12e4b003..a826571f87c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -142,19 +142,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -170,15 +170,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -191,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -202,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -266,7 +266,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,7 +281,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInAllof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index 748f35a4932..c77c290df32 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -142,19 +142,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -170,15 +170,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -191,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -202,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -266,7 +266,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,7 +281,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInAnyof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java index 7af0444f567..ca25ea6cd5d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java @@ -27,7 +27,7 @@ public static class RefInItemsList extends FrozenList<@Nullable Object> { protected RefInItemsList(FrozenList<@Nullable Object> m) { super(m); } - public static RefInItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static RefInItemsList of(List arg, SchemaConfiguration configuration) throws ValidationException { return RefInItems1.getInstance().validate(arg, configuration); } } @@ -140,12 +140,12 @@ public RefInItemsList getNewInstance(List arg, List pathToItem, PathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Object)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((@Nullable Object) itemInstance); i += 1; @@ -154,7 +154,7 @@ public RefInItemsList getNewInstance(List arg, List pathToItem, PathT return new RefInItemsList(newInstanceItems); } - public RefInItemsList validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public RefInItemsList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,11 +172,11 @@ public RefInItemsList validate(List arg, SchemaConfiguration configuration) t throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index 8b9510b9002..069ea431cda 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInNot1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index 3183ec6f20f..16dfea00c74 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -142,19 +142,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -170,15 +170,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -191,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -202,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -266,7 +266,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,7 +281,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInOneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index 23a015c9ba5..d6ed9d63722 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -45,7 +45,7 @@ protected RefInPropertyMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "a" ); - public static RefInPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static RefInPropertyMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return RefInProperty1.getInstance().validate(arg, configuration); } @@ -54,7 +54,7 @@ public static RefInPropertyMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new RuntimeException("Invalid value stored for a"); + throw new InvalidTypeException("Invalid value stored for a"); } return (@Nullable Object) value; } @@ -258,19 +258,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -286,15 +286,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -307,7 +307,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -318,7 +318,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -334,7 +334,7 @@ public RefInPropertyMap getNewInstance(Map arg, List pathToItem, P for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -342,7 +342,7 @@ public RefInPropertyMap getNewInstance(Map arg, List pathToItem, P Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -382,7 +382,7 @@ public RefInPropertyMap validate(Map arg, SchemaConfiguration configuratio throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -397,7 +397,7 @@ public RefInPropertyMap validate(Map arg, SchemaConfiguration configuratio } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RefInProperty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index 85482519567..8be0cb10a2a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -57,7 +57,7 @@ protected RequiredDefaultValidationMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static RequiredDefaultValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static RequiredDefaultValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return RequiredDefaultValidation1.getInstance().validate(arg, configuration); } @@ -264,19 +264,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -292,15 +292,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -313,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -324,7 +324,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -340,7 +340,7 @@ public RequiredDefaultValidationMap getNewInstance(Map arg, List p for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -348,7 +348,7 @@ public RequiredDefaultValidationMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -388,7 +388,7 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -403,7 +403,7 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RequiredDefaultValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index d08e1cad6f5..aeaff53e4dd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -70,16 +70,12 @@ protected RequiredValidationMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "bar" ); - public static RequiredValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static RequiredValidationMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return RequiredValidation1.getInstance().validate(arg, configuration); } public @Nullable Object foo() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("foo"); } public @Nullable Object bar() throws UnsetPropertyException { @@ -362,19 +358,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -390,15 +386,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -411,7 +407,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -422,7 +418,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -438,7 +434,7 @@ public RequiredValidationMap getNewInstance(Map arg, List pathToIt for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -446,7 +442,7 @@ public RequiredValidationMap getNewInstance(Map arg, List pathToIt Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -486,7 +482,7 @@ public RequiredValidationMap validate(Map arg, SchemaConfiguration configu throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -501,7 +497,7 @@ public RequiredValidationMap validate(Map arg, SchemaConfiguration configu } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RequiredValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index e94a741e97e..8f3fb5dbb03 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -57,7 +57,7 @@ protected RequiredWithEmptyArrayMap(FrozenMap<@Nullable Object> m) { public static final Set optionalKeys = Set.of( "foo" ); - public static RequiredWithEmptyArrayMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static RequiredWithEmptyArrayMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return RequiredWithEmptyArray1.getInstance().validate(arg, configuration); } @@ -264,19 +264,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -292,15 +292,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -313,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -324,7 +324,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -340,7 +340,7 @@ public RequiredWithEmptyArrayMap getNewInstance(Map arg, List path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -348,7 +348,7 @@ public RequiredWithEmptyArrayMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -388,7 +388,7 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration con throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -403,7 +403,7 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RequiredWithEmptyArray1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index 1aa3ccfe301..4b8b674d256 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -49,7 +49,7 @@ protected RequiredWithEscapedCharactersMap(FrozenMap<@Nullable Object> m) { "foo\\bar" ); public static final Set optionalKeys = Set.of(); - public static RequiredWithEscapedCharactersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static RequiredWithEscapedCharactersMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return RequiredWithEscapedCharacters1.getInstance().validate(arg, configuration); } @@ -1760,19 +1760,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -1788,15 +1788,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -1809,7 +1809,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1820,7 +1820,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1836,7 +1836,7 @@ public RequiredWithEscapedCharactersMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1844,7 +1844,7 @@ public RequiredWithEscapedCharactersMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1884,7 +1884,7 @@ public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfigurat throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1899,7 +1899,7 @@ public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfigurat } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public RequiredWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java index 8db19def288..9234455603c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java @@ -131,7 +131,7 @@ public static SimpleEnumValidation1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,39 +141,39 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public int validate(IntegerSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public int validate(IntegerSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg.value(), configuration); } @Override - public long validate(LongSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public long validate(LongSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg.value(), configuration); } @Override - public float validate(FloatSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public float validate(FloatSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg.value(), configuration); } @Override - public double validate(DoubleSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public double validate(DoubleSimpleEnumValidationEnums arg,SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg.value(), configuration); } @@ -185,11 +185,11 @@ public double validate(DoubleSimpleEnumValidationEnums arg,SchemaConfiguration c throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public SimpleEnumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java index 33bb250f4b0..e730c2690f0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java @@ -67,7 +67,7 @@ public static Alpha getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -77,19 +77,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -101,11 +101,11 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public AlphaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { @@ -128,7 +128,7 @@ protected TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap(FrozenMap< public static final Set optionalKeys = Set.of( "alpha" ); - public static TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance().validate(arg, configuration); } @@ -137,7 +137,7 @@ public Number alpha() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for alpha"); + throw new InvalidTypeException("Invalid value stored for alpha"); } return (Number) value; } @@ -246,7 +246,7 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstanc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -254,7 +254,7 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstanc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -283,11 +283,11 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap validate(Map< throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index d4561044119..4399cec94a9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UniqueitemsFalseValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index f4fe001c795..2433913da51 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UniqueitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index adb11efefbb..bc2d00b8518 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UriFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index cbff063863a..bee6021f6cf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UriReferenceFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index 92042ca34fb..16dead22e86 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -140,19 +140,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -168,15 +168,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return castArg; } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -189,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -200,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return newInstanceItems; } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,7 +279,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override public UriTemplateFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index 90fa50e06e4..10f995aadef 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -12,62 +12,41 @@ public class ApiConfiguration { private final ServerInfo serverInfo; - private final ServerIndexInfo serverIndexInfo; private final @Nullable Duration timeout; public ApiConfiguration() { serverInfo = new ServerInfo(); - serverIndexInfo = new ServerIndexInfo(); timeout = null; } - public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, Duration timeout) { + public ApiConfiguration(ServerInfo serverInfo, Duration timeout) { this.serverInfo = serverInfo; - this.serverIndexInfo = serverIndexInfo; this.timeout = timeout; } public static class ServerInfo { - protected final RootServerInfo.RootServerInfo1 rootServerInfo; + protected final RootServerInfo rootServerInfo; public ServerInfo() { - rootServerInfo = new RootServerInfo.RootServerInfo1(); + rootServerInfo = new RootServerInfo(); } public ServerInfo( - RootServerInfo. @Nullable RootServerInfo1 rootServerInfo + @Nullable RootServerInfo rootServerInfo ) { - this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo.RootServerInfo1::new); - } - } - - public static class ServerIndexInfo { - protected RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex; - public ServerIndexInfo() {} - - public ServerIndexInfo rootServerInfoServerIndex(RootServerInfo.ServerIndex serverIndex) { - this.rootServerInfoServerIndex = serverIndex; - return this; + this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo::new); } } public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { - var serverProvider = serverInfo.rootServerInfo; - if (serverIndex == null) { - RootServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.rootServerInfoServerIndex; - if (configServerIndex == null) { - throw new RuntimeException("rootServerInfoServerIndex is unset"); - } - return serverProvider.getServer(configServerIndex); - } - return serverProvider.getServer(serverIndex); + return serverInfo.rootServerInfo.getServer(serverIndex); } public Map> getDefaultHeaders() { return new HashMap<>(); } - public @Nullable Duration getTimeout() { + public@Nullable Duration getTimeout() { return timeout; } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java index 268e9373289..3bea6999da1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.exceptions; @SuppressWarnings("serial") -public class BaseException extends Exception { +public class BaseException extends RuntimeException { public BaseException(String s) { super(s); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java index 13c8f50bcc9..2b09f2f77df 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -5,9 +5,6 @@ import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.parameter.ParameterStyle; @@ -31,7 +28,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { for (Map.Entry> entry: content.entrySet()) { var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; String contentType = entry.getKey(); @@ -39,14 +36,14 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid var value = ContentTypeSerializer.toJson(castInData); return toHeaders(name, value); } else { - throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); + throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); } } throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) { String inDataJoined = String.join(",", inData); // unsure if this is needed @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); if (validate) { @@ -55,7 +52,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid if (ContentTypeDetector.contentTypeIsJson(contentType)) { return entry.getValue().schema().validate(deserializedJson, configuration); } else { - throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); + throw new RuntimeException("Header deserialization of "+contentType+" has not yet been implemented"); } } throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java index 89728acfb77..ac9f6274b0d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java @@ -2,14 +2,11 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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, InvalidTypeException; - @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException; + HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration); + @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration); } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java index fac752561ed..7bac0c8a6be 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java @@ -1,24 +1,26 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.HashMap; +import java.util.AbstractMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; -import java.util.TreeMap; import java.util.stream.Collectors; +import static java.util.stream.Collectors.toList; +import static java.util.stream.Collectors.toMap; + 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 { + private static String percentEncode(String s) { if (s == null) { return ""; } @@ -29,11 +31,11 @@ private static String percentEncode(String s) throws NotImplementedException { .replace("%7E", "~"); // This could be done faster with more hand-crafted code. } catch (UnsupportedEncodingException wow) { - throw new NotImplementedException(wow.getMessage()); + throw new RuntimeException(wow.getMessage(), wow); } } - private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) throws NotImplementedException { + private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) { /* 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= @@ -60,7 +62,7 @@ private static String percentEncode(String s) throws NotImplementedException { // 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); + throw new InvalidTypeException("Unable to generate a rfc6570 item representation of "+item); } private static String rfc6570StrNumberExpansion( @@ -69,7 +71,7 @@ private static String rfc6570StrNumberExpansion( 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; @@ -85,15 +87,11 @@ private static String rfc6570ListExpansion( 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); - } + ) { + var itemValues = inData.stream() + .map(v -> rfc6570ItemValue(v, percentEncode)) + .filter(Objects::nonNull) + .collect(toList()); if (itemValues.isEmpty()) { // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 return ""; @@ -118,19 +116,12 @@ private static String rfc6570MapExpansion( 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); - } + ) { + var inDataMap = inData.entrySet().stream() + .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), rfc6570ItemValue(entry.getValue(), percentEncode))) + .filter(entry -> entry.getValue() != null) + .collect(toMap(Map.Entry::getKey, Map.Entry::getValue, (x, y) -> y, LinkedHashMap::new)); + if (inDataMap.isEmpty()) { // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 return ""; @@ -152,7 +143,7 @@ protected static String rfc6570Expansion( boolean explode, boolean percentEncode, PrefixSeparatorIterator prefixSeparatorIterator - ) throws NotImplementedException { + ) { /* Separator is for separate variables like dict with explode true, not for array item separation @@ -190,6 +181,6 @@ protected static String rfc6570Expansion( ); } // bool, bytes, etc - throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); + throw new InvalidTypeException("Unable to generate a rfc6570 representation of "+inData); } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java index b253262dc13..e4fcfd99924 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java @@ -3,9 +3,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.parameter.ParameterStyle; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; @@ -33,7 +30,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException, InvalidTypeException { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { var castInData = validate ? schema.validate(inData, configuration) : inData; boolean usedExplode = explode != null && explode; var value = StyleSerializer.serializeSimple(castInData, name, usedExplode, false); @@ -52,7 +49,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid 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 { + private List<@Nullable Object> getList(JsonSchema schema, List inData) { Class> itemsSchemaCls = schema.items == null ? UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.class : schema.items; JsonSchema itemSchema = JsonSchemaFactory.getInstance(itemsSchemaCls); List<@Nullable Object> castList = new ArrayList<>(); @@ -63,7 +60,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return castList; } - private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { + private @Nullable Object getCastInData(JsonSchema schema, List inData) { if (schema.type == null) { if (inData.size() == 1) { return inData.get(0); @@ -71,7 +68,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid 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"); + throw new RuntimeException("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) { @@ -79,16 +76,16 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid } 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"); + throw new RuntimeException("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"); + throw new RuntimeException("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, InvalidTypeException { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) { @Nullable Object castInData = getCastInData(schema, inData); if (validate) { return schema.validate(castInData, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java index f5fa5a0a75b..d18be288684 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; public class StyleSerializer extends Rfc6570Serializer { public static String serializeSimple( @@ -9,7 +8,7 @@ public static String serializeSimple( String name, boolean explode, boolean percentEncode - ) throws NotImplementedException { + ) { var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); return rfc6570Expansion( name, @@ -25,7 +24,7 @@ public static String serializeForm( String name, boolean explode, boolean percentEncode - ) throws NotImplementedException { + ) { // todo check that the prefix and suffix matches this one PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); return rfc6570Expansion( @@ -41,7 +40,7 @@ public static String serializeMatrix( @Nullable Object inData, String name, boolean explode - ) throws NotImplementedException { + ) { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); return rfc6570Expansion( name, @@ -56,7 +55,7 @@ public static String serializeLabel( @Nullable Object inData, String name, boolean explode - ) throws NotImplementedException { + ) { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); return rfc6570Expansion( name, @@ -71,7 +70,7 @@ public static String serializeSpaceDelimited( @Nullable Object inData, String name, boolean explode - ) throws NotImplementedException { + ) { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); return rfc6570Expansion( name, @@ -86,7 +85,7 @@ public static String serializePipeDelimited( @Nullable Object inData, String name, boolean explode - ) throws NotImplementedException { + ) { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); return rfc6570Expansion( name, diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java index 431fa2c90da..79a3e781051 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java @@ -3,8 +3,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import org.openapijsonschematools.client.mediatype.MediaType; import java.util.Map; @@ -19,16 +17,16 @@ public ContentParameter(String name, ParameterInType inType, boolean required, @ } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { for (Map.Entry> entry: content.entrySet()) { String contentType = entry.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"); + throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); } } - throw new OpenapiDocumentException("Invalid value for content, it was empty and must have 1 key value pair"); + throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java index 4b8ff010aed..b04b2ca1754 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java @@ -1,8 +1,6 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -15,7 +13,7 @@ protected CookieSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { + public String serialize(Map inData) { String result = ""; Map sortedData = new TreeMap<>(inData); for (Map.Entry entry: sortedData.entrySet()) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java index b9d6fb008bb..b4a23229944 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java @@ -1,8 +1,6 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.LinkedHashMap; @@ -16,7 +14,7 @@ protected HeadersSerializer(Map parameters) { this.parameters = parameters; } - public Map> serialize(Map inData) throws NotImplementedException, OpenapiDocumentException { + public Map> serialize(Map inData) { Map> results = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java index 2d9c85b603d..9fe0745417c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java @@ -1,11 +1,9 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException, OpenapiDocumentException; + AbstractMap.SimpleEntry serialize(@Nullable Object inData); } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java index 4e1858f88f8..5864f89c901 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java @@ -1,8 +1,6 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.Map; @@ -14,7 +12,7 @@ protected PathSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException, OpenapiDocumentException { + public String serialize(Map inData, String pathWithPlaceholders) { String result = pathWithPlaceholders; for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java index c5f39d81aff..91ea0b041bb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java @@ -1,8 +1,6 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; import java.util.AbstractMap; import java.util.HashMap; @@ -16,7 +14,7 @@ protected QuerySerializer(Map parameters) { this.parameters = parameters; } - public Map getQueryMap(Map inData) throws NotImplementedException, OpenapiDocumentException { + public Map getQueryMap(Map inData) { Map results = new HashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java index eef0b6bc371..8acfdafcc8a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java @@ -2,7 +2,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.header.StyleSerializer; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import java.util.AbstractMap; @@ -27,7 +26,7 @@ private ParameterStyle getStyle() { } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { ParameterStyle usedStyle = getStyle(); boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; String value; @@ -53,7 +52,7 @@ public AbstractMap.SimpleEntry serialize(@Nullable Object inData } else { // usedStyle == ParameterStyle.DEEP_OBJECT // query - throw new NotImplementedException("Style deep object serialization has not yet been implemented."); + throw new RuntimeException("Style deep object serialization has not yet been implemented."); } return new AbstractMap.SimpleEntry<>(name, value); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java index 6be6cbffd80..37fb90cd4f2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.Map; @@ -34,14 +33,14 @@ private SerializedRequestBody serializeTextPlain(String contentType, @Nullable O 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 { + protected SerializedRequestBody serialize(String contentType, @Nullable Object body) { 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"); + throw new RuntimeException("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; + public abstract SerializedRequestBody serialize(T requestBody); } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java index d0eeaaa566d..bbd744abebc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java @@ -2,9 +2,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.header.Header; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; @@ -21,7 +18,7 @@ public HeadersDeserializer(Map headers, MapSchemaValidator headersToValidate = new HashMap<>(); for (Map.Entry> entry: responseHeaders.map().entrySet()) { String headerName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java index 17b0895e57c..59079f9f1a1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java @@ -7,28 +7,31 @@ import java.util.Optional; import org.checkerframework.checker.nullness.qual.Nullable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.ToNumberPolicy; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.header.Header; public abstract class ResponseDeserializer { public final Map content; public final @Nullable Map headers; + private static final Gson gson = new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create(); public ResponseDeserializer(Map content) { this.content = content; this.headers = null; } - protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException; - protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException; + protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration); + protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration); protected @Nullable Object deserializeJson(byte[] body) { String bodyStr = new String(body, StandardCharsets.UTF_8); @@ -39,7 +42,7 @@ protected String deserializeTextPlain(byte[] body) { return new String(body, StandardCharsets.UTF_8); } - protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException, NotImplementedException { + protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) { if (ContentTypeDetector.contentTypeIsJson(contentType)) { @Nullable Object bodyData = deserializeJson(body); return schema.validateAndBox(bodyData, configuration); @@ -47,17 +50,17 @@ protected T deserializeBody(String contentType, byte[] body, JsonSchema s String bodyData = deserializeTextPlain(body); return schema.validateAndBox(bodyData, configuration); } - throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); + throw new RuntimeException("Deserialization for contentType="+contentType+" has not yet been implemented."); } - public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { - throw new OpenapiDocumentException("Invalid response returned, Content-Type header is missing and it must be included"); + throw new RuntimeException("Invalid response returned, Content-Type header is missing and it must be included"); } String contentType = contentTypeInfo.get(); if (content != null && !content.containsKey(contentType)) { - throw new OpenapiDocumentException( + throw new RuntimeException( "Invalid contentType returned. contentType="+contentType+" was returned "+ "when only "+content.keySet()+" are defined for statusCode="+response.statusCode() ); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java index 26204003e31..20b56db17da 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java @@ -2,12 +2,7 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import java.net.http.HttpResponse; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws OpenapiDocumentException, InvalidTypeException, ValidationException, NotImplementedException, ApiException; + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration); } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index 6bc6fe04985..0ffcae114bd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -121,19 +121,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -149,15 +149,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -170,7 +170,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -197,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -205,7 +205,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -241,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java index a5e697bc7e1..2cceae9d49f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java @@ -60,7 +60,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index bc63f4a4bcb..15b5ca67f26 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -57,7 +57,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -66,7 +66,7 @@ public String validate(LocalDate arg, SchemaConfiguration configuration) throws if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java index 04afec44e81..e695f3c2ac9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java @@ -57,7 +57,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -66,7 +66,7 @@ public String validate(ZonedDateTime arg, SchemaConfiguration configuration) thr if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java index 053ed1d9194..f961e94f802 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java @@ -61,7 +61,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java index 30409a5bfa0..56f7894f670 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java @@ -56,7 +56,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -65,7 +65,7 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java index b06048101bd..65221627b46 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java @@ -56,7 +56,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } @@ -65,7 +65,7 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java index 0007819ca43..836fa1db724 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java @@ -59,11 +59,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @@ -72,7 +72,7 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java index ab1735795d1..da3f9d8d5f7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java @@ -61,19 +61,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -82,7 +82,7 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java index 16a442386f2..6205c5b4380 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java @@ -61,19 +61,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -82,7 +82,7 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index 0f6e5062fae..7ebb3106467 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -56,7 +56,7 @@ public static ListJsonSchema1 getInstance() { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -82,7 +82,7 @@ public static ListJsonSchema1 getInstance() { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index e397fcadc47..47e141dac53 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -54,7 +54,7 @@ public static MapJsonSchema1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -62,7 +62,7 @@ public static MapJsonSchema1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -86,7 +86,7 @@ public static MapJsonSchema1 getInstance() { if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index 1135409baef..de1ed91b0cd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -123,19 +123,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -151,15 +151,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -172,7 +172,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -199,7 +199,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -207,7 +207,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -243,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java index 483996081d7..d028dbf295e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java @@ -60,7 +60,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java index d5650985076..5c33b047d95 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java @@ -60,19 +60,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -81,7 +81,7 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java index d200689b1f5..749f5faba63 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java @@ -57,15 +57,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -74,7 +74,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java index 85b94ee2403..c2087929db7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java @@ -57,7 +57,7 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -66,7 +66,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java index b7afc854c15..64d9f476798 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java @@ -1,7 +1,5 @@ package org.openapijsonschematools.client.schemas.validation; - import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -13,7 +11,7 @@ public class AdditionalPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java index 4b969c68a20..eb6bcf21d4a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java @@ -1,13 +1,11 @@ package org.openapijsonschematools.client.schemas.validation; - import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; public class AllOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var allOf = data.schema().allOf; if (allOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java index 19d4e0337c9..d466518d3fe 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java @@ -10,7 +10,7 @@ public class AnyOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var anyOf = data.schema().anyOf; if (anyOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java index 639d32e889e..cb28fcb9662 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java @@ -5,7 +5,7 @@ import java.math.BigDecimal; public abstract class BigDecimalValidator { - protected BigDecimal getBigDecimal(Number arg) throws ValidationException { + protected BigDecimal getBigDecimal(Number arg) { if (arg instanceof Integer) { return new BigDecimal((Integer) arg); } else if (arg instanceof Long) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java index 93872adcc2f..6409a23e5ca 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java @@ -10,7 +10,7 @@ public class ConstValidator extends BigDecimalValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { if (!data.schema().constValueSet) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java index 41565577d58..fbfd1c9c700 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java @@ -9,7 +9,7 @@ public class ContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { if (!(data.arg() instanceof List)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java index 1a0611f1b8e..43fe8423969 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java @@ -1,7 +1,5 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; - public interface DefaultValueMethod { - T defaultValue() throws InvalidTypeException; + T defaultValue(); } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java index 2640e2f6d8d..77b21ca801d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java @@ -11,7 +11,7 @@ public class DependentRequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java index f51b5eaf339..e329529fe8a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashSet; import java.util.Map; @@ -11,7 +10,7 @@ public class DependentSchemasValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java index 337af4a9a60..3f50d9326c4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java @@ -8,7 +8,7 @@ public class ElseValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var elseSchema = data.schema().elseSchema; if (elseSchema == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java index 66563d80960..8af756619bd 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java @@ -15,7 +15,7 @@ private static boolean enumContainsArg(Set<@Nullable Object> enumValues, @Nullab @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var enumValues = data.schema().enumValues; if (enumValues == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java index e05df98079f..7d05ff65546 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var exclusiveMaximum = data.schema().exclusiveMaximum; if (exclusiveMaximum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java index 0e06f391f62..73eb1e547c3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var exclusiveMinimum = data.schema().exclusiveMinimum; if (exclusiveMinimum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java index 35c089a03c7..c1ca45e44f3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java @@ -18,7 +18,7 @@ public class FormatValidator implements KeywordValidator { private final static BigDecimal doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308d); private final static BigDecimal doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308d); - private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) throws ValidationException { + private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) { if (format.startsWith("int")) { // there is a json schema test where 1.0 validates as an integer BigInteger intArg; @@ -85,7 +85,7 @@ private static void validateNumericFormat(Number arg, ValidationMetadata validat } } - private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { + private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) { switch (format) { case "uuid" -> { try { @@ -133,7 +133,7 @@ private static void validateStringFormat(String arg, ValidationMetadata validati @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var format = data.schema().format; if (format == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java index 2a05893a22a..b145ab8007a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java @@ -7,7 +7,7 @@ public class IfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var ifSchema = data.schema().ifSchema; if (ifSchema == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java index 68d62107337..1b03c0b3094 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +9,7 @@ public class ItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var items = data.schema().items; if (items == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index d6f5cdab7b7..beb7460b86c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -221,7 +221,7 @@ protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { this.keywordToValidator = keywordToValidator; } - public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas); + public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; @@ -262,7 +262,7 @@ private List getContainsPathToSchemas( private PathToSchemasMap getPatternPropertiesPathToSchemas( @Nullable Object arg, ValidationMetadata validationMetadata - ) throws ValidationException { + ) { if (!(arg instanceof Map mapArg) || patternProperties == null) { return new PathToSchemasMap(); } @@ -270,7 +270,7 @@ private PathToSchemasMap getPatternPropertiesPathToSchemas( for (Map.Entry entry: mapArg.entrySet()) { Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new ValidationException("Invalid non-string type for map key"); + throw new InvalidTypeException("Invalid non-string type for map key"); } List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); propPathToItem.add(key); @@ -306,7 +306,7 @@ private PathToSchemasMap getIfPathToSchemas( try { var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException ignored) {} + } catch (ValidationException | InvalidTypeException ignored) {} return pathToSchemas; } @@ -389,7 +389,7 @@ protected Void castToAllowedTypes(Void arg, List pathToItem, Set castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws InvalidTypeException { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); List<@Nullable Object> argFixed = new ArrayList<>(); int i =0; @@ -403,7 +403,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws InvalidTypeException { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @@ -420,7 +420,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set pathToItem, Set> pathSet) throws InvalidTypeException { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { @@ -468,7 +468,7 @@ public String getNewInstance(String arg, List pathToItem, PathToSchemasM return arg; } - protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) throws ValidationException { + protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) { PathToSchemasMap pathToSchemasMap = new PathToSchemasMap(); // todo add check of validationMetadata.validationRanEarlier(this) PathToSchemasMap otherPathToSchemas = validate(jsonSchema, arg, validationMetadata); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index 2ef994a9c9f..d0ff52b29c8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -7,7 +7,7 @@ import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas); OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java index 5633ebe09f9..984693428e8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java @@ -8,7 +8,7 @@ import java.util.Map; public interface MapSchemaValidator { - OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas); OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java index 315771b9e0c..9e9b3b92c18 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java @@ -9,7 +9,7 @@ public class MaxContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var maxContains = data.schema().maxContains; if (maxContains == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java index 2749843cbf2..98ed5cb4ff4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java @@ -9,7 +9,7 @@ public class MaxItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var maxItems = data.schema().maxItems; if (maxItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java index f2a77fa91f6..08d91666c5d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java @@ -7,7 +7,7 @@ public class MaxLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var maxLength = data.schema().maxLength; if (maxLength == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java index 57a53e71be5..d117f1688e2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java @@ -9,7 +9,7 @@ public class MaxPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var maxProperties = data.schema().maxProperties; if (maxProperties == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java index df1c7f5c338..702f09686dc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java @@ -7,7 +7,7 @@ public class MaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var maximum = data.schema().maximum; if (maximum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java index 6ea4404dc1f..1827e95cc83 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java @@ -9,7 +9,7 @@ public class MinContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var minContains = data.schema().minContains; if (minContains == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java index 25bae60bda7..d1933ca7750 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java @@ -9,7 +9,7 @@ public class MinItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var minItems = data.schema().minItems; if (minItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java index f4639e8a207..1defdc891e3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java @@ -7,7 +7,7 @@ public class MinLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var minLength = data.schema().minLength; if (minLength == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java index 011ac76dd31..c0b99e7fb7d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java @@ -9,7 +9,7 @@ public class MinPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var minProperties = data.schema().minProperties; if (minProperties == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java index 76065fe50b5..3b539120e42 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java @@ -7,7 +7,7 @@ public class MinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var minimum = data.schema().minimum; if (minimum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java index d8273d04d9c..eebc07a0f10 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java @@ -9,7 +9,7 @@ public class MultipleOfValidator extends BigDecimalValidator implements KeywordV @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var multipleOf = data.schema().multipleOf; if (multipleOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java index 3e6b8e91e7c..b077e2056a1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java @@ -7,7 +7,7 @@ public class NotValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var not = data.schema().not; if (not == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java index 89924e90d5a..c49fc0150fe 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java @@ -4,6 +4,9 @@ import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; +import java.util.List; +import java.util.Set; + public interface NullSchemaValidator { Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java index 7dd5f4128ac..3c4f4b5a085 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java @@ -10,7 +10,7 @@ public class OneOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var oneOf = data.schema().oneOf; if (oneOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java index d7eebd78098..eceeb19e311 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java @@ -7,7 +7,7 @@ public class PatternValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var pattern = data.schema().pattern; if (pattern == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java index 510f3a8760e..237bc250190 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +9,7 @@ public class PrefixItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var prefixItems = data.schema().prefixItems; if (prefixItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java index 8803b661fd6..b8ddd6fcb46 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -13,7 +12,7 @@ public class PropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var properties = data.schema().properties; if (properties == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java index 0169ff5bdba..087cd308b11 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -11,7 +10,7 @@ public class PropertyNamesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var propertyNames = data.schema().propertyNames; if (propertyNames == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java index 2519cbcfd3b..f2e1a8ecde8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; import java.util.HashSet; import java.util.List; @@ -12,7 +12,7 @@ public class RequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var required = data.schema().required; if (required == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java index 75c083e2edc..bf599bc812f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java @@ -1,13 +1,14 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ThenValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var then = data.schema().then; if (then == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java index 300d472cfdf..bb4133a770e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; import java.util.List; import java.util.Map; @@ -10,7 +10,7 @@ public class TypeValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var type = data.schema().type; if (type == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java index 407904da444..8903d0b19a7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +9,7 @@ public class UnevaluatedItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var unevaluatedItems = data.schema().unevaluatedItems; if (unevaluatedItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java index 8fd34950404..344c0cfab1b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import java.util.ArrayList; import java.util.List; @@ -11,7 +11,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var unevaluatedProperties = data.schema().unevaluatedProperties; if (unevaluatedProperties == null) { return null; @@ -27,7 +27,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { JsonSchema unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties); for(Map.Entry entry: mapArg.entrySet()) { if (!(entry.getKey() instanceof String propName)) { - throw new ValidationException("Map keys must be strings"); + throw new InvalidTypeException("Map keys must be strings"); } List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); propPathToItem.add(propName); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java index 6b40ba79fff..a42a7d60b60 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; import java.util.HashSet; import java.util.List; @@ -11,7 +11,7 @@ public class UniqueItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var uniqueItems = data.schema().uniqueItems; if (uniqueItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index f5604144fe7..1c23a427dd0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -108,19 +108,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -136,15 +136,15 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(LocalDate arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(ZonedDateTime arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } - public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(UUID arg, SchemaConfiguration configuration) throws ValidationException { return validate(arg.toString(), configuration); } @@ -157,7 +157,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -184,7 +184,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -192,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java index f736485870c..8c93a971aae 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java @@ -1,6 +1,8 @@ package org.openapijsonschematools.client.servers; +import org.checkerframework.checker.nullness.qual.Nullable; + public interface ServerProvider { - Server getServer(T serverIndex); + Server getServer(@Nullable T serverIndex); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java index cc0235a41a3..e78afe58438 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java @@ -18,7 +18,7 @@ public class AdditionalpropertiesAllowsASchemaWhichShouldValidateTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNoAdditionalPropertiesIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNoAdditionalPropertiesIsValidPasses() { // no additional properties is valid final var schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testNoAdditionalPropertiesIsValidPasses() throws ValidationException } @Test - public void testAnAdditionalValidPropertyIsValidPasses() throws ValidationException, InvalidTypeException { + public void testAnAdditionalValidPropertyIsValidPasses() { // an additional valid property is valid final var schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java index 2800d7992ff..b279d9037a1 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java @@ -18,7 +18,7 @@ public class AdditionalpropertiesAreAllowedByDefaultTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAdditionalPropertiesAreAllowedPasses() throws ValidationException, InvalidTypeException { + public void testAdditionalPropertiesAreAllowedPasses() { // additional properties are allowed final var schema = AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java index a3cd2406db7..8c8d5a930f8 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java @@ -18,7 +18,7 @@ public class AdditionalpropertiesCanExistByItselfTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnAdditionalValidPropertyIsValidPasses() throws ValidationException, InvalidTypeException { + public void testAnAdditionalValidPropertyIsValidPasses() { // an additional valid property is valid final var schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java index ebcfcc5527b..576f44818fe 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java @@ -42,7 +42,7 @@ public void testPropertiesDefinedInAllofAreNotExaminedFails() { } @Test - public void testValidTestCasePasses() throws ValidationException, InvalidTypeException { + public void testValidTestCasePasses() { // valid test case final var schema = AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java index 6b7bd47958b..e32dd818973 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java @@ -78,7 +78,7 @@ public void testAllofTrueAnyofFalseOneofFalseFails() { } @Test - public void testAllofTrueAnyofTrueOneofTruePasses() throws ValidationException, InvalidTypeException { + public void testAllofTrueAnyofTrueOneofTruePasses() { // allOf: true, anyOf: true, oneOf: true final var schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java index 05d15b05628..6738af4533a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java @@ -33,7 +33,7 @@ public void testMismatchOneFails() { } @Test - public void testValidPasses() throws ValidationException, InvalidTypeException { + public void testValidPasses() { // valid final var schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java index 1bf1c8f7e7a..96ceb9d6354 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java @@ -82,7 +82,7 @@ public void testMismatchFirstFails() { } @Test - public void testAllofPasses() throws ValidationException, InvalidTypeException { + public void testAllofPasses() { // allOf final var schema = Allof.Allof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java index 94426b3db75..8b7da7ba706 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java @@ -66,7 +66,7 @@ public void testMismatchFirstAllofFails() { } @Test - public void testValidPasses() throws ValidationException, InvalidTypeException { + public void testValidPasses() { // valid final var schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java index 14ca1ed4b73..4a51f3f1393 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java @@ -18,7 +18,7 @@ public class AllofWithOneEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnyDataIsValidPasses() throws ValidationException, InvalidTypeException { + public void testAnyDataIsValidPasses() { // any data is valid final var schema = AllofWithOneEmptySchema.AllofWithOneEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java index 761dcdd392b..84351d8fbe9 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java @@ -33,7 +33,7 @@ public void testStringIsInvalidFails() { } @Test - public void testNumberIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNumberIsValidPasses() { // number is valid final var schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java index 2c2bc63ab13..f0a11562d85 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java @@ -33,7 +33,7 @@ public void testStringIsInvalidFails() { } @Test - public void testNumberIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNumberIsValidPasses() { // number is valid final var schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java index 65901743265..b7bcf055a29 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java @@ -18,7 +18,7 @@ public class AllofWithTwoEmptySchemasTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnyDataIsValidPasses() throws ValidationException, InvalidTypeException { + public void testAnyDataIsValidPasses() { // any data is valid final var schema = AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java index 881f4b79548..a931b23d567 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java @@ -18,7 +18,7 @@ public class AnyofComplexTypesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testSecondAnyofValidComplexPasses() throws ValidationException, InvalidTypeException { + public void testSecondAnyofValidComplexPasses() { // second anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testSecondAnyofValidComplexPasses() throws ValidationException, Inva } @Test - public void testBothAnyofValidComplexPasses() throws ValidationException, InvalidTypeException { + public void testBothAnyofValidComplexPasses() { // both anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( @@ -52,7 +52,7 @@ public void testBothAnyofValidComplexPasses() throws ValidationException, Invali } @Test - public void testFirstAnyofValidComplexPasses() throws ValidationException, InvalidTypeException { + public void testFirstAnyofValidComplexPasses() { // first anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java index 3bb76a50524..ef97ff6dff1 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java @@ -18,7 +18,7 @@ public class AnyofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBothAnyofValidPasses() throws ValidationException, InvalidTypeException { + public void testBothAnyofValidPasses() { // both anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testNeitherAnyofValidFails() { } @Test - public void testFirstAnyofValidPasses() throws ValidationException, InvalidTypeException { + public void testFirstAnyofValidPasses() { // first anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testFirstAnyofValidPasses() throws ValidationException, InvalidTypeE } @Test - public void testSecondAnyofValidPasses() throws ValidationException, InvalidTypeException { + public void testSecondAnyofValidPasses() { // second anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java index ae564038996..b75095b0576 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java @@ -33,7 +33,7 @@ public void testMismatchBaseSchemaFails() { } @Test - public void testOneAnyofValidPasses() throws ValidationException, InvalidTypeException { + public void testOneAnyofValidPasses() { // one anyOf valid final var schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java index df1375385f2..8829498ffaa 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java @@ -18,7 +18,7 @@ public class AnyofWithOneEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNumberIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNumberIsValidPasses() { // number is valid final var schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testNumberIsValidPasses() throws ValidationException, InvalidTypeExc } @Test - public void testStringIsValidPasses() throws ValidationException, InvalidTypeException { + public void testStringIsValidPasses() { // string is valid final var schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java index 5c55e234f84..7320de65c06 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java @@ -48,7 +48,7 @@ public void testAFloatIsNotAnArrayFails() { } @Test - public void testAnArrayIsAnArrayPasses() throws ValidationException, InvalidTypeException { + public void testAnArrayIsAnArrayPasses() { // an array is an array final var schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java index e1b339ecb80..28095652c59 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java @@ -48,7 +48,7 @@ public void testAStringIsNotABooleanFails() { } @Test - public void testFalseIsABooleanPasses() throws ValidationException, InvalidTypeException { + public void testFalseIsABooleanPasses() { // false is a boolean final var schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance(); schema.validate( @@ -58,7 +58,7 @@ public void testFalseIsABooleanPasses() throws ValidationException, InvalidTypeE } @Test - public void testTrueIsABooleanPasses() throws ValidationException, InvalidTypeException { + public void testTrueIsABooleanPasses() { // true is a boolean final var schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java index de65e64d650..5238a51609e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java @@ -33,7 +33,7 @@ public void testIntByIntFailFails() { } @Test - public void testIntByIntPasses() throws ValidationException, InvalidTypeException { + public void testIntByIntPasses() { // int by int final var schema = ByInt.ByInt1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testIntByIntPasses() throws ValidationException, InvalidTypeExceptio } @Test - public void testIgnoresNonNumbersPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresNonNumbersPasses() { // ignores non-numbers final var schema = ByInt.ByInt1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java index accbea21a98..c7a9bc144bd 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java @@ -33,7 +33,7 @@ public void test35IsNotMultipleOf15Fails() { } @Test - public void test45IsMultipleOf15Passes() throws ValidationException, InvalidTypeException { + public void test45IsMultipleOf15Passes() { // 4.5 is multiple of 1.5 final var schema = ByNumber.ByNumber1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void test45IsMultipleOf15Passes() throws ValidationException, InvalidType } @Test - public void testZeroIsMultipleOfAnythingPasses() throws ValidationException, InvalidTypeException { + public void testZeroIsMultipleOfAnythingPasses() { // zero is multiple of anything final var schema = ByNumber.ByNumber1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java index ea0e9afbe83..4bbf88c3921 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java @@ -33,7 +33,7 @@ public void test000751IsNotMultipleOf00001Fails() { } @Test - public void test00075IsMultipleOf00001Passes() throws ValidationException, InvalidTypeException { + public void test00075IsMultipleOf00001Passes() { // 0.0075 is multiple of 0.0001 final var schema = BySmallNumber.BySmallNumber1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java index ad2fc557324..a34d0f03faa 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java @@ -18,7 +18,7 @@ public class DateTimeFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreIntegersPasses() { // all string formats ignore integers final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationExceptio } @Test - public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreNullsPasses() { // all string formats ignore nulls final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreObjectsPasses() { // all string formats ignore objects final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException } @Test - public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreFloatsPasses() { // all string formats ignore floats final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreArraysPasses() { // all string formats ignore arrays final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreBooleansPasses() { // all string formats ignore booleans final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java index ad5653fcc9c..e09400e1157 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java @@ -18,7 +18,7 @@ public class EmailFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreIntegersPasses() { // all string formats ignore integers final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationExceptio } @Test - public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreNullsPasses() { // all string formats ignore nulls final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreObjectsPasses() { // all string formats ignore objects final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException } @Test - public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreFloatsPasses() { // all string formats ignore floats final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreArraysPasses() { // all string formats ignore arrays final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreBooleansPasses() { // all string formats ignore booleans final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java index 5a62cd2f344..3a72a8ab282 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java @@ -18,7 +18,7 @@ public class EnumWith0DoesNotMatchFalseTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testFloatZeroIsValidPasses() throws ValidationException, InvalidTypeException { + public void testFloatZeroIsValidPasses() { // float zero is valid final var schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testFalseIsInvalidFails() { } @Test - public void testIntegerZeroIsValidPasses() throws ValidationException, InvalidTypeException { + public void testIntegerZeroIsValidPasses() { // integer zero is valid final var schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java index 2520a972f25..fbfeb797f7a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java @@ -33,7 +33,7 @@ public void testTrueIsInvalidFails() { } @Test - public void testFloatOneIsValidPasses() throws ValidationException, InvalidTypeException { + public void testFloatOneIsValidPasses() { // float one is valid final var schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testFloatOneIsValidPasses() throws ValidationException, InvalidTypeE } @Test - public void testIntegerOneIsValidPasses() throws ValidationException, InvalidTypeException { + public void testIntegerOneIsValidPasses() { // integer one is valid final var schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java index 666b6f44de0..1b2fd92ec8e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java @@ -33,7 +33,7 @@ public void testAnotherStringIsInvalidFails() { } @Test - public void testMember2IsValidPasses() throws ValidationException, InvalidTypeException { + public void testMember2IsValidPasses() { // member 2 is valid final var schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testMember2IsValidPasses() throws ValidationException, InvalidTypeEx } @Test - public void testMember1IsValidPasses() throws ValidationException, InvalidTypeException { + public void testMember1IsValidPasses() { // member 1 is valid final var schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java index e9c71a6a552..4737d1537ac 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java @@ -33,7 +33,7 @@ public void testFloatZeroIsInvalidFails() { } @Test - public void testFalseIsValidPasses() throws ValidationException, InvalidTypeException { + public void testFalseIsValidPasses() { // false is valid final var schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java index 5a9e1d5dc15..183135f6f0f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java @@ -48,7 +48,7 @@ public void testIntegerOneIsInvalidFails() { } @Test - public void testTrueIsValidPasses() throws ValidationException, InvalidTypeException { + public void testTrueIsValidPasses() { // true is valid final var schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java index 2fd29effafa..0917720a711 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java @@ -82,7 +82,7 @@ public void testMissingAllPropertiesIsInvalidFails() { } @Test - public void testBothPropertiesAreValidPasses() throws ValidationException, InvalidTypeException { + public void testBothPropertiesAreValidPasses() { // both properties are valid final var schema = EnumsInProperties.EnumsInProperties1.getInstance(); schema.validate( @@ -101,7 +101,7 @@ public void testBothPropertiesAreValidPasses() throws ValidationException, Inval } @Test - public void testMissingOptionalPropertyIsValidPasses() throws ValidationException, InvalidTypeException { + public void testMissingOptionalPropertyIsValidPasses() { // missing optional property is valid final var schema = EnumsInProperties.EnumsInProperties1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java index 6fc31a8a72d..82ee3dc86a9 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java @@ -42,7 +42,7 @@ public void testPropertyPresentFails() { } @Test - public void testPropertyAbsentPasses() throws ValidationException, InvalidTypeException { + public void testPropertyAbsentPasses() { // property absent final var schema = ForbiddenProperty.ForbiddenProperty1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java index 1c0dca23e1e..28827e12a61 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java @@ -18,7 +18,7 @@ public class HostnameFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreIntegersPasses() { // all string formats ignore integers final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationExceptio } @Test - public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreNullsPasses() { // all string formats ignore nulls final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreObjectsPasses() { // all string formats ignore objects final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException } @Test - public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreFloatsPasses() { // all string formats ignore floats final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreArraysPasses() { // all string formats ignore arrays final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreBooleansPasses() { // all string formats ignore booleans final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java index cbd4bf3b205..9bd3fc054a5 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java @@ -65,7 +65,7 @@ public void testNullIsNotAnIntegerFails() { } @Test - public void testAFloatWithZeroFractionalPartIsAnIntegerPasses() throws ValidationException, InvalidTypeException { + public void testAFloatWithZeroFractionalPartIsAnIntegerPasses() { // a float with zero fractional part is an integer final var schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance(); schema.validate( @@ -120,7 +120,7 @@ public void testAStringIsNotAnIntegerFails() { } @Test - public void testAnIntegerIsAnIntegerPasses() throws ValidationException, InvalidTypeException { + public void testAnIntegerIsAnIntegerPasses() { // an integer is an integer final var schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java index 81c2e15f2f9..9e11bdbcdb6 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java @@ -33,7 +33,7 @@ public void testAlwaysInvalidButNaiveImplementationsMayRaiseAnOverflowErrorFails } @Test - public void testValidIntegerWithMultipleofFloatPasses() throws ValidationException, InvalidTypeException { + public void testValidIntegerWithMultipleofFloatPasses() { // valid integer with multipleOf float final var schema = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java index 01a9eb81a57..3a4c529692d 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java @@ -18,7 +18,7 @@ public class InvalidStringValueForDefaultTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testValidWhenPropertyIsSpecifiedPasses() throws ValidationException, InvalidTypeException { + public void testValidWhenPropertyIsSpecifiedPasses() { // valid when property is specified final var schema = InvalidStringValueForDefault.InvalidStringValueForDefault1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testValidWhenPropertyIsSpecifiedPasses() throws ValidationException, } @Test - public void testStillValidWhenTheInvalidDefaultIsUsedPasses() throws ValidationException, InvalidTypeException { + public void testStillValidWhenTheInvalidDefaultIsUsedPasses() { // still valid when the invalid default is used final var schema = InvalidStringValueForDefault.InvalidStringValueForDefault1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java index 37d503d4b45..0397a32aae1 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java @@ -18,7 +18,7 @@ public class Ipv4FormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreIntegersPasses() { // all string formats ignore integers final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationExceptio } @Test - public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreNullsPasses() { // all string formats ignore nulls final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreObjectsPasses() { // all string formats ignore objects final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException } @Test - public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreFloatsPasses() { // all string formats ignore floats final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreArraysPasses() { // all string formats ignore arrays final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreBooleansPasses() { // all string formats ignore booleans final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java index 33d77de9d68..da110ec06c0 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java @@ -18,7 +18,7 @@ public class Ipv6FormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreIntegersPasses() { // all string formats ignore integers final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationExceptio } @Test - public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreNullsPasses() { // all string formats ignore nulls final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreObjectsPasses() { // all string formats ignore objects final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException } @Test - public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreFloatsPasses() { // all string formats ignore floats final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreArraysPasses() { // all string formats ignore arrays final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreBooleansPasses() { // all string formats ignore booleans final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java index e4e8b5ddda3..37ac945057a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java @@ -18,7 +18,7 @@ public class JsonPointerFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreIntegersPasses() { // all string formats ignore integers final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationExceptio } @Test - public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreNullsPasses() { // all string formats ignore nulls final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreObjectsPasses() { // all string formats ignore objects final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException } @Test - public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreFloatsPasses() { // all string formats ignore floats final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreArraysPasses() { // all string formats ignore arrays final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreBooleansPasses() { // all string formats ignore booleans final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java index 79f74a77fb6..060e7cbe47c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java @@ -33,7 +33,7 @@ public void testAboveTheMaximumIsInvalidFails() { } @Test - public void testBoundaryPointIsValidPasses() throws ValidationException, InvalidTypeException { + public void testBoundaryPointIsValidPasses() { // boundary point is valid final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testBoundaryPointIsValidPasses() throws ValidationException, Invalid } @Test - public void testBelowTheMaximumIsValidPasses() throws ValidationException, InvalidTypeException { + public void testBelowTheMaximumIsValidPasses() { // below the maximum is valid final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testBelowTheMaximumIsValidPasses() throws ValidationException, Inval } @Test - public void testIgnoresNonNumbersPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresNonNumbersPasses() { // ignores non-numbers final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java index 814d01d4c1b..7de1376dc82 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java @@ -33,7 +33,7 @@ public void testAboveTheMaximumIsInvalidFails() { } @Test - public void testBelowTheMaximumIsInvalidPasses() throws ValidationException, InvalidTypeException { + public void testBelowTheMaximumIsInvalidPasses() { // below the maximum is invalid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testBelowTheMaximumIsInvalidPasses() throws ValidationException, Inv } @Test - public void testBoundaryPointIntegerIsValidPasses() throws ValidationException, InvalidTypeException { + public void testBoundaryPointIntegerIsValidPasses() { // boundary point integer is valid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testBoundaryPointIntegerIsValidPasses() throws ValidationException, } @Test - public void testBoundaryPointFloatIsValidPasses() throws ValidationException, InvalidTypeException { + public void testBoundaryPointFloatIsValidPasses() { // boundary point float is valid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java index 7aa925b9e6c..f44118876b0 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java @@ -18,7 +18,7 @@ public class MaxitemsValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() throws ValidationException, InvalidTypeException { + public void testShorterIsValidPasses() { // shorter is valid final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( @@ -30,7 +30,7 @@ public void testShorterIsValidPasses() throws ValidationException, InvalidTypeEx } @Test - public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { + public void testExactLengthIsValidPasses() { // exact length is valid final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( @@ -62,7 +62,7 @@ public void testTooLongIsInvalidFails() { } @Test - public void testIgnoresNonArraysPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresNonArraysPasses() { // ignores non-arrays final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java index 9fbfd1a6f13..441f220cf30 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java @@ -18,7 +18,7 @@ public class MaxlengthValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() throws ValidationException, InvalidTypeException { + public void testShorterIsValidPasses() { // shorter is valid final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testShorterIsValidPasses() throws ValidationException, InvalidTypeEx } @Test - public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { + public void testExactLengthIsValidPasses() { // exact length is valid final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testTooLongIsInvalidFails() { } @Test - public void testIgnoresNonStringsPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresNonStringsPasses() { // ignores non-strings final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -63,7 +63,7 @@ public void testIgnoresNonStringsPasses() throws ValidationException, InvalidTyp } @Test - public void testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() throws ValidationException, InvalidTypeException { + public void testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() { // two supplementary Unicode code points is long enough final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java index 8d5d7793a9a..203eab6db9a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java @@ -38,7 +38,7 @@ public void testOnePropertyIsInvalidFails() { } @Test - public void testNoPropertiesIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNoPropertiesIsValidPasses() { // no properties is valid final var schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java index 43c7dd65a0f..f0fae897e64 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java @@ -18,7 +18,7 @@ public class MaxpropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() throws ValidationException, InvalidTypeException { + public void testShorterIsValidPasses() { // shorter is valid final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testShorterIsValidPasses() throws ValidationException, InvalidTypeEx } @Test - public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { + public void testExactLengthIsValidPasses() { // exact length is valid final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -80,7 +80,7 @@ public void testTooLongIsInvalidFails() { } @Test - public void testIgnoresOtherNonObjectsPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresOtherNonObjectsPasses() { // ignores other non-objects final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -90,7 +90,7 @@ public void testIgnoresOtherNonObjectsPasses() throws ValidationException, Inval } @Test - public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresArraysPasses() { // ignores arrays final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -104,7 +104,7 @@ public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeExc } @Test - public void testIgnoresStringsPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresStringsPasses() { // ignores strings final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java index d7ac04c36d4..938de6c0c23 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java @@ -18,7 +18,7 @@ public class MinimumValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBoundaryPointIsValidPasses() throws ValidationException, InvalidTypeException { + public void testBoundaryPointIsValidPasses() { // boundary point is valid final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testBelowTheMinimumIsInvalidFails() { } @Test - public void testIgnoresNonNumbersPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresNonNumbersPasses() { // ignores non-numbers final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testIgnoresNonNumbersPasses() throws ValidationException, InvalidTyp } @Test - public void testAboveTheMinimumIsValidPasses() throws ValidationException, InvalidTypeException { + public void testAboveTheMinimumIsValidPasses() { // above the minimum is valid final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java index 9d8f90c5a54..e5252c6c48a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java @@ -18,7 +18,7 @@ public class MinimumValidationWithSignedIntegerTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBoundaryPointWithFloatIsValidPasses() throws ValidationException, InvalidTypeException { + public void testBoundaryPointWithFloatIsValidPasses() { // boundary point with float is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testBoundaryPointWithFloatIsValidPasses() throws ValidationException } @Test - public void testBoundaryPointIsValidPasses() throws ValidationException, InvalidTypeException { + public void testBoundaryPointIsValidPasses() { // boundary point is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testIntBelowTheMinimumIsInvalidFails() { } @Test - public void testPositiveAboveTheMinimumIsValidPasses() throws ValidationException, InvalidTypeException { + public void testPositiveAboveTheMinimumIsValidPasses() { // positive above the minimum is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -63,7 +63,7 @@ public void testPositiveAboveTheMinimumIsValidPasses() throws ValidationExceptio } @Test - public void testNegativeAboveTheMinimumIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNegativeAboveTheMinimumIsValidPasses() { // negative above the minimum is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -73,7 +73,7 @@ public void testNegativeAboveTheMinimumIsValidPasses() throws ValidationExceptio } @Test - public void testIgnoresNonNumbersPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresNonNumbersPasses() { // ignores non-numbers final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java index 7dc3192e63f..fe973599a5f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java @@ -18,7 +18,7 @@ public class MinitemsValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { + public void testExactLengthIsValidPasses() { // exact length is valid final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( @@ -30,7 +30,7 @@ public void testExactLengthIsValidPasses() throws ValidationException, InvalidTy } @Test - public void testIgnoresNonArraysPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresNonArraysPasses() { // ignores non-arrays final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( @@ -40,7 +40,7 @@ public void testIgnoresNonArraysPasses() throws ValidationException, InvalidType } @Test - public void testLongerIsValidPasses() throws ValidationException, InvalidTypeException { + public void testLongerIsValidPasses() { // longer is valid final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java index adc647c165d..8a0b2faf8f5 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java @@ -18,7 +18,7 @@ public class MinlengthValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { + public void testExactLengthIsValidPasses() { // exact length is valid final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testExactLengthIsValidPasses() throws ValidationException, InvalidTy } @Test - public void testLongerIsValidPasses() throws ValidationException, InvalidTypeException { + public void testLongerIsValidPasses() { // longer is valid final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testLongerIsValidPasses() throws ValidationException, InvalidTypeExc } @Test - public void testIgnoresNonStringsPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresNonStringsPasses() { // ignores non-strings final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java index 5b71a8cbc5b..109b3b7fbfd 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java @@ -18,7 +18,7 @@ public class MinpropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() throws ValidationException, InvalidTypeException { + public void testExactLengthIsValidPasses() { // exact length is valid final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testExactLengthIsValidPasses() throws ValidationException, InvalidTy } @Test - public void testIgnoresOtherNonObjectsPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresOtherNonObjectsPasses() { // ignores other non-objects final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testIgnoresOtherNonObjectsPasses() throws ValidationException, Inval } @Test - public void testLongerIsValidPasses() throws ValidationException, InvalidTypeException { + public void testLongerIsValidPasses() { // longer is valid final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -62,7 +62,7 @@ public void testLongerIsValidPasses() throws ValidationException, InvalidTypeExc } @Test - public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresArraysPasses() { // ignores arrays final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -89,7 +89,7 @@ public void testTooShortIsInvalidFails() { } @Test - public void testIgnoresStringsPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresStringsPasses() { // ignores strings final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java index a17f8c6c618..7f0e5197f48 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java @@ -18,7 +18,7 @@ public class NestedAllofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNullIsValidPasses() { // null is valid final var schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java index f50fda5def8..40c68fea595 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java @@ -18,7 +18,7 @@ public class NestedAnyofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNullIsValidPasses() { // null is valid final var schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java index 0dc4caa8617..a730cd66895 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java @@ -100,7 +100,7 @@ public void testNotDeepEnoughFails() { } @Test - public void testValidNestedArrayPasses() throws ValidationException, InvalidTypeException { + public void testValidNestedArrayPasses() { // valid nested array final var schema = NestedItems.NestedItems1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java index 45f46052c93..e16c8bc3373 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java @@ -18,7 +18,7 @@ public class NestedOneofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNullIsValidPasses() { // null is valid final var schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java index b01c6a87295..d3fbe75257c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java @@ -18,7 +18,7 @@ public class NotMoreComplexSchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testOtherMatchPasses() throws ValidationException, InvalidTypeException { + public void testOtherMatchPasses() { // other match final var schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testMismatchFails() { } @Test - public void testMatchPasses() throws ValidationException, InvalidTypeException { + public void testMatchPasses() { // match final var schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java index 30f4486244c..bc2bc52984c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java @@ -33,7 +33,7 @@ public void testDisallowedFails() { } @Test - public void testAllowedPasses() throws ValidationException, InvalidTypeException { + public void testAllowedPasses() { // allowed final var schema = Not.Not1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java index 06120d515d1..fb754a14c5f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java @@ -18,7 +18,7 @@ public class NulCharactersInStringsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMatchStringWithNulPasses() throws ValidationException, InvalidTypeException { + public void testMatchStringWithNulPasses() { // match string with nul final var schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java index fafa1dc6e12..637d7878b59 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java @@ -95,7 +95,7 @@ public void testFalseIsNotNullFails() { } @Test - public void testNullIsNullPasses() throws ValidationException, InvalidTypeException { + public void testNullIsNullPasses() { // null is null final var schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java index 07d3da67368..7158fd026db 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java @@ -18,7 +18,7 @@ public class NumberTypeMatchesNumbersTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAFloatIsANumberPasses() throws ValidationException, InvalidTypeException { + public void testAFloatIsANumberPasses() { // a float is a number final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAFloatIsANumberPasses() throws ValidationException, InvalidTypeE } @Test - public void testAnIntegerIsANumberPasses() throws ValidationException, InvalidTypeException { + public void testAnIntegerIsANumberPasses() { // an integer is a number final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( @@ -68,7 +68,7 @@ public void testABooleanIsNotANumberFails() { } @Test - public void testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() throws ValidationException, InvalidTypeException { + public void testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() { // a float with zero fractional part is a number (and an integer) final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java index 17a2f31c1bb..46aef85c136 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java @@ -18,7 +18,7 @@ public class ObjectPropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBothPropertiesPresentAndValidIsValidPasses() throws ValidationException, InvalidTypeException { + public void testBothPropertiesPresentAndValidIsValidPasses() { // both properties present and valid is valid final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -37,7 +37,7 @@ public void testBothPropertiesPresentAndValidIsValidPasses() throws ValidationEx } @Test - public void testDoesnTInvalidateOtherPropertiesPasses() throws ValidationException, InvalidTypeException { + public void testDoesnTInvalidateOtherPropertiesPasses() { // doesn't invalidate other properties final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testDoesnTInvalidateOtherPropertiesPasses() throws ValidationExcepti } @Test - public void testIgnoresOtherNonObjectsPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresOtherNonObjectsPasses() { // ignores other non-objects final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -89,7 +89,7 @@ public void testBothPropertiesInvalidIsInvalidFails() { } @Test - public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresArraysPasses() { // ignores arrays final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java index 2fbb12b14d9..0d4f932b859 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java @@ -18,7 +18,7 @@ public class ObjectTypeMatchesObjectsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnObjectIsAnObjectPasses() throws ValidationException, InvalidTypeException { + public void testAnObjectIsAnObjectPasses() { // an object is an object final var schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java index 4a7e08e1a28..46cabdaf335 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java @@ -18,7 +18,7 @@ public class OneofComplexTypesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testSecondOneofValidComplexPasses() throws ValidationException, InvalidTypeException { + public void testSecondOneofValidComplexPasses() { // second oneOf valid (complex) final var schema = OneofComplexTypes.OneofComplexTypes1.getInstance(); schema.validate( @@ -57,7 +57,7 @@ public void testBothOneofValidComplexFails() { } @Test - public void testFirstOneofValidComplexPasses() throws ValidationException, InvalidTypeException { + public void testFirstOneofValidComplexPasses() { // first oneOf valid (complex) final var schema = OneofComplexTypes.OneofComplexTypes1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java index db67a5b31a2..4aafad49183 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java @@ -48,7 +48,7 @@ public void testNeitherOneofValidFails() { } @Test - public void testSecondOneofValidPasses() throws ValidationException, InvalidTypeException { + public void testSecondOneofValidPasses() { // second oneOf valid final var schema = Oneof.Oneof1.getInstance(); schema.validate( @@ -58,7 +58,7 @@ public void testSecondOneofValidPasses() throws ValidationException, InvalidType } @Test - public void testFirstOneofValidPasses() throws ValidationException, InvalidTypeException { + public void testFirstOneofValidPasses() { // first oneOf valid final var schema = Oneof.Oneof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java index dd0add55868..2dfe72cd7fa 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java @@ -33,7 +33,7 @@ public void testMismatchBaseSchemaFails() { } @Test - public void testOneOneofValidPasses() throws ValidationException, InvalidTypeException { + public void testOneOneofValidPasses() { // one oneOf valid final var schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java index a685ce3ea0e..4500ca75474 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java @@ -18,7 +18,7 @@ public class OneofWithEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testOneValidValidPasses() throws ValidationException, InvalidTypeException { + public void testOneValidValidPasses() { // one valid - valid final var schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java index 151b27da32a..fed6deab27e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java @@ -18,7 +18,7 @@ public class OneofWithRequiredTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testFirstValidValidPasses() throws ValidationException, InvalidTypeException { + public void testFirstValidValidPasses() { // first valid - valid final var schema = OneofWithRequired.OneofWithRequired1.getInstance(); schema.validate( @@ -65,7 +65,7 @@ public void testBothValidInvalidFails() { } @Test - public void testSecondValidValidPasses() throws ValidationException, InvalidTypeException { + public void testSecondValidValidPasses() { // second valid - valid final var schema = OneofWithRequired.OneofWithRequired1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java index 02e105b9128..70153cd7cb5 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java @@ -18,7 +18,7 @@ public class PatternIsNotAnchoredTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMatchesASubstringPasses() throws ValidationException, InvalidTypeException { + public void testMatchesASubstringPasses() { // matches a substring final var schema = PatternIsNotAnchored.PatternIsNotAnchored1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java index acfb4a826b7..fc5ff8000e3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java @@ -18,7 +18,7 @@ public class PatternValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testIgnoresBooleansPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresBooleansPasses() { // ignores booleans final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testIgnoresBooleansPasses() throws ValidationException, InvalidTypeE } @Test - public void testIgnoresFloatsPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresFloatsPasses() { // ignores floats final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -53,7 +53,7 @@ public void testANonMatchingPatternIsInvalidFails() { } @Test - public void testIgnoresIntegersPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresIntegersPasses() { // ignores integers final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -63,7 +63,7 @@ public void testIgnoresIntegersPasses() throws ValidationException, InvalidTypeE } @Test - public void testAMatchingPatternIsValidPasses() throws ValidationException, InvalidTypeException { + public void testAMatchingPatternIsValidPasses() { // a matching pattern is valid final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -73,7 +73,7 @@ public void testAMatchingPatternIsValidPasses() throws ValidationException, Inva } @Test - public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresArraysPasses() { // ignores arrays final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -84,7 +84,7 @@ public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeExc } @Test - public void testIgnoresObjectsPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresObjectsPasses() { // ignores objects final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -95,7 +95,7 @@ public void testIgnoresObjectsPasses() throws ValidationException, InvalidTypeEx } @Test - public void testIgnoresNullPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresNullPasses() { // ignores null final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java index 434f09a6c7b..d394de1e6ed 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java @@ -18,7 +18,7 @@ public class PropertiesWithEscapedCharactersTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testObjectWithAllNumbersIsValidPasses() throws ValidationException, InvalidTypeException { + public void testObjectWithAllNumbersIsValidPasses() { // object with all numbers is valid final var schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java index 26cca29286e..70412b8ca3f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java @@ -18,7 +18,7 @@ public class PropertyNamedRefThatIsNotAReferenceTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { + public void testPropertyNamedRefValidPasses() { // property named $ref valid final var schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java index 53810dd8a3a..3fc09b3946b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java @@ -18,7 +18,7 @@ public class RefInAdditionalpropertiesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { + public void testPropertyNamedRefValidPasses() { // property named $ref valid final var schema = RefInAdditionalproperties.RefInAdditionalproperties1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java index 650c5d98617..2f49c75fa81 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java @@ -18,7 +18,7 @@ public class RefInAllofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { + public void testPropertyNamedRefValidPasses() { // property named $ref valid final var schema = RefInAllof.RefInAllof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java index 3959a9f661b..c4199877c08 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java @@ -18,7 +18,7 @@ public class RefInAnyofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { + public void testPropertyNamedRefValidPasses() { // property named $ref valid final var schema = RefInAnyof.RefInAnyof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java index 1c8c483563c..239677fb66b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java @@ -18,7 +18,7 @@ public class RefInItemsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { + public void testPropertyNamedRefValidPasses() { // property named $ref valid final var schema = RefInItems.RefInItems1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java index 9c105e56e4b..7a68dc4be5f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java @@ -18,7 +18,7 @@ public class RefInNotTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { + public void testPropertyNamedRefValidPasses() { // property named $ref valid final var schema = RefInNot.RefInNot1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java index 4ea515462ce..e8555cad3f3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java @@ -18,7 +18,7 @@ public class RefInOneofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { + public void testPropertyNamedRefValidPasses() { // property named $ref valid final var schema = RefInOneof.RefInOneof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java index 6ede003a62e..65cfaad0251 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java @@ -18,7 +18,7 @@ public class RefInPropertyTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() throws ValidationException, InvalidTypeException { + public void testPropertyNamedRefValidPasses() { // property named $ref valid final var schema = RefInProperty.RefInProperty1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java index 1b33c60e367..b439c59a44b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java @@ -18,7 +18,7 @@ public class RequiredDefaultValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNotRequiredByDefaultPasses() throws ValidationException, InvalidTypeException { + public void testNotRequiredByDefaultPasses() { // not required by default final var schema = RequiredDefaultValidation.RequiredDefaultValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java index de98dacf49f..3757ebf8c49 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java @@ -18,7 +18,7 @@ public class RequiredValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPresentRequiredPropertyIsValidPasses() throws ValidationException, InvalidTypeException { + public void testPresentRequiredPropertyIsValidPasses() { // present required property is valid final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -33,7 +33,7 @@ public void testPresentRequiredPropertyIsValidPasses() throws ValidationExceptio } @Test - public void testIgnoresOtherNonObjectsPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresOtherNonObjectsPasses() { // ignores other non-objects final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -43,7 +43,7 @@ public void testIgnoresOtherNonObjectsPasses() throws ValidationException, Inval } @Test - public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresArraysPasses() { // ignores arrays final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -54,7 +54,7 @@ public void testIgnoresArraysPasses() throws ValidationException, InvalidTypeExc } @Test - public void testIgnoresStringsPasses() throws ValidationException, InvalidTypeException { + public void testIgnoresStringsPasses() { // ignores strings final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java index b527397fdce..d6a8add1e4c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java @@ -18,7 +18,7 @@ public class RequiredWithEmptyArrayTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNotRequiredPasses() throws ValidationException, InvalidTypeException { + public void testPropertyNotRequiredPasses() { // property not required final var schema = RequiredWithEmptyArray.RequiredWithEmptyArray1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java index 3361ccc1a36..a2c05a6f22e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java @@ -42,7 +42,7 @@ public void testObjectWithSomePropertiesMissingIsInvalidFails() { } @Test - public void testObjectWithAllPropertiesPresentIsValidPasses() throws ValidationException, InvalidTypeException { + public void testObjectWithAllPropertiesPresentIsValidPasses() { // object with all properties present is valid final var schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java index 19e9e40b9f1..53f95f8e48e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java @@ -33,7 +33,7 @@ public void testSomethingElseIsInvalidFails() { } @Test - public void testOneOfTheEnumIsValidPasses() throws ValidationException, InvalidTypeException { + public void testOneOfTheEnumIsValidPasses() { // one of the enum is valid final var schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java index f7eb3fb217b..226c06bc19f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java @@ -18,7 +18,7 @@ public class StringTypeMatchesStringsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() throws ValidationException, InvalidTypeException { + public void testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() { // a string is still a string, even if it looks like a number final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( @@ -58,7 +58,7 @@ public void testABooleanIsNotAStringFails() { } @Test - public void testAnEmptyStringIsStillAStringPasses() throws ValidationException, InvalidTypeException { + public void testAnEmptyStringIsStillAStringPasses() { // an empty string is still a string final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( @@ -115,7 +115,7 @@ public void testNullIsNotAStringFails() { } @Test - public void testAStringIsAStringPasses() throws ValidationException, InvalidTypeException { + public void testAStringIsAStringPasses() { // a string is a string final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java index 0ebbc544fb7..6b63fd753ce 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java @@ -18,7 +18,7 @@ public class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMissingPropertiesAreNotFilledInWithTheDefaultPasses() throws ValidationException, InvalidTypeException { + public void testMissingPropertiesAreNotFilledInWithTheDefaultPasses() { // missing properties are not filled in with the default final var schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance(); schema.validate( @@ -29,7 +29,7 @@ public void testMissingPropertiesAreNotFilledInWithTheDefaultPasses() throws Val } @Test - public void testAnExplicitPropertyValueIsCheckedAgainstMaximumPassingPasses() throws ValidationException, InvalidTypeException { + public void testAnExplicitPropertyValueIsCheckedAgainstMaximumPassingPasses() { // an explicit property value is checked against maximum (passing) final var schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java index b52fabfb93c..5c0b5aaaeea 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java @@ -18,7 +18,7 @@ public class UniqueitemsFalseValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNumbersAreUniqueIfMathematicallyUnequalPasses() throws ValidationException, InvalidTypeException { + public void testNumbersAreUniqueIfMathematicallyUnequalPasses() { // numbers are unique if mathematically unequal final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -32,7 +32,7 @@ public void testNumbersAreUniqueIfMathematicallyUnequalPasses() throws Validatio } @Test - public void testNonUniqueArrayOfIntegersIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNonUniqueArrayOfIntegersIsValidPasses() { // non-unique array of integers is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -45,7 +45,7 @@ public void testNonUniqueArrayOfIntegersIsValidPasses() throws ValidationExcepti } @Test - public void testNonUniqueArrayOfObjectsIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNonUniqueArrayOfObjectsIsValidPasses() { // non-unique array of objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -68,7 +68,7 @@ public void testNonUniqueArrayOfObjectsIsValidPasses() throws ValidationExceptio } @Test - public void testNonUniqueArrayOfArraysIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNonUniqueArrayOfArraysIsValidPasses() { // non-unique array of arrays is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -85,7 +85,7 @@ public void testNonUniqueArrayOfArraysIsValidPasses() throws ValidationException } @Test - public void test1AndTrueAreUniquePasses() throws ValidationException, InvalidTypeException { + public void test1AndTrueAreUniquePasses() { // 1 and true are unique final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -98,7 +98,7 @@ public void test1AndTrueAreUniquePasses() throws ValidationException, InvalidTyp } @Test - public void testUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException, InvalidTypeException { + public void testUniqueArrayOfNestedObjectsIsValidPasses() { // unique array of nested objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -141,7 +141,7 @@ public void testUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationExcep } @Test - public void testUniqueArrayOfArraysIsValidPasses() throws ValidationException, InvalidTypeException { + public void testUniqueArrayOfArraysIsValidPasses() { // unique array of arrays is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -158,7 +158,7 @@ public void testUniqueArrayOfArraysIsValidPasses() throws ValidationException, I } @Test - public void testTrueIsNotEqualToOnePasses() throws ValidationException, InvalidTypeException { + public void testTrueIsNotEqualToOnePasses() { // true is not equal to one final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -171,7 +171,7 @@ public void testTrueIsNotEqualToOnePasses() throws ValidationException, InvalidT } @Test - public void testNonUniqueHeterogeneousTypesAreValidPasses() throws ValidationException, InvalidTypeException { + public void testNonUniqueHeterogeneousTypesAreValidPasses() { // non-unique heterogeneous types are valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -192,7 +192,7 @@ public void testNonUniqueHeterogeneousTypesAreValidPasses() throws ValidationExc } @Test - public void testFalseIsNotEqualToZeroPasses() throws ValidationException, InvalidTypeException { + public void testFalseIsNotEqualToZeroPasses() { // false is not equal to zero final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -205,7 +205,7 @@ public void testFalseIsNotEqualToZeroPasses() throws ValidationException, Invali } @Test - public void testUniqueArrayOfIntegersIsValidPasses() throws ValidationException, InvalidTypeException { + public void testUniqueArrayOfIntegersIsValidPasses() { // unique array of integers is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -218,7 +218,7 @@ public void testUniqueArrayOfIntegersIsValidPasses() throws ValidationException, } @Test - public void test0AndFalseAreUniquePasses() throws ValidationException, InvalidTypeException { + public void test0AndFalseAreUniquePasses() { // 0 and false are unique final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -231,7 +231,7 @@ public void test0AndFalseAreUniquePasses() throws ValidationException, InvalidTy } @Test - public void testUniqueHeterogeneousTypesAreValidPasses() throws ValidationException, InvalidTypeException { + public void testUniqueHeterogeneousTypesAreValidPasses() { // unique heterogeneous types are valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -250,7 +250,7 @@ public void testUniqueHeterogeneousTypesAreValidPasses() throws ValidationExcept } @Test - public void testUniqueArrayOfObjectsIsValidPasses() throws ValidationException, InvalidTypeException { + public void testUniqueArrayOfObjectsIsValidPasses() { // unique array of objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -273,7 +273,7 @@ public void testUniqueArrayOfObjectsIsValidPasses() throws ValidationException, } @Test - public void testNonUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException, InvalidTypeException { + public void testNonUniqueArrayOfNestedObjectsIsValidPasses() { // non-unique array of nested objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java index 33712c9160f..6f6fba93a47 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java @@ -65,7 +65,7 @@ public void testNonUniqueArrayOfObjectsIsInvalidFails() { } @Test - public void testATrueAndA1AreUniquePasses() throws ValidationException, InvalidTypeException { + public void testATrueAndA1AreUniquePasses() { // {\\\"a\\\": true} and {\\\"a\\\": 1} are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -88,7 +88,7 @@ public void testATrueAndA1AreUniquePasses() throws ValidationException, InvalidT } @Test - public void test1AndTrueAreUniquePasses() throws ValidationException, InvalidTypeException { + public void test1AndTrueAreUniquePasses() { // [1] and [true] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -123,7 +123,7 @@ public void testNonUniqueArrayOfIntegersIsInvalidFails() { } @Test - public void testNested0AndFalseAreUniquePasses() throws ValidationException, InvalidTypeException { + public void testNested0AndFalseAreUniquePasses() { // nested [0] and [false] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -204,7 +204,7 @@ public void testNonUniqueArrayOfArraysIsInvalidFails() { } @Test - public void testAFalseAndA0AreUniquePasses() throws ValidationException, InvalidTypeException { + public void testAFalseAndA0AreUniquePasses() { // {\\\"a\\\": false} and {\\\"a\\\": 0} are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -252,7 +252,7 @@ public void testNonUniqueArrayOfMoreThanTwoArraysIsInvalidFails() { } @Test - public void test0AndFalseAreUniquePasses() throws ValidationException, InvalidTypeException { + public void test0AndFalseAreUniquePasses() { // [0] and [false] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -355,7 +355,7 @@ public void testNonUniqueArrayOfStringsIsInvalidFails() { } @Test - public void testUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException, InvalidTypeException { + public void testUniqueArrayOfNestedObjectsIsValidPasses() { // unique array of nested objects is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -398,7 +398,7 @@ public void testUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationExcep } @Test - public void testUniqueArrayOfArraysIsValidPasses() throws ValidationException, InvalidTypeException { + public void testUniqueArrayOfArraysIsValidPasses() { // unique array of arrays is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -415,7 +415,7 @@ public void testUniqueArrayOfArraysIsValidPasses() throws ValidationException, I } @Test - public void testTrueIsNotEqualToOnePasses() throws ValidationException, InvalidTypeException { + public void testTrueIsNotEqualToOnePasses() { // true is not equal to one final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -428,7 +428,7 @@ public void testTrueIsNotEqualToOnePasses() throws ValidationException, InvalidT } @Test - public void testNested1AndTrueAreUniquePasses() throws ValidationException, InvalidTypeException { + public void testNested1AndTrueAreUniquePasses() { // nested [1] and [true] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -451,7 +451,7 @@ public void testNested1AndTrueAreUniquePasses() throws ValidationException, Inva } @Test - public void testUniqueArrayOfStringsIsValidPasses() throws ValidationException, InvalidTypeException { + public void testUniqueArrayOfStringsIsValidPasses() { // unique array of strings is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -465,7 +465,7 @@ public void testUniqueArrayOfStringsIsValidPasses() throws ValidationException, } @Test - public void testFalseIsNotEqualToZeroPasses() throws ValidationException, InvalidTypeException { + public void testFalseIsNotEqualToZeroPasses() { // false is not equal to zero final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -478,7 +478,7 @@ public void testFalseIsNotEqualToZeroPasses() throws ValidationException, Invali } @Test - public void testUniqueArrayOfIntegersIsValidPasses() throws ValidationException, InvalidTypeException { + public void testUniqueArrayOfIntegersIsValidPasses() { // unique array of integers is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -491,7 +491,7 @@ public void testUniqueArrayOfIntegersIsValidPasses() throws ValidationException, } @Test - public void testDifferentObjectsAreUniquePasses() throws ValidationException, InvalidTypeException { + public void testDifferentObjectsAreUniquePasses() { // different objects are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -522,7 +522,7 @@ public void testDifferentObjectsAreUniquePasses() throws ValidationException, In } @Test - public void testUniqueHeterogeneousTypesAreValidPasses() throws ValidationException, InvalidTypeException { + public void testUniqueHeterogeneousTypesAreValidPasses() { // unique heterogeneous types are valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -542,7 +542,7 @@ public void testUniqueHeterogeneousTypesAreValidPasses() throws ValidationExcept } @Test - public void testUniqueArrayOfObjectsIsValidPasses() throws ValidationException, InvalidTypeException { + public void testUniqueArrayOfObjectsIsValidPasses() { // unique array of objects is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java index e78d2a5c5e9..14ce5c09bd2 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java @@ -18,7 +18,7 @@ public class UriFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreIntegersPasses() { // all string formats ignore integers final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationExceptio } @Test - public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreNullsPasses() { // all string formats ignore nulls final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreObjectsPasses() { // all string formats ignore objects final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException } @Test - public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreFloatsPasses() { // all string formats ignore floats final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreArraysPasses() { // all string formats ignore arrays final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreBooleansPasses() { // all string formats ignore booleans final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java index a6fb6102555..9ae84cd3823 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java @@ -18,7 +18,7 @@ public class UriReferenceFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreIntegersPasses() { // all string formats ignore integers final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationExceptio } @Test - public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreNullsPasses() { // all string formats ignore nulls final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreObjectsPasses() { // all string formats ignore objects final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException } @Test - public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreFloatsPasses() { // all string formats ignore floats final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreArraysPasses() { // all string formats ignore arrays final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreBooleansPasses() { // all string formats ignore booleans final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java index fb76276fef6..cb29e46630f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java @@ -18,7 +18,7 @@ public class UriTemplateFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreIntegersPasses() { // all string formats ignore integers final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -28,7 +28,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationExceptio } @Test - public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreNullsPasses() { // all string formats ignore nulls final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -38,7 +38,7 @@ public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreObjectsPasses() { // all string formats ignore objects final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -49,7 +49,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException } @Test - public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreFloatsPasses() { // all string formats ignore floats final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -59,7 +59,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreArraysPasses() { // all string formats ignore arrays final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -70,7 +70,7 @@ public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException, } @Test - public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException, InvalidTypeException { + public void testAllStringFormatsIgnoreBooleansPasses() { // all string formats ignore booleans final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java index c47e21d3fc6..990f21a1148 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java @@ -5,9 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -25,7 +22,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { + public void testSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java index 536188dd45c..b0eaf780b2e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java @@ -6,8 +6,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.ListJsonSchema; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -30,7 +28,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() throws ValidationException, NotImplementedException, InvalidTypeException { + public void testSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -107,7 +105,7 @@ public void testSerialization() throws ValidationException, NotImplementedExcept ); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - NotImplementedException.class, + InvalidTypeException.class, () -> boolHeader.serialize(value, "color", false, configuration) ); } @@ -128,7 +126,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserialization() throws ValidationException, NotImplementedException, InvalidTypeException { + public void testDeserialization() { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java index a81758ecc82..a19ea8c1007 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java @@ -2,8 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -34,7 +32,7 @@ protected CookieParametersSerializer() { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java index 164fbd74f9e..63f3159bf0a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java @@ -2,8 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -35,7 +33,7 @@ protected HeaderParametersSerializer() { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java index aca8385652d..bef110af08d 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java @@ -2,8 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -34,7 +32,7 @@ protected PathParametersSerializer() { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java index fe1f132e766..ed5aae7e580 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java @@ -2,8 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -34,7 +32,7 @@ protected QueryParametersSerializer() { } @Test - public void testSerialization() throws OpenapiDocumentException, NotImplementedException { + public void testSerialization() { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java index 9a6dd9726e3..871d4f073f3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java @@ -4,7 +4,6 @@ import org.junit.Assert; import org.junit.Test; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -27,7 +26,7 @@ public HeaderParameter(@Nullable Boolean explode) { } @Test - public void testHeaderSerialization() throws NotImplementedException { + public void testHeaderSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -92,7 +91,7 @@ public void testHeaderSerialization() throws NotImplementedException { var boolHeader = new HeaderParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - NotImplementedException.class, + InvalidTypeException.class, () -> boolHeader.serialize(value) ); } @@ -105,7 +104,7 @@ public PathParameter(@Nullable Boolean explode) { } @Test - public void testPathSerialization() throws NotImplementedException { + public void testPathSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -170,7 +169,7 @@ public void testPathSerialization() throws NotImplementedException { var pathParameter = new PathParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - NotImplementedException.class, + InvalidTypeException.class, () -> pathParameter.serialize(value) ); } @@ -183,7 +182,7 @@ public CookieParameter(@Nullable Boolean explode) { } @Test - public void testCookieSerialization() throws NotImplementedException { + public void testCookieSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -248,7 +247,7 @@ public void testCookieSerialization() throws NotImplementedException { var cookieParameter = new CookieParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - NotImplementedException.class, + InvalidTypeException.class, () -> cookieParameter.serialize(value) ); } @@ -261,7 +260,7 @@ public PathMatrixParameter(@Nullable Boolean explode) { } @Test - public void testPathMatrixSerialization() throws NotImplementedException { + public void testPathMatrixSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -332,7 +331,7 @@ public PathLabelParameter(@Nullable Boolean explode) { } @Test - public void testPathLabelSerialization() throws NotImplementedException { + public void testPathLabelSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java index 83b9469a24d..f4ea29fccb3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java @@ -4,7 +4,6 @@ import org.junit.Assert; import org.junit.Test; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -27,7 +26,7 @@ public QueryParameterNoStyle(@Nullable Boolean explode) { } @Test - public void testQueryParameterNoStyleSerialization() throws NotImplementedException { + public void testQueryParameterNoStyleSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -92,7 +91,7 @@ public void testQueryParameterNoStyleSerialization() throws NotImplementedExcept var parameter = new QueryParameterNoStyle(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - NotImplementedException.class, + InvalidTypeException.class, () -> parameter.serialize(value) ); } @@ -105,7 +104,7 @@ public QueryParameterSpaceDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { + public void testQueryParameterSpaceDelimitedSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -152,7 +151,7 @@ public QueryParameterPipeDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { + public void testQueryParameterPipeDelimitedSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java index 880ad7749b3..9f0c86ec5c4 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java @@ -3,9 +3,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -50,7 +47,7 @@ public MyRequestBodySerializer() { true); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { @@ -96,7 +93,7 @@ private String getJsonBody(SerializedRequestBody requestBody) { } @Test - public void testSerializeApplicationJson() throws ValidationException, InvalidTypeException, NotImplementedException { + public void testSerializeApplicationJson() { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); String jsonBody; @@ -167,7 +164,7 @@ public void testSerializeApplicationJson() throws ValidationException, InvalidTy } @Test - public void testSerializeTextPlain() throws ValidationException, InvalidTypeException, NotImplementedException { + public void testSerializeTextPlain() { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); SerializedRequestBody requestBody = serializer.serialize( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java index d4ba032bc5f..408f04582a8 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java @@ -8,10 +8,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.OpenapiDocumentException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -68,7 +64,7 @@ public MyResponseDeserializer() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, InvalidTypeException { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { SealedMediaType mediaType = content.get(contentType); if (mediaType == null) { throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); @@ -156,7 +152,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserializeApplicationJsonNull() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonNull() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(null).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -172,7 +168,7 @@ public void testDeserializeApplicationJsonNull() throws ValidationException, Ope } @Test - public void testDeserializeApplicationJsonTrue() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonTrue() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(true).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -188,7 +184,7 @@ public void testDeserializeApplicationJsonTrue() throws ValidationException, Ope } @Test - public void testDeserializeApplicationJsonFalse() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonFalse() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(false).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -204,7 +200,7 @@ public void testDeserializeApplicationJsonFalse() throws ValidationException, Op } @Test - public void testDeserializeApplicationJsonInt() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonInt() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(1).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -220,7 +216,7 @@ public void testDeserializeApplicationJsonInt() throws ValidationException, Open } @Test - public void testDeserializeApplicationJsonFloat() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonFloat() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(3.14).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -236,7 +232,7 @@ public void testDeserializeApplicationJsonFloat() throws ValidationException, Op } @Test - public void testDeserializeApplicationJsonString() throws ValidationException, OpenapiDocumentException, NotImplementedException, InvalidTypeException { + public void testDeserializeApplicationJsonString() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson("a").getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java index 3a066958ffe..9b76ff56c45 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java @@ -5,8 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -28,13 +26,13 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testValidateNull() throws ValidationException, InvalidTypeException { + public void testValidateNull() { Void validatedValue = schema.validate((Void) null, configuration); assertNull(validatedValue); } @Test - public void testValidateBoolean() throws ValidationException, InvalidTypeException { + public void testValidateBoolean() { boolean trueValue = schema.validate(true, configuration); Assert.assertTrue(trueValue); @@ -43,49 +41,49 @@ public void testValidateBoolean() throws ValidationException, InvalidTypeExcepti } @Test - public void testValidateInteger() throws ValidationException, InvalidTypeException { + public void testValidateInteger() { int validatedValue = schema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() throws ValidationException, InvalidTypeException { + public void testValidateLong() { long validatedValue = schema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() throws ValidationException, InvalidTypeException { + public void testValidateFloat() { float validatedValue = schema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() throws ValidationException, InvalidTypeException { + public void testValidateDouble() { double validatedValue = schema.validate(70.6458763d, configuration); Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); } @Test - public void testValidateString() throws ValidationException, InvalidTypeException { + public void testValidateString() { String validatedValue = schema.validate("a", configuration); Assert.assertEquals(validatedValue, "a"); } @Test - public void testValidateZonedDateTime() throws ValidationException, InvalidTypeException { + public void testValidateZonedDateTime() { String validatedValue = schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration); Assert.assertEquals(validatedValue, "2017-07-21T17:32:28Z"); } @Test - public void testValidateLocalDate() throws ValidationException, InvalidTypeException { + public void testValidateLocalDate() { String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); Assert.assertEquals(validatedValue, "2017-07-21"); } @Test - public void testValidateMap() throws ValidationException, InvalidTypeException { + public void testValidateMap() { LinkedHashMap inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap validatedValue = schema.validate(inMap, configuration); @@ -95,7 +93,7 @@ public void testValidateMap() throws ValidationException, InvalidTypeException { } @Test - public void testValidateList() throws ValidationException, InvalidTypeException { + public void testValidateList() { ArrayList inList = new ArrayList<>(); inList.add(LocalDate.of(2017, 7, 21)); FrozenList validatedValue = schema.validate(inList, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index 2d26f1563d4..42dfcabf0d0 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -53,12 +53,12 @@ public FrozenList getNewInstance(List arg, List pathToItem, P itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new RuntimeException("Instantiated type of item is invalid"); + throw new InvalidTypeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -86,7 +86,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -111,7 +111,7 @@ protected ArrayWithOutputClsSchemaList(FrozenList m) { super(m); } - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) { return new ArrayWithOutputClsSchema().validate(arg, configuration); } } @@ -138,12 +138,12 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new RuntimeException("Instantiated type of item is invalid"); + throw new InvalidTypeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -172,7 +172,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -202,7 +202,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateArrayWithItemsSchema() throws ValidationException, InvalidTypeException { + public void testValidateArrayWithItemsSchema() { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); @@ -227,7 +227,7 @@ public void testValidateArrayWithItemsSchema() throws ValidationException, Inval } @Test - public void testValidateArrayWithOutputClsSchema() throws ValidationException, InvalidTypeException { + public void testValidateArrayWithOutputClsSchema() { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java index a989ca41eb2..0b4261a7ef0 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java @@ -4,9 +4,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -24,13 +24,13 @@ public class BooleanSchemaTest { ); @Test - public void testValidateTrue() throws ValidationException, InvalidTypeException { + public void testValidateTrue() { boolean validatedValue = booleanJsonSchema.validate(true, configuration); Assert.assertTrue(validatedValue); } @Test - public void testValidateFalse() throws ValidationException, InvalidTypeException { + public void testValidateFalse() { boolean validatedValue = booleanJsonSchema.validate(false, configuration); Assert.assertFalse(validatedValue); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java index b0417274fe5..cb4aa60f4a8 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java @@ -5,10 +5,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -36,7 +35,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateList() throws ValidationException, InvalidTypeException { + public void testValidateList() { List inList = new ArrayList<>(); inList.add("today"); FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java index 2b3e4231fe4..85afb15a068 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java @@ -5,10 +5,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenMap; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -38,7 +37,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateMap() throws ValidationException, InvalidTypeException { + public void testValidateMap() { Map inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap<@Nullable Object> validatedValue = mapJsonSchema.validate(inMap, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java index afcc5996893..d566f15a69e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java @@ -4,9 +4,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -26,7 +26,7 @@ public class NullSchemaTest { @Test @SuppressWarnings("nullness") - public void testValidateNull() throws ValidationException, InvalidTypeException { + public void testValidateNull() { Void validatedValue = nullJsonSchema.validate(null, configuration); Assert.assertNull(validatedValue); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java index 92698dee479..2ab8d8a8121 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java @@ -4,9 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -24,25 +23,25 @@ public class NumberSchemaTest { ); @Test - public void testValidateInteger() throws ValidationException, InvalidTypeException { + public void testValidateInteger() { int validatedValue = numberJsonSchema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() throws ValidationException, InvalidTypeException { + public void testValidateLong() { long validatedValue = numberJsonSchema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() throws ValidationException, InvalidTypeException { + public void testValidateFloat() { float validatedValue = numberJsonSchema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() throws ValidationException, InvalidTypeException { + public void testValidateDouble() { double validatedValue = numberJsonSchema.validate(3.14d, configuration); Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index c1f9e5de4df..02729b0f046 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -6,13 +6,13 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -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.PropertyEntry; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -62,7 +62,7 @@ public static ObjectWithPropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -70,7 +70,7 @@ public static ObjectWithPropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -99,7 +99,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -146,7 +146,7 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -154,12 +154,12 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(castValue instanceof String)) { - throw new RuntimeException("Invalid type for property value"); + throw new InvalidTypeException("Invalid type for property value"); } properties.put(propertyName, (String) castValue); } @@ -202,7 +202,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -235,7 +235,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -243,7 +243,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -288,7 +288,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -297,7 +297,7 @@ protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { super(m); } - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) { return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); } } @@ -330,7 +330,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -338,7 +338,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -383,7 +383,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -398,7 +398,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateObjectWithPropsSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithPropsSchema() { ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); // map with only property works @@ -429,7 +429,7 @@ public void testValidateObjectWithPropsSchema() throws ValidationException, Inva } @Test - public void testValidateObjectWithAddpropsSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithAddpropsSchema() { ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); // map with only property works @@ -460,7 +460,7 @@ public void testValidateObjectWithAddpropsSchema() throws ValidationException, I } @Test - public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithPropsAndAddpropsSchema() { ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); // map with only property works @@ -499,7 +499,7 @@ public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationExce } @Test - public void testValidateObjectWithOutputTypeSchema() throws ValidationException, InvalidTypeException { + public void testValidateObjectWithOutputTypeSchema() { ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); // map with only property works diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java index 92c61870552..c8079ef632a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java @@ -4,9 +4,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; +import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -28,13 +28,13 @@ public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchem ); @Test - public void testValidateTrue() throws ValidationException, InvalidTypeException { + public void testValidateTrue() { Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); Assert.assertEquals(validatedValue, Boolean.TRUE); } @Test - public void testValidateFalse() throws ValidationException, InvalidTypeException { + public void testValidateFalse() { Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); Assert.assertEquals(validatedValue, Boolean.FALSE); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java index a48a2c742f0..40a01c9983d 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java @@ -6,7 +6,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; @@ -47,7 +46,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return arg; } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -71,7 +70,7 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() throws ValidationException { + public void testCorrectPropertySucceeds() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -106,7 +105,7 @@ public void testCorrectPropertySucceeds() throws ValidationException { } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { + public void testNotApplicableTypeReturnsNull() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java index cb03bcf8f5b..1481f312f6a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java @@ -34,7 +34,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testIntFormatSucceedsWithFloat() throws ValidationException { + public void testIntFormatSucceedsWithFloat() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -59,7 +59,7 @@ public void testIntFormatFailsWithFloat() { } @Test - public void testIntFormatSucceedsWithInt() throws ValidationException { + public void testIntFormatSucceedsWithInt() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -84,7 +84,7 @@ public void testInt32UnderMinFails() { } @Test - public void testInt32InclusiveMinSucceeds() throws ValidationException { + public void testInt32InclusiveMinSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -97,7 +97,7 @@ public void testInt32InclusiveMinSucceeds() throws ValidationException { } @Test - public void testInt32InclusiveMaxSucceeds() throws ValidationException { + public void testInt32InclusiveMaxSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -135,7 +135,7 @@ public void testInt64UnderMinFails() { } @Test - public void testInt64InclusiveMinSucceeds() throws ValidationException { + public void testInt64InclusiveMinSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -148,7 +148,7 @@ public void testInt64InclusiveMinSucceeds() throws ValidationException { } @Test - public void testInt64InclusiveMaxSucceeds() throws ValidationException { + public void testInt64InclusiveMaxSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -186,7 +186,7 @@ public void testFloatUnderMinFails() { } @Test - public void testFloatInclusiveMinSucceeds() throws ValidationException { + public void testFloatInclusiveMinSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -199,7 +199,7 @@ public void testFloatInclusiveMinSucceeds() throws ValidationException { } @Test - public void testFloatInclusiveMaxSucceeds() throws ValidationException { + public void testFloatInclusiveMaxSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -236,7 +236,7 @@ public void testDoubleUnderMinFails() { } @Test - public void testDoubleInclusiveMinSucceeds() throws ValidationException { + public void testDoubleInclusiveMinSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -249,7 +249,7 @@ public void testDoubleInclusiveMinSucceeds() throws ValidationException { } @Test - public void testDoubleInclusiveMaxSucceeds() throws ValidationException { + public void testDoubleInclusiveMaxSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -286,7 +286,7 @@ public void testInvalidNumberStringFails() { } @Test - public void testValidFloatNumberStringSucceeds() throws ValidationException { + public void testValidFloatNumberStringSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -299,7 +299,7 @@ public void testValidFloatNumberStringSucceeds() throws ValidationException { } @Test - public void testValidIntNumberStringSucceeds() throws ValidationException { + public void testValidIntNumberStringSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -324,7 +324,7 @@ public void testInvalidDateStringFails() { } @Test - public void testValidDateStringSucceeds() throws ValidationException { + public void testValidDateStringSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -349,7 +349,7 @@ public void testInvalidDateTimeStringFails() { } @Test - public void testValidDateTimeStringSucceeds() throws ValidationException { + public void testValidDateTimeStringSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java index 6299f5e6ef2..e0e4a0c859e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java @@ -37,7 +37,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List listArg) { return getNewInstance(listArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -55,7 +55,7 @@ public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConf } @Test - public void testCorrectItemsSucceeds() throws ValidationException { + public void testCorrectItemsSucceeds() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -89,7 +89,7 @@ public void testCorrectItemsSucceeds() throws ValidationException { } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { + public void testNotApplicableTypeReturnsNull() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java index 7a8578bae93..8a14df7edd6 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java @@ -40,7 +40,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof String) { return arg; } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -58,7 +58,7 @@ public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } @Test - public void testValidateSucceeds() throws ValidationException { + public void testValidateSucceeds() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java index 19d8a475edd..492f45af0c7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java @@ -36,7 +36,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -59,7 +59,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() throws ValidationException { + public void testCorrectPropertySucceeds() { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( @@ -92,7 +92,7 @@ public void testCorrectPropertySucceeds() throws ValidationException { } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { + public void testNotApplicableTypeReturnsNull() { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java index 221050d9e82..65ff030d74b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java @@ -32,7 +32,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override @@ -55,7 +55,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() throws ValidationException { + public void testCorrectPropertySucceeds() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -78,7 +78,7 @@ public void testCorrectPropertySucceeds() throws ValidationException { } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { + public void testNotApplicableTypeReturnsNull() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java index c31855af4ff..ebc8bbff1f5 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java @@ -18,7 +18,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testValidateSucceeds() throws ValidationException { + public void testValidateSucceeds() { final TypeValidator validator = new TypeValidator(); ValidationMetadata validationMetadata = new ValidationMetadata( new ArrayList<>(), diff --git a/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES b/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES index acf32820683..b5033613876 100644 --- a/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES +++ b/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES @@ -430,6 +430,149 @@ src/main/java/org/openapijsonschematools/client/servers/Server0.java src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java src/main/java/org/openapijsonschematools/client/servers/ServerWithVariables.java src/main/java/org/openapijsonschematools/client/servers/ServerWithoutVariables.java +src/test/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DateFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DurationFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IriFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RegexFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/TimeFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UuidFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.java src/test/java/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.java src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java index 18d4885a020..0a573bbc857 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java @@ -23,7 +23,7 @@ public void testAllowsNullItemsPasses() { final var schema = ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1.getInstance(); schema.validate( Arrays.asList( - (Void) null + null ), configuration ); diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java index 2d0193e9f96..36e67ee7bad 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java @@ -23,7 +23,7 @@ public void testAllowsNullElementsPasses() { final var schema = UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1.getInstance(); schema.validate( Arrays.asList( - (Void) null + null ), configuration ); diff --git a/samples/client/petstore/java/.openapi-generator/FILES b/samples/client/petstore/java/.openapi-generator/FILES index 75d48d1effe..aa899ef9fe6 100644 --- a/samples/client/petstore/java/.openapi-generator/FILES +++ b/samples/client/petstore/java/.openapi-generator/FILES @@ -518,9 +518,6 @@ docs/paths/foo/get/FooGetServerInfo.md docs/paths/foo/get/Responses.md docs/paths/foo/get/responses/CodedefaultResponse.md docs/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md -docs/paths/foo/get/servers/FooGetServer0.md -docs/paths/foo/get/servers/FooGetServer1.md -docs/paths/foo/get/servers/server1/Variables.md docs/paths/pet/Post.md docs/paths/pet/Put.md docs/paths/pet/post/PetPostSecurityInfo.md @@ -550,9 +547,6 @@ docs/paths/petfindbystatus/get/responses/Code400Response.md docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md -docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md -docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md -docs/paths/petfindbystatus/servers/server1/Variables.md docs/paths/petfindbytags/Get.md docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md docs/paths/petfindbytags/get/QueryParameters.md @@ -684,8 +678,6 @@ docs/paths/userusername/put/responses/Code404Response.md docs/servers/Server0.md docs/servers/Server1.md docs/servers/Server2.md -docs/servers/server0/Variables.md -docs/servers/server1/Variables.md pom.xml src/main/java/org/openapijsonschematools/client/RootServerInfo.java src/main/java/org/openapijsonschematools/client/apiclient/ApiClient.java @@ -896,7 +888,7 @@ src/main/java/org/openapijsonschematools/client/contenttype/ContentTypeSerialize src/main/java/org/openapijsonschematools/client/exceptions/ApiException.java src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.java -src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java +src/main/java/org/openapijsonschematools/client/exceptions/InvalidTypeException.java src/main/java/org/openapijsonschematools/client/exceptions/UnsetPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/ValidationException.java src/main/java/org/openapijsonschematools/client/header/ContentHeader.java diff --git a/samples/client/petstore/java/docs/RootServerInfo.md b/samples/client/petstore/java/docs/RootServerInfo.md index 8df9c7bf6ee..7923e66cc3f 100644 --- a/samples/client/petstore/java/docs/RootServerInfo.md +++ b/samples/client/petstore/java/docs/RootServerInfo.md @@ -4,38 +4,13 @@ RootServerInfo.java public class RootServerInfo A class that provides a server, and any needed server info classes -- a class that is a 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 | | 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()
Creates an instance using default server variable values | -| RootServerInfo1(@Nullable [Server0](servers/Server0.md) server0,@Nullable [Server1](servers/Server1.md) server1,@Nullable [Server2](servers/Server2.md) server2)
Creates an instance using passed in servers | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [Server0](servers/Server0.md) | server0 | -| [Server1](servers/Server1.md) | server1 | -| [Server2](servers/Server2.md) | server2 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Server | getServer([ServerIndex](#serverindex) serverIndex) | - ## ServerIndex enum ServerIndex
diff --git a/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md b/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md index 0a6ef69c824..0719e44d623 100644 --- a/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md +++ b/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md @@ -48,7 +48,7 @@ a class that deserializes a header value | @Nullable ParameterStyle | ParameterStyle.SIMPLE | | @Nullable Boolean explode | false | | @Nullable Boolean allowReserved | null | -| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
the contentType to schema info | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md b/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md index f267518fd67..dbb069c6ae6 100644 --- a/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md +++ b/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md @@ -48,7 +48,7 @@ a class that deserializes a header value | @Nullable ParameterStyle | ParameterStyle.SIMPLE | | @Nullable Boolean explode | false | | @Nullable Boolean allowReserved | null | -| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
the contentType to schema info | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md b/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md index 2d4bf3bc54c..882379fc131 100644 --- a/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md +++ b/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md @@ -50,7 +50,7 @@ a class that deserializes a parameter value | @Nullable Boolean explode | null | | @Nullable ParameterStyle | null | | @Nullable Boolean allowReserved | false | -| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
the contentType to schema info | +| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md b/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md index dbe40f61ba7..d0a1d8d650c 100644 --- a/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md +++ b/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md @@ -12,7 +12,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RefUserArray.RefUserArray1](#refuserarray1)
class that serializes request bodies | ## RefUserArray1 -public static class RefUserArray1 extends [UserArray1](../../components/requestbodies/UserArray.md#userarray1)
+public static class RefUserArray1 extends [UserArray](../../components/requestbodies/UserArray.md#userarray1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 8ce9988a2f5..56c5752c199 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -22,84 +22,8 @@ public static class Patch1 extends ApiClient.ApiClient1 implements PatchOperatio a class that allows one to call the endpoint using a method named patch -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.RootServerInfo; -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.RequestBody; -import org.openapijsonschematools.client.components.schemas.Client; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.Code200Response; -import org.openapijsonschematools.client.paths.anotherfakedummy.Patch; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); - - -Client1BoxedMap requestBodyPayload = - Client.Client1.validateAndBox( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - schemaConfiguration -); -RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PatchRequestBuilder() - .requestBody(requestBody) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.patch(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md index 72d0a1a3ced..a4283fe34f8 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Client](../../../components/requestbodies/Client.md) +public class RequestBody extends [Client](../../components/requestbodies/Client.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client1](../../../components/requestbodies/Client.md#client1)
+public static class RequestBody1 extends [Client](../../components/requestbodies/Client.md#client1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index f766eb05a79..17d65515caa 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -22,82 +22,8 @@ public static class Delete1 extends ApiClient.ApiClient1 implements DeleteOperat a class that allows one to call the endpoint using a method named delete -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.commonparamsubdir.delete.HeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.Code200Response; -import org.openapijsonschematools.client.paths.commonparamsubdir.Delete; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); - - -// Map validation -PathParameters.PathParametersMap pathParameters = - PathParameters.PathParameters1.validate( - new PathParameters.PathParametersMapBuilder() - .subDir("c") - - .build(), - schemaConfiguration -); - -var request = new DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.delete(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index 4cc89d8ffc0..abbfc1713cc 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -22,82 +22,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); -securitySchemes.add( - new BearerTest("someAccessToken"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .fakeDeleteSecurityInfoSecurityIndex(FakeDeleteSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); - - -// Map validation -HeaderParameters.HeaderParametersMap headerParameters = - HeaderParameters.HeaderParameters1.validate( - new HeaderParameters.HeaderParametersMapBuilder() - .required_boolean_group("true") - - .boolean_group("true") - - .build(), - schemaConfiguration -); - -// Map validation -QueryParameters.QueryParametersMap queryParameters = - QueryParameters.QueryParameters1.validate( - new QueryParameters.QueryParametersMapBuilder() - .required_int64_group(1L) - - .required_string_group("a") - - .int64_group(1L) - - .string_group("a") - - .build(), - schemaConfiguration -); - -var request = new DeleteRequestBuilder() - .headerParameters(headerParameters) - .queryParameters(queryParameters) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.delete(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index eaaac40d53d..2037002cda3 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -20,76 +20,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); -securitySchemes.add( - new HttpBasicTest("someUserId", "somePassword"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .fakePostSecurityInfoSecurityIndex(FakePostSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (Code404Response.ResponseApiException e) { - // server returned an error response defined in the openapi document - throw e; -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md b/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md index 7c008b766c7..6480bf870bd 100644 --- a/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md @@ -4,7 +4,7 @@ FakeDeleteSecurityInfo.java public class FakeDeleteSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [FakeDeleteSecurityRequirementObject0](../../../paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md) | security0 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakeDeleteSecurityRequirementObject0()](../../../paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md index ce14db9f6b9..af486306c7b 100644 --- a/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [BearerTest.class](../../../../components/securityschemes/BearerTest.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [BearerTest.class](../../../../components/securityschemes/BearerTest.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md b/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md index f65e52d102c..ecb0c751dc6 100644 --- a/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationxwwwformurlencodedMediaType public record ApplicationxwwwformurlencodedMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md index 72d0a1a3ced..a4283fe34f8 100644 --- a/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Client](../../../components/requestbodies/Client.md) +public class RequestBody extends [Client](../../components/requestbodies/Client.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client1](../../../components/requestbodies/Client.md#client1)
+public static class RequestBody1 extends [Client](../../components/requestbodies/Client.md#client1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md b/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md index 0166862a304..95b409d5023 100644 --- a/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md @@ -4,7 +4,7 @@ FakePostSecurityInfo.java public class FakePostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [FakePostSecurityRequirementObject0](../../../paths/fake/post/security/FakePostSecurityRequirementObject0.md) | security0 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakePostSecurityRequirementObject0()](../../../paths/fake/post/security/FakePostSecurityRequirementObject0.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md index 0b707158f4f..a6cfa244081 100644 --- a/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationxwwwformurlencodedMediaType public record ApplicationxwwwformurlencodedMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md index db0df44256c..ffe185f4a8a 100644 --- a/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index e1599769a32..a405deb463f 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -20,72 +20,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md index e583d49bf2d..3c5d3360d21 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [AdditionalPropertiesWithArrayOfEnums1](../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums) +extends [AdditionalPropertiesWithArrayOfEnums1](../../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) +extends [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](../../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index 1418fafcf3f..5d2c32c9a42 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -22,84 +22,8 @@ public static class Put1 extends ApiClient.ApiClient1 implements PutOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md index 16f5864b396..a3c6ea7cd01 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [FileSchemaTestClass1](../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass) +extends [FileSchemaTestClass1](../../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [FileSchemaTestClass.FileSchemaTestClass1](../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1) +extends [FileSchemaTestClass.FileSchemaTestClass1](../../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index 5b044c5f4e7..6bfd7245a02 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -24,110 +24,8 @@ public static class Put1 extends ApiClient.ApiClient1 implements PutOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md index 87ec51870cc..3433b43b8a4 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [User1](../../../../../../components/schemas/User.md#user) +extends [User1](../../../../../../../components/schemas/User.md#user) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../components/schemas/User.md#user1) +extends [User.User1](../../../../../../../components/schemas/User.md#user1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index 866755c2812..dd59e0b0e47 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -22,85 +22,8 @@ public static class Put1 extends ApiClient.ApiClient1 implements PutOperation
securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKeyQuery("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .fakeclassnametestPatchSecurityInfoSecurityIndex(FakeclassnametestPatchSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); - - -Client1BoxedMap requestBodyPayload = - Client.Client1.validateAndBox( - new Client.ClientMapBuilder1() - .client("a") - - .build(), - schemaConfiguration -); -RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PatchRequestBuilder() - .requestBody(requestBody) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.patch(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md index 3e252e7cdd7..2137564e12f 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md @@ -4,7 +4,7 @@ FakeclassnametestPatchSecurityInfo.java public class FakeclassnametestPatchSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [FakeclassnametestPatchSecurityRequirementObject0](../../../paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md) | security0 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakeclassnametestPatchSecurityRequirementObject0()](../../../paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md index 72d0a1a3ced..a4283fe34f8 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Client](../../../components/requestbodies/Client.md) +public class RequestBody extends [Client](../../components/requestbodies/Client.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client1](../../../components/requestbodies/Client.md#client1)
+public static class RequestBody1 extends [Client](../../components/requestbodies/Client.md#client1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md index 0651521d4b3..74c9bd15fba 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKeyQuery.class](../../../../components/securityschemes/ApiKeyQuery.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKeyQuery.class](../../../../components/securityschemes/ApiKeyQuery.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index 3a5bdb7bc60..f308e708d4c 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -22,85 +22,8 @@ public static class Delete1 extends ApiClient.ApiClient1 implements DeleteOperat a class that allows one to call the endpoint using a method named delete -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.RootServerInfo; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.CodedefaultResponse; -import org.openapijsonschematools.client.paths.fakedeletecoffeeid.Delete; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); - - -// Map validation -PathParameters.PathParametersMap pathParameters = - PathParameters.PathParameters1.validate( - new PathParameters.PathParametersMapBuilder() - .id("a") - - .build(), - schemaConfiguration -); - -var request = new DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.delete(request); -} 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 (response instanceof Responses.EndpointCode200Response castResponse) { -} else { - Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index 32d3de4ba5c..59d078db1ee 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -20,70 +20,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 6f01f31fd31..6d76b64b5dc 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -20,77 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakeinlinecomposition.post.RequestBody; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.QueryParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakeinlinecomposition.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -if (castResponse.body instanceof Code200Response.ApplicationjsonResponseBody deserializedBody) { - // handle deserialized body here -} else { - Code200Response.MultipartformdataResponseBody deserializedBody = (Code200Response.MultipartformdataResponseBody) castResponse.body; - // handle deserialized body here -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md index 42b8f6dd39d..7ffb61525e4 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md @@ -31,7 +31,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -43,12 +43,12 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -60,7 +60,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -95,34 +95,34 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index 1e911fb538b..50f6b327a13 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -20,70 +20,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index a186afc0763..627dd1e9048 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -20,70 +20,8 @@ public static class Patch1 extends ApiClient.ApiClient1 implements PatchOperatio a class that allows one to call the endpoint using a method named patch -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakejsonpatch.patch.RequestBody; -import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakejsonpatch.Patch; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); - - -var request = new PatchRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.patch(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md index 8f4044c6273..1030df8f6d8 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonpatchjsonMediaType public record ApplicationjsonpatchjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonpatchjsonRequestBody public record ApplicationjsonpatchjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json-patch+json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonpatchjsonRequestBody(ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) body)
Creates an instance | +| ApplicationjsonpatchjsonRequestBody(ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json-patch+json" | -| ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md index c8f50418586..d1984604169 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonpatchjsonSchema public class ApplicationjsonpatchjsonSchema
-extends [JSONPatchRequest1](../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest) +extends [JSONPatchRequest1](../../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonpatchjsonSchema1 public static class ApplicationjsonpatchjsonSchema1
-extends [JSONPatchRequest.JSONPatchRequest1](../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1) +extends [JSONPatchRequest.JSONPatchRequest1](../../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index c600ed01aee..a789ea7cacc 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -20,72 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakejsonwithcharset.post.RequestBody; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakejsonwithcharset.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.Applicationjsoncharsetutf8ResponseBody deserializedBody = (Code200Response.Applicationjsoncharsetutf8ResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md index 8e7015ce024..4d62929c09a 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## Applicationjsoncharsetutf8MediaType public record Applicationjsoncharsetutf8MediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1) | schema()
the schema for this MediaType | +| [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 0c5ce872d6c..7fcb3e8e9a4 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -20,72 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakemultiplerequestbodycontenttypes.post.RequestBody; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md index 5258ce593d8..3790fd6e579 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md @@ -31,7 +31,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -43,12 +43,12 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -60,7 +60,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -95,34 +95,34 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index 2b87ae47a1c..6bcd8534f05 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -20,76 +20,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); -securitySchemes.add( - new HttpBasicTest("someUserId", "somePassword"); -); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .fakemultiplesecuritiesGetSecurityInfoSecurityIndex(FakemultiplesecuritiesGetSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); - - -var request = new GetRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.get(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md index dfdd24f765d..202b98244be 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md @@ -4,7 +4,7 @@ FakemultiplesecuritiesGetSecurityInfo.java public class FakemultiplesecuritiesGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,9 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [FakemultiplesecuritiesGetSecurityRequirementObject0](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md) | security0 | -| [FakemultiplesecuritiesGetSecurityRequirementObject1](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md) | security1 | -| [FakemultiplesecuritiesGetSecurityRequirementObject2](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md) | security2 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakemultiplesecuritiesGetSecurityRequirementObject0()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [FakemultiplesecuritiesGetSecurityRequirementObject1()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new [FakemultiplesecuritiesGetSecurityRequirementObject2()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md index 2fc62ae0497..b642d36e8d5 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),
        List.of()
    ),
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),        List.of()    ),    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md index b073e315c8b..a59e0627a45 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index c54fe28b951..22c4630d3e6 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -20,69 +20,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index 77a14552f9d..1734ac7cfca 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -20,72 +20,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1) | schema()
the schema for this MediaType | +| [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index a9346a188ed..d7f708bfa38 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -22,92 +22,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakepetiduploadimagewithrequiredfile.post.RequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -// Map validation -PathParameters.PathParametersMap pathParameters = - PathParameters.PathParameters1.validate( - new PathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md index 7d31590a6a5..47cbe85d783 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md @@ -4,7 +4,7 @@ FakepetiduploadimagewithrequiredfilePostSecurityInfo.java public class FakepetiduploadimagewithrequiredfilePostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0](../../../paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md) | security0 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0()](../../../paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md index dfcea020fdb..26648d87300 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md index 3e58c101d48..e2e1adb6ae8 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index a1734c23862..cf90327aa5d 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -22,81 +22,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[AnimalFarm1Boxed](../../../components/schemas/AnimalFarm.md#animalfarm1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[AnimalFarm1Boxed](../../../../components/schemas/AnimalFarm.md#animalfarm1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[AnimalFarm1Boxed](../../../components/schemas/AnimalFarm.md#animalfarm1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[AnimalFarm1Boxed](../../../../components/schemas/AnimalFarm.md#animalfarm1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 1418728fbd4..f4786efc35d 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [AnimalFarm1](../../../../../../components/schemas/AnimalFarm.md#animalfarm) +extends [AnimalFarm1](../../../../../../../components/schemas/AnimalFarm.md#animalfarm) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [AnimalFarm.AnimalFarm1](../../../../../../components/schemas/AnimalFarm.md#animalfarm1) +extends [AnimalFarm.AnimalFarm1](../../../../../../../components/schemas/AnimalFarm.md#animalfarm1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index 05581875a20..3a6d686f74c 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -20,72 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakerefsarrayofenums.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakerefsarrayofenums.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md index 8cdc705b119..ae1cbe63ddf 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index c49c361c228..82450aa4900 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [ArrayOfEnums1](../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums) +extends [ArrayOfEnums1](../../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [ArrayOfEnums.ArrayOfEnums1](../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums1) +extends [ArrayOfEnums.ArrayOfEnums1](../../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index d2eb60a0c7a..91bf55a8053 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -20,72 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakerefsboolean.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.BooleanSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakerefsboolean.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md index 6097f74bea9..9e85a660909 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index d0446d3d804..1694ac4a00a 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [BooleanSchema1](../../../../../../components/schemas/BooleanSchema.md#booleanschema) +extends [BooleanSchema1](../../../../../../../components/schemas/BooleanSchema.md#booleanschema) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [BooleanSchema.BooleanSchema1](../../../../../../components/schemas/BooleanSchema.md#booleanschema1) +extends [BooleanSchema.BooleanSchema1](../../../../../../../components/schemas/BooleanSchema.md#booleanschema1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index 5e1b8b12e96..dfa19619600 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -20,72 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakerefscomposedoneofnumberwithvalidations.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md index 0e61ede331b..3c736c0054a 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 6d15e5f1438..1e3738551c2 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [ComposedOneOfDifferentTypes1](../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes) +extends [ComposedOneOfDifferentTypes1](../../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) +extends [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](../../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index 77f32d0c789..1165fe8a0d7 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -20,72 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakerefsenum.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.StringEnum; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakerefsenum.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md index 385c2e4a878..759f5de5c67 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[StringEnum1Boxed](../../../components/schemas/StringEnum.md#stringenum1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[StringEnum1Boxed](../../../../components/schemas/StringEnum.md#stringenum1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[StringEnum1Boxed](../../../components/schemas/StringEnum.md#stringenum1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[StringEnum1Boxed](../../../../components/schemas/StringEnum.md#stringenum1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index d83adaf246f..2ac02fd09b9 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [StringEnum1](../../../../../../components/schemas/StringEnum.md#stringenum) +extends [StringEnum1](../../../../../../../components/schemas/StringEnum.md#stringenum) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [StringEnum.StringEnum1](../../../../../../components/schemas/StringEnum.md#stringenum1) +extends [StringEnum.StringEnum1](../../../../../../../components/schemas/StringEnum.md#stringenum1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index cdcf9614119..54a746a8f69 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -22,75 +22,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.RootServerInfo; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.Mammal; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakerefsmammal.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PostRequestBuilder() - .requestBody(requestBody) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md index 64fb8aa98e1..6b08a8b5a27 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[Mammal1Boxed](../../../components/schemas/Mammal.md#mammal1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[Mammal1Boxed](../../../../components/schemas/Mammal.md#mammal1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[Mammal1Boxed](../../../components/schemas/Mammal.md#mammal1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[Mammal1Boxed](../../../../components/schemas/Mammal.md#mammal1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index b1b525d94da..f0a5b53544f 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [Mammal1](../../../../../../components/schemas/Mammal.md#mammal) +extends [Mammal1](../../../../../../../components/schemas/Mammal.md#mammal) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [Mammal.Mammal1](../../../../../../components/schemas/Mammal.md#mammal1) +extends [Mammal.Mammal1](../../../../../../../components/schemas/Mammal.md#mammal1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index 076da420c03..b14e8af78a6 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -20,72 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakerefsnumber.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.NumberWithValidations; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakerefsnumber.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md index bf52e31b42d..22ca5825b4d 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index a6a485e5657..a903474b2ee 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [NumberWithValidations1](../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations) +extends [NumberWithValidations1](../../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [NumberWithValidations.NumberWithValidations1](../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1) +extends [NumberWithValidations.NumberWithValidations1](../../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 4b07291c56b..569e2c4a6c6 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -20,72 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakerefsobjectmodelwithrefprops.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md index fa402eba521..6d81f6580ca 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 0cdc2140e3a..495e07e6094 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [ObjectModelWithRefProps1](../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops) +extends [ObjectModelWithRefProps1](../../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [ObjectModelWithRefProps.ObjectModelWithRefProps1](../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) +extends [ObjectModelWithRefProps.ObjectModelWithRefProps1](../../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 5ef61bea0e5..12fdec36a3e 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -20,72 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakerefsstring.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.StringSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakerefsstring.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md index dadb1fcd877..546531f6ffd 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index abe4f0713c9..8fadd779761 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [StringSchema1](../../../../../../components/schemas/StringSchema.md#stringschema) +extends [StringSchema1](../../../../../../../components/schemas/StringSchema.md#stringschema) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [StringSchema.StringSchema1](../../../../../../components/schemas/StringSchema.md#stringschema1) +extends [StringSchema.StringSchema1](../../../../../../../components/schemas/StringSchema.md#stringschema1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index 71e144d57ba..a8e1f04cf2d 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -20,68 +20,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1) | schema()
the schema for this MediaType | +| [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index 7501fc1831a..4942566ce4c 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -20,72 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakeuploadfile.post.RequestBody; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakeuploadfile.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md index bd73b367e08..50e947003b9 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index e3775d87065..04889c52b27 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -20,72 +20,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.fakeuploadfiles.post.RequestBody; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.fakeuploadfiles.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -var request = new PostRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md index 0b3ec075d2c..2f0056fe248 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index 15119587928..3d59d81d0fd 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -20,89 +20,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
class that stores a server index | | enum | [FooGetServerInfo.ServerIndex](#serverindex)
class that stores a server index | -## FooGetServerInfo1 -implements ServerProvider<[ServerIndex](#serverindex)>
- -A class that stores servers and allows one to be returned with a ServerIndex instance - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| FooGetServerInfo1()
Creates an instance using default server variable values | -| FooGetServerInfo1(@Nullable [FooGetServer0](../../../paths/foo/get/servers/FooGetServer0.md) server0,@Nullable [FooGetServer1](../../../paths/foo/get/servers/FooGetServer1.md) server1)
Creates an instance using passed in servers | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [FooGetServer0](../../../paths/foo/get/servers/FooGetServer0.md) | server0 | -| [FooGetServer1](../../../paths/foo/get/servers/FooGetServer1.md) | server1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Server | getServer([ServerIndex](#serverindex) serverIndex) | - ## ServerIndex enum ServerIndex
diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index f23d6c37030..48dbbe20d67 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -22,130 +22,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.RootServerInfo; -import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; -import org.openapijsonschematools.client.paths.pet.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.Pet; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.paths.pet.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.pet.post.responses.Code405Response; -import org.openapijsonschematools.client.paths.pet.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .petPostSecurityInfoSecurityIndex(PetPostSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -Pet1BoxedMap requestBodyPayload = - Pet.Pet1.validateAndBox( - new Pet.PetMapBuilder() - .name("a") - - .photoUrls( - Arrays.asList( - "a" - ) - ) - .id(1L) - - .category( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "name", - "a" - ), - new AbstractMap.SimpleEntry( - "id", - 1L - ) - ) - ) - .tags( - Arrays.asList( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "name", - "a" - ) - ) - ) - ) - .status("available") - - .build(), - schemaConfiguration -); -RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PostRequestBuilder() - .requestBody(requestBody) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (Code405Response.ResponseApiException e) { - // server returned an error response defined in the openapi document - throw e; -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index 26a031cc6ef..f02961e0d91 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -22,126 +22,8 @@ public static class Put1 extends ApiClient.ApiClient1 implements PutOperation
securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .petPutSecurityInfoSecurityIndex(PetPutSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); - - -Pet1BoxedMap requestBodyPayload = - Pet.Pet1.validateAndBox( - new Pet.PetMapBuilder() - .name("a") - - .photoUrls( - Arrays.asList( - "a" - ) - ) - .id(1L) - - .category( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "name", - "a" - ), - new AbstractMap.SimpleEntry( - "id", - 1L - ) - ) - ) - .tags( - Arrays.asList( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "name", - "a" - ) - ) - ) - ) - .status("available") - - .build(), - schemaConfiguration -); -RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PutRequestBuilder() - .requestBody(requestBody) - .build(); - -Void response; -try { - response = apiClient.put(request); -} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException | Code405Response.ResponseApiException e) { - // server returned an error response defined in the openapi document - throw e; -} 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; -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md b/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md index 233fdd10e78..bfcbdaed682 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md @@ -4,7 +4,7 @@ PetPostSecurityInfo.java public class PetPostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,9 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [PetPostSecurityRequirementObject0](../../../paths/pet/post/security/PetPostSecurityRequirementObject0.md) | security0 | -| [PetPostSecurityRequirementObject1](../../../paths/pet/post/security/PetPostSecurityRequirementObject1.md) | security1 | -| [PetPostSecurityRequirementObject2](../../../paths/pet/post/security/PetPostSecurityRequirementObject2.md) | security2 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetPostSecurityRequirementObject0()](../../../paths/pet/post/security/PetPostSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetPostSecurityRequirementObject1()](../../../paths/pet/post/security/PetPostSecurityRequirementObject1.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new [PetPostSecurityRequirementObject2()](../../../paths/pet/post/security/PetPostSecurityRequirementObject2.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md b/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md index ee81d9d563b..da70cdc38c1 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Pet](../../../components/requestbodies/Pet.md) +public class RequestBody extends [Pet](../../components/requestbodies/Pet.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Pet1](../../../components/requestbodies/Pet.md#pet1)
+public static class RequestBody1 extends [Pet](../../components/requestbodies/Pet.md#pet1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md index dc904ae9529..34870b66eb6 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md index 4ffc2e46b31..1cb682b7915 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md index 88db581a2d6..ccb5edf9c7a 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md +++ b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md b/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md index 1136055dad2..1f13f8174c2 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md @@ -4,7 +4,7 @@ PetPutSecurityInfo.java public class PetPutSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,8 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [PetPutSecurityRequirementObject0](../../../paths/pet/put/security/PetPutSecurityRequirementObject0.md) | security0 | -| [PetPutSecurityRequirementObject1](../../../paths/pet/put/security/PetPutSecurityRequirementObject1.md) | security1 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetPutSecurityRequirementObject0()](../../../paths/pet/put/security/PetPutSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetPutSecurityRequirementObject1()](../../../paths/pet/put/security/PetPutSecurityRequirementObject1.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md b/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md index ee81d9d563b..da70cdc38c1 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Pet](../../../components/requestbodies/Pet.md) +public class RequestBody extends [Pet](../../components/requestbodies/Pet.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Pet1](../../../components/requestbodies/Pet.md#pet1)
+public static class RequestBody1 extends [Pet](../../components/requestbodies/Pet.md#pet1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md index a0bb52235ba..23269a709b1 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md index 9dd305982f5..d57a44d83e2 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 3c051b1b538..535451d5ccc 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -22,100 +22,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .petfindbystatusGetSecurityInfoSecurityIndex(PetfindbystatusGetSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); - - -// Map validation -QueryParameters.QueryParametersMap queryParameters = - QueryParameters.QueryParameters1.validate( - new QueryParameters.QueryParametersMapBuilder() - .status( - Arrays.asList( - "available" - ) - ) - .build(), - schemaConfiguration -); - -var request = new GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (Code400Response.ResponseApiException e) { - // server returned an error response defined in the openapi document - throw e; -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md b/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md index 65da91a672e..8eaa744bf52 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md @@ -4,37 +4,13 @@ PetfindbystatusServerInfo.java public class PetfindbystatusServerInfo A class that provides a server, and any needed server info classes -- a class that is a ServerProvider - an enum class that stores server index values ## Nested Class Summary | Modifier and Type | Class and Description | | ----------------- | --------------------- | -| static class | [PetfindbystatusServerInfo.PetfindbystatusServerInfo1](#petfindbystatusserverinfo1)
class that stores a server index | | enum | [PetfindbystatusServerInfo.ServerIndex](#serverindex)
class that stores a server index | -## PetfindbystatusServerInfo1 -implements ServerProvider<[ServerIndex](#serverindex)>
- -A class that stores servers and allows one to be returned with a ServerIndex instance - -### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PetfindbystatusServerInfo1()
Creates an instance using default server variable values | -| PetfindbystatusServerInfo1(@Nullable [PetfindbystatusServer0](../../paths/petfindbystatus/servers/PetfindbystatusServer0.md) server0,@Nullable [PetfindbystatusServer1](../../paths/petfindbystatus/servers/PetfindbystatusServer1.md) server1)
Creates an instance using passed in servers | - -### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | --------------------- | -| [PetfindbystatusServer0](../../paths/petfindbystatus/servers/PetfindbystatusServer0.md) | server0 | -| [PetfindbystatusServer1](../../paths/petfindbystatus/servers/PetfindbystatusServer1.md) | server1 | - -### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Server | getServer([ServerIndex](#serverindex) serverIndex) | - ## ServerIndex enum ServerIndex
diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md index a0bc58eb967..c3cc586c35b 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md @@ -4,7 +4,7 @@ PetfindbystatusGetSecurityInfo.java public class PetfindbystatusGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,9 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [PetfindbystatusGetSecurityRequirementObject0](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md) | security0 | -| [PetfindbystatusGetSecurityRequirementObject1](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md) | security1 | -| [PetfindbystatusGetSecurityRequirementObject2](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md) | security2 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetfindbystatusGetSecurityRequirementObject0()](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetfindbystatusGetSecurityRequirementObject1()](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new [PetfindbystatusGetSecurityRequirementObject2()](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md index 608eb248028..a656f810b95 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md index 6749160f760..d505ac57b5b 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md index 7f0527ce9f7..38f9d7030cc 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index 685df8f5a4b..a3032f20dbd 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -22,98 +22,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .petfindbytagsGetSecurityInfoSecurityIndex(PetfindbytagsGetSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); - - -// Map validation -QueryParameters.QueryParametersMap queryParameters = - QueryParameters.QueryParameters1.validate( - new QueryParameters.QueryParametersMapBuilder() - .tags( - Arrays.asList( - "a" - ) - ) - .build(), - schemaConfiguration -); - -var request = new GetRequestBuilder() - .queryParameters(queryParameters) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (Code400Response.ResponseApiException e) { - // server returned an error response defined in the openapi document - throw e; -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md index ea6339e8f26..9d0ab412696 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md @@ -4,7 +4,7 @@ PetfindbytagsGetSecurityInfo.java public class PetfindbytagsGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,8 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [PetfindbytagsGetSecurityRequirementObject0](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md) | security0 | -| [PetfindbytagsGetSecurityRequirementObject1](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md) | security1 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetfindbytagsGetSecurityRequirementObject0()](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetfindbytagsGetSecurityRequirementObject1()](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md index 256a672a40f..8cec8cbafe3 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md index 39a130b834f..003dc335aa8 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index 1f5d91cb3a3..c4c7ca08460 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -22,96 +22,8 @@ public static class Delete1 extends ApiClient.ApiClient1 implements DeleteOperat a class that allows one to call the endpoint using a method named delete -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.petpetid.delete.HeaderParameters; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.delete.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.paths.petpetid.delete.responses.Code400Response; -import org.openapijsonschematools.client.paths.petpetid.Delete; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .petpetidDeleteSecurityInfoSecurityIndex(PetpetidDeleteSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); - - -// Map validation -PathParameters.PathParametersMap pathParameters = - PathParameters.PathParameters1.validate( - new PathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Void response; -try { - response = apiClient.delete(request); -} catch (Code400Response.ResponseApiException e) { - // server returned an error response defined in the openapi document - throw e; -} 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; -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index 7716f7374fc..e3e7328fb47 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -22,103 +22,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .petpetidGetSecurityInfoSecurityIndex(PetpetidGetSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); - - -// Map validation -PathParameters.PathParametersMap pathParameters = - PathParameters.PathParameters1.validate( - new PathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new GetRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.get(request); -} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { - // server returned an error response defined in the openapi document - throw e; -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -if (castResponse.body instanceof Code200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index ae19e21515d..3518498d3af 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -22,96 +22,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.petpetid.post.RequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetid.post.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.ApiKey; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.paths.petpetid.post.responses.Code405Response; -import org.openapijsonschematools.client.paths.petpetid.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -List securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .petpetidPostSecurityInfoSecurityIndex(PetpetidPostSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -// Map validation -PathParameters.PathParametersMap pathParameters = - PathParameters.PathParameters1.validate( - new PathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Void response; -try { - response = apiClient.post(request); -} catch (Code405Response.ResponseApiException e) { - // server returned an error response defined in the openapi document - throw e; -} 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; -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md index 0a71b0d01f1..78dca588af1 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md @@ -4,7 +4,7 @@ PetpetidDeleteSecurityInfo.java public class PetpetidDeleteSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,8 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [PetpetidDeleteSecurityRequirementObject0](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md) | security0 | -| [PetpetidDeleteSecurityRequirementObject1](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md) | security1 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetidDeleteSecurityRequirementObject0()](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetpetidDeleteSecurityRequirementObject1()](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md index f80b6f15b40..1bfbaa536d1 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md index 8877bdea9a3..70dcf48c967 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md index c6615ea3fa9..f6403d11468 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md @@ -4,7 +4,7 @@ PetpetidGetSecurityInfo.java public class PetpetidGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [PetpetidGetSecurityRequirementObject0](../../../paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md) | security0 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetidGetSecurityRequirementObject0()](../../../paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md index 77bfdbe2448..6a56d6d61e7 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md index 915b9ce6f7c..18f25e685bf 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md @@ -4,7 +4,7 @@ PetpetidPostSecurityInfo.java public class PetpetidPostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,8 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [PetpetidPostSecurityRequirementObject0](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md) | security0 | -| [PetpetidPostSecurityRequirementObject1](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md) | security1 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetidPostSecurityRequirementObject0()](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetpetidPostSecurityRequirementObject1()](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md b/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md index 672ae8e9af1..37eadc5c54d 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationxwwwformurlencodedMediaType public record ApplicationxwwwformurlencodedMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md index 0e8d3540345..cd3e742dcd2 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md index fb9621d4c1e..ad6ba36e84e 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index b2cb8065834..7dd09fbfb2d 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -22,92 +22,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.paths.petpetiduploadimage.post.RequestBody; -import org.openapijsonschematools.client.RootServerInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; -import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.Code200Response; -import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; -import org.openapijsonschematools.client.paths.petpetiduploadimage.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -List securitySchemes = new ArrayList(); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .petpetiduploadimagePostSecurityInfoSecurityIndex(PetpetiduploadimagePostSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -// Map validation -PathParameters.PathParametersMap pathParameters = - PathParameters.PathParameters1.validate( - new PathParameters.PathParametersMapBuilder() - .petId(1L) - - .build(), - schemaConfiguration -); - -var request = new PostRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md index a6c84397204..5c45e3b65b1 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md @@ -4,7 +4,7 @@ PetpetiduploadimagePostSecurityInfo.java public class PetpetiduploadimagePostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [PetpetiduploadimagePostSecurityRequirementObject0](../../../paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md) | security0 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetiduploadimagePostSecurityRequirementObject0()](../../../paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md index d65d0664340..c5faf95b33b 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md index adb3502a449..e31f5956998 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index e98e2da79f5..03e0717d96e 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -20,68 +20,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); -securitySchemes.add( - new ApiKey("someApiKey"); -); -ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); - .storeinventoryGetSecurityInfoSecurityIndex(StoreinventoryGetSecurityInfo.SecurityIndex.SECURITY_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - securitySchemes, - securityIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); - - -var request = new GetRequestBuilder().build(); - -Responses.EndpointResponse response; -try { - response = apiClient.get(request); -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md index 2f5f07f0f26..eca03625ce0 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md @@ -4,7 +4,7 @@ StoreinventoryGetSecurityInfo.java public class StoreinventoryGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that is a SecurityRequirementObjectProvider +- a class that stores a securityIndex and provides a SecurityRequirementsObject - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| [StoreinventoryGetSecurityRequirementObject0](../../../paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md) | security0 | +| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [StoreinventoryGetSecurityRequirementObject0()](../../../paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md)
)); | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md index d979d8cb08c..ae36a11c931 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index e8b7295b563..626f3ab09c0 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -22,102 +22,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.RootServerInfo; -import org.openapijsonschematools.client.paths.storeorder.post.RequestBody; -import org.openapijsonschematools.client.components.schemas.Order; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.storeorder.post.responses.Code200Response; -import org.openapijsonschematools.client.paths.storeorder.post.responses.Code400Response; -import org.openapijsonschematools.client.paths.storeorder.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -Order1BoxedMap requestBodyPayload = - Order.Order1.validateAndBox( - new Order.OrderMapBuilder() - .id(1L) - - .petId(1L) - - .quantity(1) - - .shipDate("1970-01-01T00:00:00.00Z") - - .status("placed") - - .complete(true) - - .build(), - schemaConfiguration -); -Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PostRequestBuilder() - .requestBody(requestBody) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} catch (Code400Response.ResponseApiException e) { - // server returned an error response defined in the openapi document - throw e; -} 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; -} -Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; -if (castResponse.body instanceof Code200Response.ApplicationxmlResponseBody deserializedBody) { - // handle deserialized body here -} else { - Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; - // handle deserialized body here -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md b/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md index 98ae13f9473..64d7782838d 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[Order1Boxed](../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[Order1Boxed](../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 25524457185..e069f9c21c8 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [Order1](../../../../../../components/schemas/Order.md#order) +extends [Order1](../../../../../../../components/schemas/Order.md#order) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [Order.Order1](../../../../../../components/schemas/Order.md#order1) +extends [Order.Order1](../../../../../../../components/schemas/Order.md#order1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index e84a5ca3713..e6ee67aaee0 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -22,84 +22,8 @@ public static class Delete1 extends ApiClient.ApiClient1 implements DeleteOperat a class that allows one to call the endpoint using a method named delete -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.RootServerInfo; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.PathParameters; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code400Response; -import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code404Response; -import org.openapijsonschematools.client.paths.storeorderorderid.Delete; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); - - -// Map validation -PathParameters.PathParametersMap pathParameters = - PathParameters.PathParameters1.validate( - new PathParameters.PathParametersMapBuilder() - .order_id("a") - - .build(), - schemaConfiguration -); - -var request = new DeleteRequestBuilder() - .pathParameters(pathParameters) - .build(); - -Void response; -try { - response = apiClient.delete(request); -} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { - // server returned an error response defined in the openapi document - throw e; -} 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; -} -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index 21415665295..707115a6828 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -22,92 +22,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 87ec51870cc..3433b43b8a4 100644 --- a/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [User1](../../../../../../components/schemas/User.md#user) +extends [User1](../../../../../../../components/schemas/User.md#user) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../components/schemas/User.md#user1) +extends [User.User1](../../../../../../../components/schemas/User.md#user1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index 4a59f7a599d..30ef103ec9c 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -22,120 +22,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.RootServerInfo; -import org.openapijsonschematools.client.paths.usercreatewitharray.post.RequestBody; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.CodedefaultResponse; -import org.openapijsonschematools.client.paths.usercreatewitharray.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -ApplicationjsonSchema1BoxedList requestBodyPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( - new ApplicationjsonSchema.ApplicationjsonSchemaListBuilder() - .add( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "id", - 1L - ), - new AbstractMap.SimpleEntry( - "username", - "a" - ), - new AbstractMap.SimpleEntry( - "firstName", - "a" - ), - new AbstractMap.SimpleEntry( - "lastName", - "a" - ), - new AbstractMap.SimpleEntry( - "email", - "a" - ), - new AbstractMap.SimpleEntry( - "password", - "a" - ), - new AbstractMap.SimpleEntry( - "phone", - "a" - ), - new AbstractMap.SimpleEntry( - "userStatus", - 1 - ), - new AbstractMap.SimpleEntry( - "objectWithNoDeclaredPropsNullable", - null - ) - ) - ) - .build(), - schemaConfiguration -); -RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PostRequestBuilder() - .requestBody(requestBody) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md index c3f2cf9f53e..33628aac017 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [UserArray](../../../components/requestbodies/UserArray.md) +public class RequestBody extends [UserArray](../../components/requestbodies/UserArray.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [UserArray1](../../../components/requestbodies/UserArray.md#userarray1)
+public static class RequestBody1 extends [UserArray](../../components/requestbodies/UserArray.md#userarray1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index 1692dc67f66..1f7279bdc8b 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -22,120 +22,8 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -### Code Sample -``` -import org.openapijsonschematools.client.configurations.ApiConfiguration; -import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -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.RootServerInfo; -import org.openapijsonschematools.client.paths.usercreatewithlist.post.RequestBody; -import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; -import org.openapijsonschematools.client.servers.Server0; -import org.openapijsonschematools.client.servers.Server1; -import org.openapijsonschematools.client.servers.Server2; -import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.CodedefaultResponse; -import org.openapijsonschematools.client.paths.usercreatewithlist.Post; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below -ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( - new Server0(), - null, - null -); -ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() - .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); -Duration timeout = Duration.ofSeconds(1L); -ApiConfiguration apiConfiguration = new ApiConfiguration( - serverInfo - serverIndexInfo, - timeout -); -SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); -Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); - - -ApplicationjsonSchema1BoxedList requestBodyPayload = - ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( - new ApplicationjsonSchema.ApplicationjsonSchemaListBuilder() - .add( - MapUtils.makeMap( - new AbstractMap.SimpleEntry( - "id", - 1L - ), - new AbstractMap.SimpleEntry( - "username", - "a" - ), - new AbstractMap.SimpleEntry( - "firstName", - "a" - ), - new AbstractMap.SimpleEntry( - "lastName", - "a" - ), - new AbstractMap.SimpleEntry( - "email", - "a" - ), - new AbstractMap.SimpleEntry( - "password", - "a" - ), - new AbstractMap.SimpleEntry( - "phone", - "a" - ), - new AbstractMap.SimpleEntry( - "userStatus", - 1 - ), - new AbstractMap.SimpleEntry( - "objectWithNoDeclaredPropsNullable", - null - ) - ) - ) - .build(), - schemaConfiguration -); -RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); - -var request = new PostRequestBuilder() - .requestBody(requestBody) - .build(); - -Responses.EndpointResponse response; -try { - response = apiClient.post(request); -} 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; -} -Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; -``` +TODO code sample + ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md index 8a4cde3614a..63751df47b6 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [RefUserArray](../../../components/requestbodies/RefUserArray.md) +public class RequestBody extends [RefUserArray](../../components/requestbodies/RefUserArray.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [RefUserArray1](../../../components/requestbodies/RefUserArray.md#refuserarray1)
+public static class RequestBody1 extends [RefUserArray](../../components/requestbodies/RefUserArray.md#refuserarray1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index e7361ffeef9..a8324e391e3 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -22,94 +22,8 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md index 87ec51870cc..3433b43b8a4 100644 --- a/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [User1](../../../../../../components/schemas/User.md#user) +extends [User1](../../../../../../../components/schemas/User.md#user) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../components/schemas/User.md#user1) +extends [User.User1](../../../../../../../components/schemas/User.md#user1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/servers/Server0.md b/samples/client/petstore/java/docs/servers/Server0.md index 199ec6ccd47..4612ee1d333 100644 --- a/samples/client/petstore/java/docs/servers/Server0.md +++ b/samples/client/petstore/java/docs/servers/Server0.md @@ -11,12 +11,499 @@ petstore server | Constructor and Description | | --------------------------- | | Server0()
Creates a server using default values for variables | -| Server0([Variables.VariablesMap](../servers/server0/Variables.md#variablesmap) variables)
Creates a server using input values for variables | +| Server0([Variables.VariablesMap](#variablesmap) variables)
Creates a server using input values for variables | ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | | String | url = "http://{server}.swagger.io:{port}/v2" | -| [Variables.VariablesMap](../servers/server0/Variables.md#variablesmap) | variables | +| [Variables.VariablesMap](#variablesmap) | variables | + +## Variables +public class Variables
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads +- enum classes + +### Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Variables.Variables1Boxed](#variables1boxed)
sealed interface for validated payloads | +| record | [Variables.Variables1BoxedMap](#variables1boxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.Variables1](#variables1)
schema class | +| static class | [Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | +| static class | [Variables.VariablesMap](#variablesmap)
output class for Map payloads | +| sealed interface | [Variables.PortBoxed](#portboxed)
sealed interface for validated payloads | +| record | [Variables.PortBoxedString](#portboxedstring)
boxed class to store validated String payloads | +| static class | [Variables.Port](#port)
schema class | +| enum | [Variables.StringPortEnums](#stringportenums)
String enum | +| sealed interface | [Variables.ServerBoxed](#serverboxed)
sealed interface for validated payloads | +| record | [Variables.ServerBoxedString](#serverboxedstring)
boxed class to store validated String payloads | +| static class | [Variables.Server](#server)
schema class | +| enum | [Variables.StringServerEnums](#stringserverenums)
String enum | +| sealed interface | [Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.AdditionalProperties](#additionalproperties)
schema class | + +### Variables1Boxed +public sealed interface Variables1Boxed
+permits
+[Variables1BoxedMap](#variables1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +### Variables1BoxedMap +public record Variables1BoxedMap
+implements [Variables1Boxed](#variables1boxed) + +record that stores validated Map payloads, sealed permits implementation + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Variables1BoxedMap([VariablesMap](#variablesmap) data)
Creates an instance, private visibility | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +### Variables1 +public static class Variables1
+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.servers.server0.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// Map validation +Variables.VariablesMap validatedPayload = + Variables.Variables1.validate( + new Variables.VariablesMapBuilder() + .port("80") + + .server("petstore") + + .build(), + configuration +); +``` + +#### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("server", [Server.class](#server))),
    new PropertyEntry("port", [Port.class](#port)))
)
| +| Set | required = Set.of(
    "port",
    "server"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | validate([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1BoxedMap](#variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1Boxed](#variables1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +### VariablesMap00Builder +public class VariablesMap00Builder
+builder for `Map` + +A class that builds the Map input type + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMap00Builder(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 | + +### VariablesMap01Builder +public class VariablesMap01Builder
+builder for `Map` + +A class that builds the Map input type + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMap01Builder(Map instance)
Creates a builder that contains the passed instance | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap00Builder](#variablesmap00builder) | server(String value) | +| [VariablesMap00Builder](#variablesmap00builder) | server([StringServerEnums](#stringserverenums) value) | + +### VariablesMap10Builder +public class VariablesMap10Builder
+builder for `Map` + +A class that builds the Map input type + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMap10Builder(Map instance)
Creates a builder that contains the passed instance | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap00Builder](#variablesmap00builder) | port(String value) | +| [VariablesMap00Builder](#variablesmap00builder) | port([StringPortEnums](#stringportenums) value) | + +### VariablesMapBuilder +public class VariablesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMapBuilder()
Creates a builder that contains an empty map | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap01Builder](#variablesmap01builder) | port(String value) | +| [VariablesMap01Builder](#variablesmap01builder) | port([StringPortEnums](#stringportenums) value) | +| [VariablesMap10Builder](#variablesmap10builder) | server(String value) | +| [VariablesMap10Builder](#variablesmap10builder) | server([StringServerEnums](#stringserverenums) value) | + +### VariablesMap +public static class VariablesMap
+extends FrozenMap + +A class to store validated Map payloads + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [VariablesMap](#variablesmap) | of([Map](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| String | port()
must be one of ["80", "8080"] if omitted the server will use the default value of 80 | +| String | server()
must be one of ["petstore", "qa-petstore", "dev-petstore"] if omitted the server will use the default value of petstore | + +### PortBoxed +public sealed interface PortBoxed
+permits
+[PortBoxedString](#portboxedstring) + +sealed interface that stores validated payloads using boxed classes + +### PortBoxedString +public record PortBoxedString
+implements [PortBoxed](#portboxed) + +record that stores validated String payloads, sealed permits implementation + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PortBoxedString(String data)
Creates an instance, private visibility | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +### Port +public static class Port
+extends JsonSchema + +A schema class that validates payloads + +### Description +the port + +#### 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.servers.server0.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// String validation +String validatedPayload = Variables.Port.validate( + "80", + configuration +); +``` + +#### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "80",
    "8080"
)
| +| @Nullable Object | defaultValue = "80" | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringPortEnums](#stringportenums) arg, SchemaConfiguration configuration) | +| [PortBoxedString](#portboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [PortBoxed](#portboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +### StringPortEnums +public enum StringPortEnums
+extends `Enum` + +A class that stores String enum values + +#### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_80 | value = "80" | +| POSITIVE_8080 | value = "8080" | + +### ServerBoxed +public sealed interface ServerBoxed
+permits
+[ServerBoxedString](#serverboxedstring) + +sealed interface that stores validated payloads using boxed classes + +### ServerBoxedString +public record ServerBoxedString
+implements [ServerBoxed](#serverboxed) + +record that stores validated String payloads, sealed permits implementation + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ServerBoxedString(String data)
Creates an instance, private visibility | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +### Server +public static class Server
+extends JsonSchema + +A schema class that validates payloads + +### Description +server host prefix + +#### 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.servers.server0.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// String validation +String validatedPayload = Variables.Server.validate( + "petstore", + configuration +); +``` + +#### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "petstore",
    "qa-petstore",
    "dev-petstore"
)
| +| @Nullable Object | defaultValue = "petstore" | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringServerEnums](#stringserverenums) arg, SchemaConfiguration configuration) | +| [ServerBoxedString](#serverboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [ServerBoxed](#serverboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +### StringServerEnums +public enum StringServerEnums
+extends `Enum` + +A class that stores String enum values + +#### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| PETSTORE | value = "petstore" | +| QA_HYPHEN_MINUS_PETSTORE | value = "qa-petstore" | +| DEV_HYPHEN_MINUS_PETSTORE | value = "dev-petstore" | + +### AdditionalPropertiesBoxed +public 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 +public record AdditionalPropertiesBoxedVoid
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated null payloads, sealed permits implementation + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Void data)
Creates an instance, private visibility | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Void | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +### AdditionalPropertiesBoxedBoolean +public record 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 | +| @Nullable Object | getData()
validated payload | + +### AdditionalPropertiesBoxedNumber +public record AdditionalPropertiesBoxedNumber
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +### AdditionalPropertiesBoxedString +public record AdditionalPropertiesBoxedString
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +### AdditionalPropertiesBoxedList +public record AdditionalPropertiesBoxedList
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated List payloads, sealed permits implementation + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +### AdditionalPropertiesBoxedMap +public record AdditionalPropertiesBoxedMap
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated Map payloads, sealed permits implementation + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +### AdditionalProperties +public static 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 Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/java/docs/servers/Server1.md b/samples/client/petstore/java/docs/servers/Server1.md index 8c170c320c6..9fb232ff697 100644 --- a/samples/client/petstore/java/docs/servers/Server1.md +++ b/samples/client/petstore/java/docs/servers/Server1.md @@ -11,12 +11,368 @@ The local server | Constructor and Description | | --------------------------- | | Server1()
Creates a server using default values for variables | -| Server1([Variables.VariablesMap](../servers/server1/Variables.md#variablesmap) variables)
Creates a server using input values for variables | +| Server1([Variables.VariablesMap](#variablesmap) variables)
Creates a server using input values for variables | ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | | String | url = "https://localhost:8080/{version}" | -| [Variables.VariablesMap](../servers/server1/Variables.md#variablesmap) | variables | +| [Variables.VariablesMap](#variablesmap) | variables | + +## Variables +public class Variables
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, java version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads +- enum classes + +### Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Variables.Variables1Boxed](#variables1boxed)
sealed interface for validated payloads | +| record | [Variables.Variables1BoxedMap](#variables1boxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.Variables1](#variables1)
schema class | +| static class | [Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | +| static class | [Variables.VariablesMap](#variablesmap)
output class for Map payloads | +| sealed interface | [Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | +| record | [Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | +| static class | [Variables.Version](#version)
schema class | +| enum | [Variables.StringVersionEnums](#stringversionenums)
String enum | +| sealed interface | [Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [Variables.AdditionalProperties](#additionalproperties)
schema class | + +### Variables1Boxed +public sealed interface Variables1Boxed
+permits
+[Variables1BoxedMap](#variables1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +### Variables1BoxedMap +public record Variables1BoxedMap
+implements [Variables1Boxed](#variables1boxed) + +record that stores validated Map payloads, sealed permits implementation + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Variables1BoxedMap([VariablesMap](#variablesmap) data)
Creates an instance, private visibility | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +### Variables1 +public static class Variables1
+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.servers.server1.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// Map validation +Variables.VariablesMap validatedPayload = + Variables.Variables1.validate( + new Variables.VariablesMapBuilder() + .version("v1") + + .build(), + configuration +); +``` + +#### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(Map.class) | +| Map> | properties = Map.ofEntries(
    new PropertyEntry("version", [Version.class](#version)))
)
| +| Set | required = Set.of(
    "version"
)
| +| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap](#variablesmap) | validate([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1BoxedMap](#variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| [Variables1Boxed](#variables1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +### VariablesMap0Builder +public class VariablesMap0Builder
+builder for `Map` + +A class that builds the Map input type + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMap0Builder(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 | + +### VariablesMapBuilder +public class VariablesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VariablesMapBuilder()
Creates a builder that contains an empty map | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [VariablesMap0Builder](#variablesmap0builder) | version(String value) | +| [VariablesMap0Builder](#variablesmap0builder) | version([StringVersionEnums](#stringversionenums) value) | + +### VariablesMap +public static class VariablesMap
+extends FrozenMap + +A class to store validated Map payloads + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [VariablesMap](#variablesmap) | of([Map](#variablesmapbuilder) arg, SchemaConfiguration configuration) | +| String | version()
must be one of ["v1", "v2"] if omitted the server will use the default value of v2 | + +### VersionBoxed +public sealed interface VersionBoxed
+permits
+[VersionBoxedString](#versionboxedstring) + +sealed interface that stores validated payloads using boxed classes + +### VersionBoxedString +public record VersionBoxedString
+implements [VersionBoxed](#versionboxed) + +record that stores validated String payloads, sealed permits implementation + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| VersionBoxedString(String data)
Creates an instance, private visibility | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +### Version +public static class Version
+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.servers.server1.Variables; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); + +// String validation +String validatedPayload = Variables.Version.validate( + "v1", + configuration +); +``` + +#### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = Set.of(
    String.class
)
| +| Set | enumValues = SetMaker.makeSet(
    "v1",
    "v2"
)
| +| @Nullable Object | defaultValue = "v2" | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(String arg, SchemaConfiguration configuration) | +| String | validate([StringVersionEnums](#stringversionenums) arg, SchemaConfiguration configuration) | +| [VersionBoxedString](#versionboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | +| [VersionBoxed](#versionboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | +| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | + +### StringVersionEnums +public enum StringVersionEnums
+extends `Enum` + +A class that stores String enum values + +#### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| V1 | value = "v1" | +| V2 | value = "v2" | + +### AdditionalPropertiesBoxed +public 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 +public record AdditionalPropertiesBoxedVoid
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated null payloads, sealed permits implementation + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Void data)
Creates an instance, private visibility | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Void | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +### AdditionalPropertiesBoxedBoolean +public record 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 | +| @Nullable Object | getData()
validated payload | + +### AdditionalPropertiesBoxedNumber +public record AdditionalPropertiesBoxedNumber
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +### AdditionalPropertiesBoxedString +public record AdditionalPropertiesBoxedString
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record 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 | +| @Nullable Object | getData()
validated payload | + +### AdditionalPropertiesBoxedList +public record AdditionalPropertiesBoxedList
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated List payloads, sealed permits implementation + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +### AdditionalPropertiesBoxedMap +public record AdditionalPropertiesBoxedMap
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated Map payloads, sealed permits implementation + +#### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | + +#### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap<@Nullable Object> | data()
validated payload | +| @Nullable Object | getData()
validated payload | + +### AdditionalProperties +public static 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 Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java index b9ad3b615a8..b94c5bb4b28 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java @@ -1,5 +1,6 @@ package org.openapijsonschematools.client; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -7,40 +8,75 @@ import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; +import java.util.AbstractMap; +import java.util.Map; import java.util.Objects; +import java.util.EnumMap; -public class RootServerInfo { - public static class RootServerInfo1 implements ServerProvider { - public final Server0 server0; - public final Server1 server1; - public final Server2 server2; +public class RootServerInfo implements ServerProvider { + final private Servers servers; + final private ServerIndex serverIndex; - public RootServerInfo1() { - server0 = new Server0(); - server1 = new Server1(); - server2 = new Server2(); + public RootServerInfo() { + this.servers = new Servers(); + this.serverIndex = ServerIndex.SERVER_0; + } + + public RootServerInfo(Servers servers, ServerIndex serverIndex) { + this.servers = servers; + this.serverIndex = serverIndex; + } + + public static class Servers { + private final EnumMap servers; + + public Servers() { + servers = new EnumMap<>( + Map.ofEntries( + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_0, + new Server0() + ), + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_1, + new Server1() + ), + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_2, + new Server2() + ) + ) + ); } - public RootServerInfo1( + public Servers( @Nullable Server0 server0, @Nullable Server1 server1, @Nullable Server2 server2 ) { - this.server0 = Objects.requireNonNullElseGet(server0, Server0::new); - this.server1 = Objects.requireNonNullElseGet(server1, Server1::new); - this.server2 = Objects.requireNonNullElseGet(server2, Server2::new); + servers = new EnumMap<>( + Map.ofEntries( + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_0, + Objects.requireNonNullElseGet(server0, Server0::new) + ), + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_1, + Objects.requireNonNullElseGet(server1, Server1::new) + ), + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_2, + Objects.requireNonNullElseGet(server2, Server2::new) + ) + ) + ); } - @Override - public Server getServer(ServerIndex serverIndex) { - switch (serverIndex) { - case SERVER_0: - return server0; - case SERVER_1: - return server1; - default: - return server2; + public Server get(ServerIndex serverIndex) { + if (servers.containsKey(serverIndex)) { + return get(serverIndex); } + throw new UnsetPropertyException(serverIndex+" is unset"); } } @@ -49,4 +85,11 @@ public enum ServerIndex { SERVER_1, SERVER_2 } + + public Server getServer(@Nullable ServerIndex serverIndex) { + if (serverIndex == null) { + return servers.get(this.serverIndex); + } + return servers.get(serverIndex); + } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java index 2a240c51127..5d91b356758 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java @@ -5,6 +5,7 @@ import org.openapijsonschematools.client.components.headers.int32jsoncontenttypeheader.content.applicationjson.Int32JsonContentTypeHeaderSchema; import java.util.AbstractMap; +import java.util.Map; public class Int32JsonContentTypeHeader { @@ -24,7 +25,9 @@ public Int32JsonContentTypeHeader1() { true, null, false, - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java index 7f46cc4b68c..14fb0ea2ef2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java @@ -5,6 +5,7 @@ import org.openapijsonschematools.client.components.headers.refcontentschemaheader.content.applicationjson.RefContentSchemaHeaderSchema; import java.util.AbstractMap; +import java.util.Map; public class RefContentSchemaHeader { @@ -24,7 +25,9 @@ public RefContentSchemaHeader1() { true, null, false, - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java index f26059d9b43..be499256cb1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java @@ -6,6 +6,7 @@ import org.openapijsonschematools.client.components.parameters.componentrefschemastringwithvalidation.content.applicationjson.ApplicationjsonSchema; import java.util.AbstractMap; +import java.util.Map; public class ComponentRefSchemaStringWithValidation { @@ -28,7 +29,9 @@ public ComponentRefSchemaStringWithValidation1() { null, null, false, - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java index fdf11d477dd..4c4ca5901c7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.components.requestbodies; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public Client1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java index 74110c3f0fc..8a7f7c6e732 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.components.requestbodies; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -49,7 +48,7 @@ public Pet1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java index 5b0a97f4d57..f94e5690f59 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.components.requestbodies; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public UserArray1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java index 55abb17fdbd..9e4ba1794ae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.components.schemas.User; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -95,12 +96,12 @@ public ApplicationjsonSchemaList getNewInstance(List arg, List pathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof User.UserMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((User.UserMap) itemInstance); i += 1; @@ -120,29 +121,29 @@ public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration confi } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java index 632e56e143c..3c5e23a79cb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.components.responses.headerswithnobody.HeadersWithNoBodyHeadersSchema; import org.openapijsonschematools.client.components.responses.headerswithnobody.Headers; @@ -25,12 +23,12 @@ public HeadersWithNoBody1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } @Override - protected HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java index d7d943ac519..c61f5c1dee0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public SuccessDescriptionOnly1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java index b694d846659..c1b9c74b65c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; @@ -41,14 +39,20 @@ public SuccessInlineContentAndHeader1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override - protected SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java index e48fd69140e..61a2d19f509 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; @@ -41,14 +39,20 @@ public SuccessWithJsonApiResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override - protected SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java index ab4cafafef3..7ed6c0ef51e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationjson.ApplicationjsonSchema; @@ -52,15 +50,19 @@ public SuccessfulXmlAndJsonArrayOfPet1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java index f84e00f8370..d0cbaf812f0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.components.responses.headerswithnobody.headers.location.LocationSchema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -129,7 +130,7 @@ public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +138,12 @@ public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -150,7 +151,7 @@ public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException { + public HeadersWithNoBodyHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,29 +163,29 @@ public HeadersWithNoBodyHeadersSchemaMap validate(Map arg, SchemaConfigura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeadersWithNoBodyHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeadersWithNoBodyHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new HeadersWithNoBodyHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public HeadersWithNoBodyHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public HeadersWithNoBodyHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java index 2d47eb20745..cf00c44021c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java @@ -12,6 +12,7 @@ import org.openapijsonschematools.client.components.schemas.RefPet; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -96,12 +97,12 @@ public ApplicationjsonSchemaList getNewInstance(List arg, List pathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Pet.PetMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((Pet.PetMap) itemInstance); i += 1; @@ -121,29 +122,29 @@ public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration confi } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java index a04441ddc86..0ed36ee6a42 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.components.schemas.Pet; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -95,12 +96,12 @@ public ApplicationxmlSchemaList getNewInstance(List arg, List pathToI itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Pet.PetMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((Pet.PetMap) itemInstance); i += 1; @@ -120,29 +121,29 @@ public ApplicationxmlSchemaList validate(List arg, SchemaConfiguration config } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxmlSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxmlSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxmlSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationxmlSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxmlSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java index 2c88c985d14..227e14f64b5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.headers.someheader.SomeHeaderSchema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -129,7 +130,7 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map ar for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +138,12 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map ar Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -150,7 +151,7 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map ar return new SuccessInlineContentAndHeaderHeadersSchemaMap(castProperties); } - public SuccessInlineContentAndHeaderHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SuccessInlineContentAndHeaderHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,29 +163,29 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap validate(Map arg, Sch @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SuccessInlineContentAndHeaderHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SuccessInlineContentAndHeaderHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SuccessInlineContentAndHeaderHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public SuccessInlineContentAndHeaderHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public SuccessInlineContentAndHeaderHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java index a6103068681..7d1f6c17975 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -128,7 +129,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -136,12 +137,12 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -149,7 +150,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -161,29 +162,29 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java index 1c691e76d47..e5a54a4d001 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.components.schemas.StringWithValidation; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -64,7 +65,7 @@ public static SuccessWithJsonApiResponseHeadersSchemaMap of(Map arg, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -477,7 +478,7 @@ public SuccessWithJsonApiResponseHeadersSchemaMap getNewInstance(Map arg, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -487,7 +488,7 @@ public SuccessWithJsonApiResponseHeadersSchemaMap getNewInstance(Map arg, return new SuccessWithJsonApiResponseHeadersSchemaMap(castProperties); } - public SuccessWithJsonApiResponseHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SuccessWithJsonApiResponseHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -499,29 +500,29 @@ public SuccessWithJsonApiResponseHeadersSchemaMap validate(Map arg, Schema @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SuccessWithJsonApiResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SuccessWithJsonApiResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SuccessWithJsonApiResponseHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public SuccessWithJsonApiResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public SuccessWithJsonApiResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java index 4fbba3d77fb..0491701ee19 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -54,27 +55,19 @@ public static AbstractStepMessageMap of(Map } public @Nullable Object description() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("description"); } public String discriminator() { @Nullable Object value = get("discriminator"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for discriminator"); + throw new InvalidTypeException("Invalid value stored for discriminator"); } return (String) value; } public @Nullable Object sequenceNumber() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("sequenceNumber"); } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -396,7 +389,7 @@ public AbstractStepMessageMap getNewInstance(Map arg, List pathToI for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -404,7 +397,7 @@ public AbstractStepMessageMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -414,7 +407,7 @@ public AbstractStepMessageMap getNewInstance(Map arg, List pathToI return new AbstractStepMessageMap(castProperties); } - public AbstractStepMessageMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AbstractStepMessageMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -426,29 +419,29 @@ public AbstractStepMessageMap validate(Map arg, SchemaConfiguration config @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AbstractStepMessage1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AbstractStepMessage1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AbstractStepMessage1BoxedMap(validate(arg, configuration)); } @Override - public AbstractStepMessage1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AbstractStepMessage1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java index 3426c014963..e5c4d17f293 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -126,7 +127,7 @@ public MapPropertyMap getNewInstance(Map arg, List pathToItem, Pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -134,12 +135,12 @@ public MapPropertyMap getNewInstance(Map arg, List pathToItem, Pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -147,7 +148,7 @@ public MapPropertyMap getNewInstance(Map arg, List pathToItem, Pat return new MapPropertyMap(castProperties); } - public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -159,29 +160,29 @@ public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MapPropertyBoxedMap(validate(arg, configuration)); } @Override - public MapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -280,7 +281,7 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -288,12 +289,12 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -301,7 +302,7 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo return new AdditionalPropertiesMap(castProperties); } - public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,29 +314,29 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration confi @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -423,7 +424,7 @@ public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -431,12 +432,12 @@ public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof AdditionalPropertiesMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (AdditionalPropertiesMap) propertyInstance); } @@ -444,7 +445,7 @@ public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem return new MapOfMapPropertyMap(castProperties); } - public MapOfMapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapOfMapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -456,29 +457,29 @@ public MapOfMapPropertyMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapOfMapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapOfMapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MapOfMapPropertyBoxedMap(validate(arg, configuration)); } @Override - public MapOfMapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MapOfMapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -666,7 +667,7 @@ public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -674,7 +675,7 @@ public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -684,7 +685,7 @@ public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List return new MapWithUndeclaredPropertiesAnytype3Map(castProperties); } - public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -696,29 +697,29 @@ public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapWithUndeclaredPropertiesAnytype3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapWithUndeclaredPropertiesAnytype3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MapWithUndeclaredPropertiesAnytype3BoxedMap(validate(arg, configuration)); } @Override - public MapWithUndeclaredPropertiesAnytype3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MapWithUndeclaredPropertiesAnytype3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -796,7 +797,7 @@ public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -804,7 +805,7 @@ public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -814,7 +815,7 @@ public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathTo return new EmptyMapMap(castProperties); } - public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -826,29 +827,29 @@ public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EmptyMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public EmptyMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EmptyMapBoxedMap(validate(arg, configuration)); } @Override - public EmptyMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public EmptyMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -947,7 +948,7 @@ public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -955,12 +956,12 @@ public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -968,7 +969,7 @@ public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException { + public MapWithUndeclaredPropertiesStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -980,29 +981,29 @@ public MapWithUndeclaredPropertiesStringMap validate(Map arg, SchemaConfig @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapWithUndeclaredPropertiesStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapWithUndeclaredPropertiesStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MapWithUndeclaredPropertiesStringBoxedMap(validate(arg, configuration)); } @Override - public MapWithUndeclaredPropertiesStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MapWithUndeclaredPropertiesStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1031,7 +1032,7 @@ public MapPropertyMap map_property() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapPropertyMap)) { - throw new RuntimeException("Invalid value stored for map_property"); + throw new InvalidTypeException("Invalid value stored for map_property"); } return (MapPropertyMap) value; } @@ -1041,7 +1042,7 @@ public MapOfMapPropertyMap map_of_map_property() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapOfMapPropertyMap)) { - throw new RuntimeException("Invalid value stored for map_of_map_property"); + throw new InvalidTypeException("Invalid value stored for map_of_map_property"); } return (MapOfMapPropertyMap) value; } @@ -1055,7 +1056,7 @@ public FrozenMap map_with_undeclared_properties_anytype_1() throws UnsetPrope throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_1"); + throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_anytype_1"); } return (FrozenMap) value; } @@ -1065,7 +1066,7 @@ public FrozenMap map_with_undeclared_properties_anytype_2() throws UnsetPrope throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_2"); + throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_anytype_2"); } return (FrozenMap) value; } @@ -1075,7 +1076,7 @@ public MapWithUndeclaredPropertiesAnytype3Map map_with_undeclared_properties_any throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapWithUndeclaredPropertiesAnytype3Map)) { - throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_3"); + throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_anytype_3"); } return (MapWithUndeclaredPropertiesAnytype3Map) value; } @@ -1085,7 +1086,7 @@ public EmptyMapMap empty_map() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof EmptyMapMap)) { - throw new RuntimeException("Invalid value stored for empty_map"); + throw new InvalidTypeException("Invalid value stored for empty_map"); } return (EmptyMapMap) value; } @@ -1095,7 +1096,7 @@ public MapWithUndeclaredPropertiesStringMap map_with_undeclared_properties_strin throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapWithUndeclaredPropertiesStringMap)) { - throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_string"); + throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_string"); } return (MapWithUndeclaredPropertiesStringMap) value; } @@ -1346,7 +1347,7 @@ public AdditionalPropertiesClassMap getNewInstance(Map arg, List p for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1354,7 +1355,7 @@ public AdditionalPropertiesClassMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1364,7 +1365,7 @@ public AdditionalPropertiesClassMap getNewInstance(Map arg, List p return new AdditionalPropertiesClassMap(castProperties); } - public AdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1376,29 +1377,29 @@ public AdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalPropertiesClass1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java index cd38c0e0ee1..6cc2511dad8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -187,7 +188,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -195,7 +196,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -205,7 +206,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -217,29 +218,29 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -308,7 +309,7 @@ public static AdditionalProperties1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -320,7 +321,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -332,7 +333,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -343,24 +344,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -392,7 +393,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -419,7 +420,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -427,7 +428,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -437,7 +438,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -449,7 +450,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -464,10 +465,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -482,34 +483,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties1BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties1BoxedBoolean(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties1BoxedNumber(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties1BoxedString(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties1BoxedList(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -525,7 +526,7 @@ public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -668,7 +669,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -676,7 +677,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -686,7 +687,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -698,29 +699,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -789,7 +790,7 @@ public static AdditionalProperties2 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -801,7 +802,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -813,7 +814,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -824,24 +825,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -873,7 +874,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -900,7 +901,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -908,7 +909,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -918,7 +919,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -930,7 +931,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -945,10 +946,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -963,34 +964,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties2BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties2BoxedBoolean(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties2BoxedNumber(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties2BoxedString(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties2BoxedList(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties2BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1006,7 +1007,7 @@ public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1149,7 +1150,7 @@ public Schema2Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1157,7 +1158,7 @@ public Schema2Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1167,7 +1168,7 @@ public Schema2Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema2Map(castProperties); } - public Schema2Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema2Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1179,29 +1180,29 @@ public Schema2Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema2BoxedMap(validate(arg, configuration)); } @Override - public Schema2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1250,7 +1251,7 @@ public static AdditionalPropertiesSchema1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1258,7 +1259,7 @@ public static AdditionalPropertiesSchema1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1268,7 +1269,7 @@ public static AdditionalPropertiesSchema1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1280,29 +1281,29 @@ public static AdditionalPropertiesSchema1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalPropertiesSchema1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java index 2ed4a1f0360..bcbef03c5d4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -104,12 +105,12 @@ public AdditionalPropertiesList getNewInstance(List arg, List pathToI itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -129,29 +130,29 @@ public AdditionalPropertiesList validate(List arg, SchemaConfiguration config } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalPropertiesBoxedList(validate(arg, configuration)); } @Override - public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -168,7 +169,7 @@ public static AdditionalPropertiesWithArrayOfEnumsMap of(Map arg, Lis for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -256,12 +257,12 @@ public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(Map arg, Lis Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof AdditionalPropertiesList)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (AdditionalPropertiesList) propertyInstance); } @@ -269,7 +270,7 @@ public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(Map arg, Lis return new AdditionalPropertiesWithArrayOfEnumsMap(castProperties); } - public AdditionalPropertiesWithArrayOfEnumsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesWithArrayOfEnumsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -281,29 +282,29 @@ public AdditionalPropertiesWithArrayOfEnumsMap validate(Map arg, SchemaCon @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesWithArrayOfEnums1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesWithArrayOfEnums1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalPropertiesWithArrayOfEnums1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesWithArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesWithArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java index 4a116392673..b0ed926c90e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -148,7 +149,7 @@ public AddressMap getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -156,12 +157,12 @@ public AddressMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -169,7 +170,7 @@ public AddressMap getNewInstance(Map arg, List pathToItem, PathToS return new AddressMap(castProperties); } - public AddressMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AddressMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -181,29 +182,29 @@ public AddressMap validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Address1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Address1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Address1BoxedMap(validate(arg, configuration)); } @Override - public Address1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Address1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java index f65e1246b7b..bb25f8c14eb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -85,35 +86,35 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public ColorBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ColorBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ColorBoxedString(validate(arg, configuration)); } @Override - public ColorBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ColorBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -134,7 +135,7 @@ public static AnimalMap of(Map arg, SchemaCo public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for className"); + throw new InvalidTypeException("Invalid value stored for className"); } return (String) value; } @@ -144,7 +145,7 @@ public String color() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for color"); + throw new InvalidTypeException("Invalid value stored for color"); } return (String) value; } @@ -264,7 +265,7 @@ public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -272,7 +273,7 @@ public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -282,7 +283,7 @@ public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSc return new AnimalMap(castProperties); } - public AnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -294,29 +295,29 @@ public AnimalMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Animal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Animal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Animal1BoxedMap(validate(arg, configuration)); } @Override - public Animal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Animal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java index 56c1faea7aa..e6ee613c3e1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -100,12 +101,12 @@ public AnimalFarmList getNewInstance(List arg, List pathToItem, PathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Animal.AnimalMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((Animal.AnimalMap) itemInstance); i += 1; @@ -125,29 +126,29 @@ public AnimalFarmList validate(List arg, SchemaConfiguration configuration) t } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnimalFarm1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public AnimalFarm1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnimalFarm1BoxedList(validate(arg, configuration)); } @Override - public AnimalFarm1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AnimalFarm1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java index b93b1cd30eb..8b3f5b7cd09 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -100,7 +101,7 @@ public static UuidSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +113,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -124,7 +125,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,24 +136,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +185,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -211,7 +212,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,7 +220,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -229,7 +230,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -256,10 +257,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -274,34 +275,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UuidSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public UuidSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UuidSchemaBoxedVoid(validate(arg, configuration)); } @Override - public UuidSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public UuidSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UuidSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public UuidSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public UuidSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UuidSchemaBoxedNumber(validate(arg, configuration)); } @Override - public UuidSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public UuidSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UuidSchemaBoxedString(validate(arg, configuration)); } @Override - public UuidSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public UuidSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UuidSchemaBoxedList(validate(arg, configuration)); } @Override - public UuidSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public UuidSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UuidSchemaBoxedMap(validate(arg, configuration)); } @Override - public UuidSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public UuidSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -317,7 +318,7 @@ public UuidSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -385,7 +386,7 @@ public static Date getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -397,7 +398,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -409,7 +410,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -420,24 +421,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -469,7 +470,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -496,7 +497,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -504,7 +505,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -514,7 +515,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -526,7 +527,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -541,10 +542,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -559,34 +560,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public DateBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DateBoxedVoid(validate(arg, configuration)); } @Override - public DateBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public DateBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DateBoxedBoolean(validate(arg, configuration)); } @Override - public DateBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public DateBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DateBoxedNumber(validate(arg, configuration)); } @Override - public DateBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public DateBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DateBoxedString(validate(arg, configuration)); } @Override - public DateBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public DateBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DateBoxedList(validate(arg, configuration)); } @Override - public DateBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public DateBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DateBoxedMap(validate(arg, configuration)); } @Override - public DateBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DateBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -602,7 +603,7 @@ public DateBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -670,7 +671,7 @@ public static Datetime getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -682,7 +683,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -694,7 +695,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -705,24 +706,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -754,7 +755,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -781,7 +782,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -789,7 +790,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -799,7 +800,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -811,7 +812,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -826,10 +827,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -844,34 +845,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DatetimeBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public DatetimeBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DatetimeBoxedVoid(validate(arg, configuration)); } @Override - public DatetimeBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public DatetimeBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DatetimeBoxedBoolean(validate(arg, configuration)); } @Override - public DatetimeBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public DatetimeBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DatetimeBoxedNumber(validate(arg, configuration)); } @Override - public DatetimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public DatetimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DatetimeBoxedString(validate(arg, configuration)); } @Override - public DatetimeBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public DatetimeBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DatetimeBoxedList(validate(arg, configuration)); } @Override - public DatetimeBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public DatetimeBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DatetimeBoxedMap(validate(arg, configuration)); } @Override - public DatetimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DatetimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -887,7 +888,7 @@ public DatetimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -955,7 +956,7 @@ public static NumberSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -967,7 +968,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -979,7 +980,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -990,24 +991,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1039,7 +1040,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1066,7 +1067,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1074,7 +1075,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1084,7 +1085,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1096,7 +1097,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1111,10 +1112,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1129,34 +1130,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public NumberSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberSchemaBoxedVoid(validate(arg, configuration)); } @Override - public NumberSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public NumberSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberSchemaBoxedNumber(validate(arg, configuration)); } @Override - public NumberSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public NumberSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberSchemaBoxedString(validate(arg, configuration)); } @Override - public NumberSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public NumberSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberSchemaBoxedList(validate(arg, configuration)); } @Override - public NumberSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public NumberSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberSchemaBoxedMap(validate(arg, configuration)); } @Override - public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1172,7 +1173,7 @@ public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1240,7 +1241,7 @@ public static Binary getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1252,7 +1253,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1264,7 +1265,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1275,24 +1276,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1324,7 +1325,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1351,7 +1352,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1359,7 +1360,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1369,7 +1370,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1381,7 +1382,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1396,10 +1397,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1414,34 +1415,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BinaryBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public BinaryBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BinaryBoxedVoid(validate(arg, configuration)); } @Override - public BinaryBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public BinaryBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BinaryBoxedBoolean(validate(arg, configuration)); } @Override - public BinaryBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public BinaryBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BinaryBoxedNumber(validate(arg, configuration)); } @Override - public BinaryBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public BinaryBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BinaryBoxedString(validate(arg, configuration)); } @Override - public BinaryBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public BinaryBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BinaryBoxedList(validate(arg, configuration)); } @Override - public BinaryBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public BinaryBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BinaryBoxedMap(validate(arg, configuration)); } @Override - public BinaryBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public BinaryBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1457,7 +1458,7 @@ public BinaryBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1525,7 +1526,7 @@ public static Int32 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1537,7 +1538,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1549,7 +1550,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1560,24 +1561,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1609,7 +1610,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1636,7 +1637,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1644,7 +1645,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1654,7 +1655,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1666,7 +1667,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1681,10 +1682,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1699,34 +1700,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Int32BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Int32BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int32BoxedVoid(validate(arg, configuration)); } @Override - public Int32BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Int32BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int32BoxedBoolean(validate(arg, configuration)); } @Override - public Int32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Int32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int32BoxedNumber(validate(arg, configuration)); } @Override - public Int32BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Int32BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int32BoxedString(validate(arg, configuration)); } @Override - public Int32BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Int32BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int32BoxedList(validate(arg, configuration)); } @Override - public Int32BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Int32BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int32BoxedMap(validate(arg, configuration)); } @Override - public Int32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Int32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1742,7 +1743,7 @@ public Int32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1810,7 +1811,7 @@ public static Int64 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1822,7 +1823,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1834,7 +1835,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1845,24 +1846,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1894,7 +1895,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1921,7 +1922,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1929,7 +1930,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1939,7 +1940,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1951,7 +1952,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1966,10 +1967,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1984,34 +1985,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Int64BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Int64BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int64BoxedVoid(validate(arg, configuration)); } @Override - public Int64BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Int64BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int64BoxedBoolean(validate(arg, configuration)); } @Override - public Int64BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Int64BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int64BoxedNumber(validate(arg, configuration)); } @Override - public Int64BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Int64BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int64BoxedString(validate(arg, configuration)); } @Override - public Int64BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Int64BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int64BoxedList(validate(arg, configuration)); } @Override - public Int64BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Int64BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int64BoxedMap(validate(arg, configuration)); } @Override - public Int64Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Int64Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -2027,7 +2028,7 @@ public Int64Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2095,7 +2096,7 @@ public static DoubleSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2107,7 +2108,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2119,7 +2120,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2130,24 +2131,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2179,7 +2180,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -2206,7 +2207,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2214,7 +2215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -2224,7 +2225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2236,7 +2237,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -2251,10 +2252,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -2269,34 +2270,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DoubleSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public DoubleSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DoubleSchemaBoxedVoid(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public DoubleSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DoubleSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DoubleSchemaBoxedNumber(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public DoubleSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DoubleSchemaBoxedString(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public DoubleSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DoubleSchemaBoxedList(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public DoubleSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DoubleSchemaBoxedMap(validate(arg, configuration)); } @Override - public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -2312,7 +2313,7 @@ public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2380,7 +2381,7 @@ public static FloatSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2392,7 +2393,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2404,7 +2405,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2415,24 +2416,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2464,7 +2465,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -2491,7 +2492,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2499,7 +2500,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -2509,7 +2510,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2521,7 +2522,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -2536,10 +2537,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -2554,34 +2555,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FloatSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public FloatSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FloatSchemaBoxedVoid(validate(arg, configuration)); } @Override - public FloatSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public FloatSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FloatSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FloatSchemaBoxedNumber(validate(arg, configuration)); } @Override - public FloatSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public FloatSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FloatSchemaBoxedString(validate(arg, configuration)); } @Override - public FloatSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public FloatSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FloatSchemaBoxedList(validate(arg, configuration)); } @Override - public FloatSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FloatSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FloatSchemaBoxedMap(validate(arg, configuration)); } @Override - public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -2597,7 +2598,7 @@ public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -3283,7 +3284,7 @@ public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -3291,7 +3292,7 @@ public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -3301,7 +3302,7 @@ public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem return new AnyTypeAndFormatMap(castProperties); } - public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -3313,29 +3314,29 @@ public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyTypeAndFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeAndFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeAndFormat1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeAndFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeAndFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java index e9ebdac6dd9..13dfb48e9a9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -116,7 +117,7 @@ public static AnyTypeNotString1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -128,7 +129,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,7 +141,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -151,24 +152,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -200,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -227,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -235,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -245,7 +246,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -257,7 +258,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -272,10 +273,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -290,34 +291,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyTypeNotString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeNotString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeNotString1BoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeNotString1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeNotString1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeNotString1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeNotString1BoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeNotString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeNotString1BoxedString(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeNotString1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeNotString1BoxedList(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeNotString1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeNotString1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeNotString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeNotString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -333,7 +334,7 @@ public AnyTypeNotString1Boxed validateAndBox(@Nullable Object arg, SchemaConfigu } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java index bf0915b5b2d..19681cbe576 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -81,7 +82,7 @@ public Number code() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for code"); + throw new InvalidTypeException("Invalid value stored for code"); } return (Number) value; } @@ -91,7 +92,7 @@ public String type() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for type"); + throw new InvalidTypeException("Invalid value stored for type"); } return (String) value; } @@ -101,7 +102,7 @@ public String message() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for message"); + throw new InvalidTypeException("Invalid value stored for message"); } return (String) value; } @@ -230,7 +231,7 @@ public ApiResponseMap getNewInstance(Map arg, List pathToItem, Pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -238,7 +239,7 @@ public ApiResponseMap getNewInstance(Map arg, List pathToItem, Pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -248,7 +249,7 @@ public ApiResponseMap getNewInstance(Map arg, List pathToItem, Pat return new ApiResponseMap(castProperties); } - public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -260,29 +261,29 @@ public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApiResponseSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApiResponseSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApiResponseSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApiResponseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApiResponseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java index 9903c1e079c..1ff84d0d77f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java @@ -12,6 +12,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -76,29 +77,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public CultivarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public CultivarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new CultivarBoxedString(validate(arg, configuration)); } @Override - public CultivarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public CultivarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -149,29 +150,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OriginBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public OriginBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new OriginBoxedString(validate(arg, configuration)); } @Override - public OriginBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public OriginBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -192,7 +193,7 @@ public static AppleMap of(Map arg, SchemaCon public String cultivar() { @Nullable Object value = get("cultivar"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for cultivar"); + throw new InvalidTypeException("Invalid value stored for cultivar"); } return (String) value; } @@ -202,7 +203,7 @@ public String origin() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for origin"); + throw new InvalidTypeException("Invalid value stored for origin"); } return (String) value; } @@ -343,7 +344,7 @@ public AppleMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -351,7 +352,7 @@ public AppleMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -361,7 +362,7 @@ public AppleMap getNewInstance(Map arg, List pathToItem, PathToSch return new AppleMap(castProperties); } - public AppleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AppleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -373,40 +374,40 @@ public AppleMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Apple1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Apple1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Apple1BoxedVoid(validate(arg, configuration)); } @Override - public Apple1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Apple1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Apple1BoxedMap(validate(arg, configuration)); } @Override - public Apple1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Apple1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java index 51f1827adc1..e5e5ec8123c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -81,7 +82,7 @@ public static AppleReqMap of(Map arg, SchemaConfiguration config public String cultivar() { Object value = get("cultivar"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for cultivar"); + throw new InvalidTypeException("Invalid value stored for cultivar"); } return (String) value; } @@ -91,7 +92,7 @@ public boolean mealy() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for mealy"); + throw new InvalidTypeException("Invalid value stored for mealy"); } return (boolean) value; } @@ -203,7 +204,7 @@ public AppleReqMap getNewInstance(Map arg, List pathToItem, PathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -211,12 +212,12 @@ public AppleReqMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } 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"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } @@ -224,7 +225,7 @@ public AppleReqMap getNewInstance(Map arg, List pathToItem, PathTo return new AppleReqMap(castProperties); } - public AppleReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AppleReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -236,29 +237,29 @@ public AppleReqMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AppleReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AppleReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AppleReq1BoxedMap(validate(arg, configuration)); } @Override - public AppleReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AppleReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java index f103ccb7b11..6b80d6a622a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -151,7 +152,7 @@ public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToIt itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -173,29 +174,29 @@ public ArrayHoldingAnyTypeList validate(List arg, SchemaConfiguration configu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayHoldingAnyType1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayHoldingAnyType1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayHoldingAnyType1BoxedList(validate(arg, configuration)); } @Override - public ArrayHoldingAnyType1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayHoldingAnyType1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java index 65ee5a9b86d..b7f9fd7e937 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -127,12 +128,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -152,29 +153,29 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ItemsBoxedList(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -249,12 +250,12 @@ public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((ItemsList) itemInstance); i += 1; @@ -274,29 +275,29 @@ public ArrayArrayNumberList validate(List arg, SchemaConfiguration configurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayArrayNumberBoxedList(validate(arg, configuration)); } @Override - public ArrayArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -317,7 +318,7 @@ public ArrayArrayNumberList ArrayArrayNumber() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayArrayNumberList)) { - throw new RuntimeException("Invalid value stored for ArrayArrayNumber"); + throw new InvalidTypeException("Invalid value stored for ArrayArrayNumber"); } return (ArrayArrayNumberList) value; } @@ -408,7 +409,7 @@ public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pa for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -416,7 +417,7 @@ public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -426,7 +427,7 @@ public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pa return new ArrayOfArrayOfNumberOnlyMap(castProperties); } - public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -438,29 +439,29 @@ public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayOfArrayOfNumberOnly1BoxedMap(validate(arg, configuration)); } @Override - public ArrayOfArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java index d800ee9917b..8364d46380d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -113,12 +114,12 @@ public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, Pat itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((@Nullable String) itemInstance); i += 1; @@ -138,29 +139,29 @@ public ArrayOfEnumsList validate(List arg, SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfEnums1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfEnums1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayOfEnums1BoxedList(validate(arg, configuration)); } @Override - public ArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java index 60dbea4de6e..03b7659a3c1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -127,12 +128,12 @@ public ArrayNumberList getNewInstance(List arg, List pathToItem, Path itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -152,29 +153,29 @@ public ArrayNumberList validate(List arg, SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayNumberBoxedList(validate(arg, configuration)); } @Override - public ArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -195,7 +196,7 @@ public ArrayNumberList ArrayNumber() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayNumberList)) { - throw new RuntimeException("Invalid value stored for ArrayNumber"); + throw new InvalidTypeException("Invalid value stored for ArrayNumber"); } return (ArrayNumberList) value; } @@ -286,7 +287,7 @@ public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -294,7 +295,7 @@ public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -304,7 +305,7 @@ public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToIte return new ArrayOfNumberOnlyMap(castProperties); } - public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -316,29 +317,29 @@ public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayOfNumberOnly1BoxedMap(validate(arg, configuration)); } @Override - public ArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java index bad14500fe5..a6de7bc8168 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -113,12 +114,12 @@ public ArrayOfStringList getNewInstance(List arg, List pathToItem, Pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -138,29 +139,29 @@ public ArrayOfStringList validate(List arg, SchemaConfiguration configuration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfStringBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfStringBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayOfStringBoxedList(validate(arg, configuration)); } @Override - public ArrayOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -261,12 +262,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -286,29 +287,29 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Items1BoxedList(validate(arg, configuration)); } @Override - public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -383,12 +384,12 @@ public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToIt itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((ItemsList) itemInstance); i += 1; @@ -408,29 +409,29 @@ public ArrayArrayOfIntegerList validate(List arg, SchemaConfiguration configu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayArrayOfIntegerBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayArrayOfIntegerBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayArrayOfIntegerBoxedList(validate(arg, configuration)); } @Override - public ArrayArrayOfIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayArrayOfIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -505,12 +506,12 @@ public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ReadOnlyFirst.ReadOnlyFirstMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((ReadOnlyFirst.ReadOnlyFirstMap) itemInstance); i += 1; @@ -530,29 +531,29 @@ public ItemsList1 validate(List arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items3BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Items3BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Items3BoxedList(validate(arg, configuration)); } @Override - public Items3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Items3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -627,12 +628,12 @@ public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList1)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((ItemsList1) itemInstance); i += 1; @@ -652,29 +653,29 @@ public ArrayArrayOfModelList validate(List arg, SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayArrayOfModelBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayArrayOfModelBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayArrayOfModelBoxedList(validate(arg, configuration)); } @Override - public ArrayArrayOfModelBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayArrayOfModelBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -697,7 +698,7 @@ public ArrayOfStringList array_of_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayOfStringList)) { - throw new RuntimeException("Invalid value stored for array_of_string"); + throw new InvalidTypeException("Invalid value stored for array_of_string"); } return (ArrayOfStringList) value; } @@ -707,7 +708,7 @@ public ArrayArrayOfIntegerList array_array_of_integer() throws UnsetPropertyExce throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayArrayOfIntegerList)) { - throw new RuntimeException("Invalid value stored for array_array_of_integer"); + throw new InvalidTypeException("Invalid value stored for array_array_of_integer"); } return (ArrayArrayOfIntegerList) value; } @@ -717,7 +718,7 @@ public ArrayArrayOfModelList array_array_of_model() throws UnsetPropertyExceptio throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayArrayOfModelList)) { - throw new RuntimeException("Invalid value stored for array_array_of_model"); + throw new InvalidTypeException("Invalid value stored for array_array_of_model"); } return (ArrayArrayOfModelList) value; } @@ -840,7 +841,7 @@ public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -848,7 +849,7 @@ public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -858,7 +859,7 @@ public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathT return new ArrayTestMap(castProperties); } - public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -870,29 +871,29 @@ public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayTest1BoxedMap(validate(arg, configuration)); } @Override - public ArrayTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java index c397a603a61..99a7c45a8d2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -86,29 +87,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ItemsBoxedNumber(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -205,12 +206,12 @@ public ArrayWithValidationsInItemsList getNewInstance(List arg, List itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -230,29 +231,29 @@ public ArrayWithValidationsInItemsList validate(List arg, SchemaConfiguration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayWithValidationsInItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithValidationsInItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayWithValidationsInItems1BoxedList(validate(arg, configuration)); } @Override - public ArrayWithValidationsInItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithValidationsInItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java index f314e9f312f..ffa0682bd6c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -54,7 +55,7 @@ public static BananaMap of(Map arg, SchemaCo public Number lengthCm() { @Nullable Object value = get("lengthCm"); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for lengthCm"); + throw new InvalidTypeException("Invalid value stored for lengthCm"); } return (Number) value; } @@ -176,7 +177,7 @@ public BananaMap getNewInstance(Map arg, List pathToItem, PathToSc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -184,7 +185,7 @@ public BananaMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -194,7 +195,7 @@ public BananaMap getNewInstance(Map arg, List pathToItem, PathToSc return new BananaMap(castProperties); } - public BananaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public BananaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,29 +207,29 @@ public BananaMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Banana1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Banana1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Banana1BoxedMap(validate(arg, configuration)); } @Override - public Banana1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Banana1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java index 2e7fc44ef1e..9ca17cb18fc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -81,7 +82,7 @@ public static BananaReqMap of(Map arg, SchemaConfiguration confi public Number lengthCm() { Object value = get("lengthCm"); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for lengthCm"); + throw new InvalidTypeException("Invalid value stored for lengthCm"); } return (Number) value; } @@ -91,7 +92,7 @@ public boolean sweet() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for sweet"); + throw new InvalidTypeException("Invalid value stored for sweet"); } return (boolean) value; } @@ -221,7 +222,7 @@ public BananaReqMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -229,12 +230,12 @@ public BananaReqMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } 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"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } @@ -242,7 +243,7 @@ public BananaReqMap getNewInstance(Map arg, List pathToItem, PathT return new BananaReqMap(castProperties); } - public BananaReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public BananaReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,29 +255,29 @@ public BananaReqMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BananaReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public BananaReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BananaReq1BoxedMap(validate(arg, configuration)); } @Override - public BananaReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public BananaReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java index e62a21a1d0e..a46435968b3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -69,35 +70,35 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public Bar1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Bar1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Bar1BoxedString(validate(arg, configuration)); } @Override - public Bar1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Bar1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java index 726452e88a7..826127d11ee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -94,29 +95,29 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -135,7 +136,7 @@ public static BasquePigMap of(Map arg, Schem public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for className"); + throw new InvalidTypeException("Invalid value stored for className"); } return (String) value; } @@ -245,7 +246,7 @@ public BasquePigMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -253,7 +254,7 @@ public BasquePigMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -263,7 +264,7 @@ public BasquePigMap getNewInstance(Map arg, List pathToItem, PathT return new BasquePigMap(castProperties); } - public BasquePigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public BasquePigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -275,29 +276,29 @@ public BasquePigMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BasquePig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public BasquePig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BasquePig1BoxedMap(validate(arg, configuration)); } @Override - public BasquePig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public BasquePig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java index f9ac16b3542..0681c9d4961 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator; @@ -88,32 +89,32 @@ public boolean validate(BooleanBooleanEnumEnums arg,SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BooleanEnum1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public BooleanEnum1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BooleanEnum1BoxedBoolean(validate(arg, configuration)); } @Override - public BooleanEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public BooleanEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java index b36f13cc0c1..d5fb609e4e8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -116,7 +117,7 @@ public String smallCamel() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for smallCamel"); + throw new InvalidTypeException("Invalid value stored for smallCamel"); } return (String) value; } @@ -126,7 +127,7 @@ public String CapitalCamel() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for CapitalCamel"); + throw new InvalidTypeException("Invalid value stored for CapitalCamel"); } return (String) value; } @@ -136,7 +137,7 @@ public String small_Snake() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for small_Snake"); + throw new InvalidTypeException("Invalid value stored for small_Snake"); } return (String) value; } @@ -146,7 +147,7 @@ public String Capital_Snake() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for Capital_Snake"); + throw new InvalidTypeException("Invalid value stored for Capital_Snake"); } return (String) value; } @@ -156,7 +157,7 @@ public String SCA_ETH_Flow_Points() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for SCA_ETH_Flow_Points"); + throw new InvalidTypeException("Invalid value stored for SCA_ETH_Flow_Points"); } return (String) value; } @@ -166,7 +167,7 @@ public String ATT_NAME() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for ATT_NAME"); + throw new InvalidTypeException("Invalid value stored for ATT_NAME"); } return (String) value; } @@ -337,7 +338,7 @@ public CapitalizationMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -345,7 +346,7 @@ public CapitalizationMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -355,7 +356,7 @@ public CapitalizationMap getNewInstance(Map arg, List pathToItem, return new CapitalizationMap(castProperties); } - public CapitalizationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public CapitalizationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -367,29 +368,29 @@ public CapitalizationMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Capitalization1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Capitalization1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Capitalization1BoxedMap(validate(arg, configuration)); } @Override - public Capitalization1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Capitalization1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java index 1fd40713a14..b05aec208e2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -65,7 +66,7 @@ public boolean declawed() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for declawed"); + throw new InvalidTypeException("Invalid value stored for declawed"); } return (boolean) value; } @@ -150,7 +151,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,7 +159,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -168,7 +169,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,29 +181,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -280,7 +281,7 @@ public static Cat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -292,7 +293,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -304,7 +305,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -315,24 +316,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -364,7 +365,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -391,7 +392,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -399,7 +400,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -409,7 +410,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -421,7 +422,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -436,10 +437,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -454,34 +455,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Cat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Cat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Cat1BoxedVoid(validate(arg, configuration)); } @Override - public Cat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Cat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Cat1BoxedBoolean(validate(arg, configuration)); } @Override - public Cat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Cat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Cat1BoxedNumber(validate(arg, configuration)); } @Override - public Cat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Cat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Cat1BoxedString(validate(arg, configuration)); } @Override - public Cat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Cat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Cat1BoxedList(validate(arg, configuration)); } @Override - public Cat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Cat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Cat1BoxedMap(validate(arg, configuration)); } @Override - public Cat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Cat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -497,7 +498,7 @@ public Cat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java index cd5364ea788..b19f935049b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -85,35 +86,35 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public NameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public NameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NameBoxedString(validate(arg, configuration)); } @Override - public NameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -134,7 +135,7 @@ public static CategoryMap of(Map arg, Schema public String name() { @Nullable Object value = get("name"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); + throw new InvalidTypeException("Invalid value stored for name"); } return (String) value; } @@ -144,7 +145,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); + throw new InvalidTypeException("Invalid value stored for id"); } return (Number) value; } @@ -282,7 +283,7 @@ public CategoryMap getNewInstance(Map arg, List pathToItem, PathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -290,7 +291,7 @@ public CategoryMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -300,7 +301,7 @@ public CategoryMap getNewInstance(Map arg, List pathToItem, PathTo return new CategoryMap(castProperties); } - public CategoryMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public CategoryMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -312,29 +313,29 @@ public CategoryMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Category1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Category1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Category1BoxedMap(validate(arg, configuration)); } @Override - public Category1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Category1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java index 2b56cafb84b..fdb76bf0d38 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -65,7 +66,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); + throw new InvalidTypeException("Invalid value stored for name"); } return (String) value; } @@ -150,7 +151,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,7 +159,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -168,7 +169,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,29 +181,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -280,7 +281,7 @@ public static ChildCat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -292,7 +293,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -304,7 +305,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -315,24 +316,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -364,7 +365,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -391,7 +392,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -399,7 +400,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -409,7 +410,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -421,7 +422,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -436,10 +437,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -454,34 +455,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ChildCat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ChildCat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ChildCat1BoxedVoid(validate(arg, configuration)); } @Override - public ChildCat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ChildCat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ChildCat1BoxedBoolean(validate(arg, configuration)); } @Override - public ChildCat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ChildCat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ChildCat1BoxedNumber(validate(arg, configuration)); } @Override - public ChildCat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ChildCat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ChildCat1BoxedString(validate(arg, configuration)); } @Override - public ChildCat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ChildCat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ChildCat1BoxedList(validate(arg, configuration)); } @Override - public ChildCat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ChildCat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ChildCat1BoxedMap(validate(arg, configuration)); } @Override - public ChildCat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ChildCat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -497,7 +498,7 @@ public ChildCat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java index 21aab6cfc14..8949335b280 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -178,7 +179,7 @@ public static ClassModel1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -190,7 +191,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -202,7 +203,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -213,24 +214,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -262,7 +263,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -289,7 +290,7 @@ public ClassModelMap getNewInstance(Map arg, List pathToItem, Path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -297,7 +298,7 @@ public ClassModelMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -307,7 +308,7 @@ public ClassModelMap getNewInstance(Map arg, List pathToItem, Path return new ClassModelMap(castProperties); } - public ClassModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ClassModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -319,7 +320,7 @@ public ClassModelMap validate(Map arg, SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -334,10 +335,10 @@ public ClassModelMap validate(Map arg, SchemaConfiguration configuration) } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -352,34 +353,34 @@ public ClassModelMap validate(Map arg, SchemaConfiguration configuration) } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassModel1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ClassModel1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ClassModel1BoxedVoid(validate(arg, configuration)); } @Override - public ClassModel1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ClassModel1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ClassModel1BoxedBoolean(validate(arg, configuration)); } @Override - public ClassModel1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ClassModel1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ClassModel1BoxedNumber(validate(arg, configuration)); } @Override - public ClassModel1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ClassModel1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ClassModel1BoxedString(validate(arg, configuration)); } @Override - public ClassModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ClassModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ClassModel1BoxedList(validate(arg, configuration)); } @Override - public ClassModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ClassModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ClassModel1BoxedMap(validate(arg, configuration)); } @Override - public ClassModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ClassModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -395,7 +396,7 @@ public ClassModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java index 3585bd08508..9cd4880d680 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -56,7 +57,7 @@ public String client() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for client"); + throw new InvalidTypeException("Invalid value stored for client"); } return (String) value; } @@ -147,7 +148,7 @@ public ClientMap getNewInstance(Map arg, List pathToItem, PathToSc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -155,7 +156,7 @@ public ClientMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -165,7 +166,7 @@ public ClientMap getNewInstance(Map arg, List pathToItem, PathToSc return new ClientMap(castProperties); } - public ClientMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ClientMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,29 +178,29 @@ public ClientMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Client1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Client1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Client1BoxedMap(validate(arg, configuration)); } @Override - public Client1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Client1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java index 0f19e634466..0f5fe34f199 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -102,29 +103,29 @@ public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration conf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QuadrilateralTypeBoxedString(validate(arg, configuration)); } @Override - public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -145,7 +146,7 @@ public String quadrilateralType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for quadrilateralType"); + throw new InvalidTypeException("Invalid value stored for quadrilateralType"); } return (String) value; } @@ -236,7 +237,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -244,7 +245,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -254,7 +255,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -266,29 +267,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -366,7 +367,7 @@ public static ComplexQuadrilateral1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -378,7 +379,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -390,7 +391,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -401,24 +402,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -450,7 +451,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -477,7 +478,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -485,7 +486,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -495,7 +496,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -507,7 +508,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -522,10 +523,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -540,34 +541,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComplexQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ComplexQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComplexQuadrilateral1BoxedVoid(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ComplexQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComplexQuadrilateral1BoxedBoolean(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ComplexQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComplexQuadrilateral1BoxedNumber(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ComplexQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComplexQuadrilateral1BoxedString(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ComplexQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComplexQuadrilateral1BoxedList(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ComplexQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComplexQuadrilateral1BoxedMap(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ComplexQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -583,7 +584,7 @@ public ComplexQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java index d8a18a9d2f4..688e2a66912 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -269,7 +270,7 @@ public Schema9List getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -291,29 +292,29 @@ public Schema9List validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema9BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema9BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema9BoxedList(validate(arg, configuration)); } @Override - public Schema9Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema9Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -470,7 +471,7 @@ public static ComposedAnyOfDifferentTypesNoValidations1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -482,7 +483,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -494,7 +495,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -505,24 +506,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -554,7 +555,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -581,7 +582,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -589,7 +590,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -599,7 +600,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -611,7 +612,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -626,10 +627,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -644,34 +645,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedVoid(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedNumber(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedString(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedList(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedMap(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedAnyOfDifferentTypesNoValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -687,7 +688,7 @@ public ComposedAnyOfDifferentTypesNoValidations1Boxed validateAndBox(@Nullable O } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java index 71fd76caa3d..924341f499f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -151,7 +152,7 @@ public ComposedArrayList getNewInstance(List arg, List pathToItem, Pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -173,29 +174,29 @@ public ComposedArrayList validate(List arg, SchemaConfiguration configuration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedArray1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedArray1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedArray1BoxedList(validate(arg, configuration)); } @Override - public ComposedArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java index 7f34004555f..ec600363510 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; @@ -80,32 +81,32 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedBool1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedBool1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedBool1BoxedBoolean(validate(arg, configuration)); } @Override - public ComposedBool1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedBool1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java index 78930744e81..bee61f4d10f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -80,30 +81,30 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedNone1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedNone1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedNone1BoxedVoid(validate(arg, configuration)); } @Override - public ComposedNone1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedNone1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java index ef87afd4d8d..37c4b6c7c2c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -101,29 +102,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedNumber1BoxedNumber(validate(arg, configuration)); } @Override - public ComposedNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java index 9bfd1ae80f8..89afb88c828 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -79,7 +80,7 @@ public static ComposedObject1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -87,7 +88,7 @@ public static ComposedObject1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -97,7 +98,7 @@ public static ComposedObject1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -109,29 +110,29 @@ public static ComposedObject1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedObject1BoxedMap(validate(arg, configuration)); } @Override - public ComposedObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java index 44bb609f46b..100e117efda 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java @@ -15,6 +15,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -95,7 +96,7 @@ public static Schema4 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -103,7 +104,7 @@ public static Schema4 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -113,7 +114,7 @@ public static Schema4 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,29 +126,29 @@ public static Schema4 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema4BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema4BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema4BoxedMap(validate(arg, configuration)); } @Override - public Schema4Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema4Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -276,7 +277,7 @@ public Schema5List getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -298,29 +299,29 @@ public Schema5List validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema5BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema5BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema5BoxedList(validate(arg, configuration)); } @Override - public Schema5Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema5Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -371,29 +372,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema6BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Schema6BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema6BoxedString(validate(arg, configuration)); } @Override - public Schema6Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema6Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -477,7 +478,7 @@ public static ComposedOneOfDifferentTypes1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -489,7 +490,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -501,7 +502,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -512,24 +513,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -561,7 +562,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -588,7 +589,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -596,7 +597,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -606,7 +607,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -618,7 +619,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -633,10 +634,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -651,34 +652,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedOneOfDifferentTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedOneOfDifferentTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedOneOfDifferentTypes1BoxedVoid(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedOneOfDifferentTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedOneOfDifferentTypes1BoxedBoolean(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedOneOfDifferentTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedOneOfDifferentTypes1BoxedNumber(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedOneOfDifferentTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedOneOfDifferentTypes1BoxedString(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedOneOfDifferentTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedOneOfDifferentTypes1BoxedList(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedOneOfDifferentTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedOneOfDifferentTypes1BoxedMap(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedOneOfDifferentTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -694,7 +695,7 @@ public ComposedOneOfDifferentTypes1Boxed validateAndBox(@Nullable Object arg, Sc } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java index 6128d4db5d2..d4dc9ec084f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -82,29 +83,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ComposedString1BoxedString(validate(arg, configuration)); } @Override - public ComposedString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ComposedString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java index 7fd6478f0c7..cc540c8c2f9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -92,29 +93,29 @@ public String validate(StringCurrencyEnums arg,SchemaConfiguration configuration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Currency1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Currency1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Currency1BoxedString(validate(arg, configuration)); } @Override - public Currency1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Currency1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java index 0c514e9658f..9b28b43a094 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -94,29 +95,29 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -135,7 +136,7 @@ public static DanishPigMap of(Map arg, Schem public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for className"); + throw new InvalidTypeException("Invalid value stored for className"); } return (String) value; } @@ -245,7 +246,7 @@ public DanishPigMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -253,7 +254,7 @@ public DanishPigMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -263,7 +264,7 @@ public DanishPigMap getNewInstance(Map arg, List pathToItem, PathT return new DanishPigMap(castProperties); } - public DanishPigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public DanishPigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -275,29 +276,29 @@ public DanishPigMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DanishPig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public DanishPig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DanishPig1BoxedMap(validate(arg, configuration)); } @Override - public DanishPig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DanishPig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java index bfb26b9a3b0..5d34b2dc7b9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java @@ -8,6 +8,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -71,35 +72,35 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public DateTimeTest1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public DateTimeTest1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DateTimeTest1BoxedString(validate(arg, configuration)); } @Override - public DateTimeTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DateTimeTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java index 85d0db19fd4..eadd8a76100 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -73,29 +74,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateTimeWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public DateTimeWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DateTimeWithValidations1BoxedString(validate(arg, configuration)); } @Override - public DateTimeWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DateTimeWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java index 0f023d66745..c30a44c17dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -73,29 +74,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public DateWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DateWithValidations1BoxedString(validate(arg, configuration)); } @Override - public DateWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DateWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java index 26d207218d2..4732a7167ce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -65,7 +66,7 @@ public String breed() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for breed"); + throw new InvalidTypeException("Invalid value stored for breed"); } return (String) value; } @@ -150,7 +151,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,7 +159,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -168,7 +169,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,29 +181,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -280,7 +281,7 @@ public static Dog1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -292,7 +293,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -304,7 +305,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -315,24 +316,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -364,7 +365,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -391,7 +392,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -399,7 +400,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -409,7 +410,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -421,7 +422,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -436,10 +437,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -454,34 +455,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Dog1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Dog1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Dog1BoxedVoid(validate(arg, configuration)); } @Override - public Dog1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Dog1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Dog1BoxedBoolean(validate(arg, configuration)); } @Override - public Dog1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Dog1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Dog1BoxedNumber(validate(arg, configuration)); } @Override - public Dog1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Dog1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Dog1BoxedString(validate(arg, configuration)); } @Override - public Dog1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Dog1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Dog1BoxedList(validate(arg, configuration)); } @Override - public Dog1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Dog1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Dog1BoxedMap(validate(arg, configuration)); } @Override - public Dog1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Dog1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -497,7 +498,7 @@ public Dog1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java index d243bcfc3b9..9af29e766a2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -140,12 +141,12 @@ public ShapesList getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Object)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((@Nullable Object) itemInstance); i += 1; @@ -165,29 +166,29 @@ public ShapesList validate(List arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ShapesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ShapesBoxedList(validate(arg, configuration)); } @Override - public ShapesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ShapesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -211,7 +212,7 @@ public static DrawingMap of(Map arg, SchemaC throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new RuntimeException("Invalid value stored for mainShape"); + throw new InvalidTypeException("Invalid value stored for mainShape"); } return (@Nullable Object) value; } @@ -221,7 +222,7 @@ public static DrawingMap of(Map arg, SchemaC throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new RuntimeException("Invalid value stored for shapeOrNull"); + throw new InvalidTypeException("Invalid value stored for shapeOrNull"); } return (@Nullable Object) value; } @@ -231,7 +232,7 @@ public static DrawingMap of(Map arg, SchemaC throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new RuntimeException("Invalid value stored for nullableShape"); + throw new InvalidTypeException("Invalid value stored for nullableShape"); } return (@Nullable Object) value; } @@ -241,7 +242,7 @@ public ShapesList shapes() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ShapesList)) { - throw new RuntimeException("Invalid value stored for shapes"); + throw new InvalidTypeException("Invalid value stored for shapes"); } return (ShapesList) value; } @@ -250,7 +251,7 @@ public ShapesList shapes() throws UnsetPropertyException { throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof Object)) { - throw new RuntimeException("Invalid value stored for " + name); + throw new InvalidTypeException("Invalid value stored for " + name); } return (@Nullable Object) value; } @@ -597,7 +598,7 @@ public DrawingMap getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -605,7 +606,7 @@ public DrawingMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -615,7 +616,7 @@ public DrawingMap getNewInstance(Map arg, List pathToItem, PathToS return new DrawingMap(castProperties); } - public DrawingMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public DrawingMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -627,29 +628,29 @@ public DrawingMap validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Drawing1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Drawing1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Drawing1BoxedMap(validate(arg, configuration)); } @Override - public Drawing1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Drawing1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java index 073d51bc36f..1cb148337ee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -98,29 +99,29 @@ public String validate(StringJustSymbolEnums arg,SchemaConfiguration configurati } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JustSymbolBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public JustSymbolBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new JustSymbolBoxedString(validate(arg, configuration)); } @Override - public JustSymbolBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public JustSymbolBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringItemsEnums implements StringValueMethod { @@ -189,29 +190,29 @@ public String validate(StringItemsEnums arg,SchemaConfiguration configuration) t } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ItemsBoxedString(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -291,12 +292,12 @@ public ArrayEnumList getNewInstance(List arg, List pathToItem, PathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -316,29 +317,29 @@ public ArrayEnumList validate(List arg, SchemaConfiguration configuration) th } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayEnumBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayEnumBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayEnumBoxedList(validate(arg, configuration)); } @Override - public ArrayEnumBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayEnumBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -360,7 +361,7 @@ public String just_symbol() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for just_symbol"); + throw new InvalidTypeException("Invalid value stored for just_symbol"); } return (String) value; } @@ -370,7 +371,7 @@ public ArrayEnumList array_enum() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayEnumList)) { - throw new RuntimeException("Invalid value stored for array_enum"); + throw new InvalidTypeException("Invalid value stored for array_enum"); } return (ArrayEnumList) value; } @@ -483,7 +484,7 @@ public EnumArraysMap getNewInstance(Map arg, List pathToItem, Path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -491,7 +492,7 @@ public EnumArraysMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -501,7 +502,7 @@ public EnumArraysMap getNewInstance(Map arg, List pathToItem, Path return new EnumArraysMap(castProperties); } - public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -513,29 +514,29 @@ public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumArrays1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public EnumArrays1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EnumArrays1BoxedMap(validate(arg, configuration)); } @Override - public EnumArrays1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public EnumArrays1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java index f757027a167..2e135af5e31 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -100,35 +101,35 @@ public String validate(StringEnumClassEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public EnumClass1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public EnumClass1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EnumClass1BoxedString(validate(arg, configuration)); } @Override - public EnumClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public EnumClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java index 57432f3a3d3..b0ab185439e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java @@ -12,6 +12,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -108,29 +109,29 @@ public String validate(StringEnumStringEnums arg,SchemaConfiguration configurati } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public EnumStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EnumStringBoxedString(validate(arg, configuration)); } @Override - public EnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public EnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringEnumStringRequiredEnums implements StringValueMethod { @@ -201,29 +202,29 @@ public String validate(StringEnumStringRequiredEnums arg,SchemaConfiguration con } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumStringRequiredBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public EnumStringRequiredBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EnumStringRequiredBoxedString(validate(arg, configuration)); } @Override - public EnumStringRequiredBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public EnumStringRequiredBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum IntegerEnumIntegerEnums implements IntegerValueMethod { @@ -358,29 +359,29 @@ public double validate(DoubleEnumIntegerEnums arg,SchemaConfiguration configurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public EnumIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EnumIntegerBoxedNumber(validate(arg, configuration)); } @Override - public EnumIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public EnumIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum DoubleEnumNumberEnums implements DoubleValueMethod { @@ -474,29 +475,29 @@ public double validate(DoubleEnumNumberEnums arg,SchemaConfiguration configurati } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public EnumNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EnumNumberBoxedNumber(validate(arg, configuration)); } @Override - public EnumNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public EnumNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -524,7 +525,7 @@ public static EnumTestMap of(Map arg, Schema public String enum_string_required() { @Nullable Object value = get("enum_string_required"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for enum_string_required"); + throw new InvalidTypeException("Invalid value stored for enum_string_required"); } return (String) value; } @@ -534,7 +535,7 @@ public String enum_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for enum_string"); + throw new InvalidTypeException("Invalid value stored for enum_string"); } return (String) value; } @@ -544,7 +545,7 @@ public Number enum_integer() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for enum_integer"); + throw new InvalidTypeException("Invalid value stored for enum_integer"); } return (Number) value; } @@ -554,7 +555,7 @@ public Number enum_number() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for enum_number"); + throw new InvalidTypeException("Invalid value stored for enum_number"); } return (Number) value; } @@ -564,7 +565,7 @@ public Number enum_number() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for stringEnum"); + throw new InvalidTypeException("Invalid value stored for stringEnum"); } return (@Nullable String) value; } @@ -574,7 +575,7 @@ public Number IntegerEnum() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for IntegerEnum"); + throw new InvalidTypeException("Invalid value stored for IntegerEnum"); } return (Number) value; } @@ -584,7 +585,7 @@ public String StringEnumWithDefaultValue() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for StringEnumWithDefaultValue"); + throw new InvalidTypeException("Invalid value stored for StringEnumWithDefaultValue"); } return (String) value; } @@ -594,7 +595,7 @@ public Number IntegerEnumWithDefaultValue() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for IntegerEnumWithDefaultValue"); + throw new InvalidTypeException("Invalid value stored for IntegerEnumWithDefaultValue"); } return (Number) value; } @@ -604,7 +605,7 @@ public Number IntegerEnumOneValue() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for IntegerEnumOneValue"); + throw new InvalidTypeException("Invalid value stored for IntegerEnumOneValue"); } return (Number) value; } @@ -1058,7 +1059,7 @@ public EnumTestMap getNewInstance(Map arg, List pathToItem, PathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1066,7 +1067,7 @@ public EnumTestMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1076,7 +1077,7 @@ public EnumTestMap getNewInstance(Map arg, List pathToItem, PathTo return new EnumTestMap(castProperties); } - public EnumTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public EnumTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1088,29 +1089,29 @@ public EnumTestMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public EnumTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EnumTest1BoxedMap(validate(arg, configuration)); } @Override - public EnumTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public EnumTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java index fa4cfdf5976..511d329cb47 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -102,29 +103,29 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new TriangleTypeBoxedString(validate(arg, configuration)); } @Override - public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -145,7 +146,7 @@ public String triangleType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for triangleType"); + throw new InvalidTypeException("Invalid value stored for triangleType"); } return (String) value; } @@ -236,7 +237,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -244,7 +245,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -254,7 +255,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -266,29 +267,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -366,7 +367,7 @@ public static EquilateralTriangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -378,7 +379,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -390,7 +391,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -401,24 +402,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -450,7 +451,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -477,7 +478,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -485,7 +486,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -495,7 +496,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -507,7 +508,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -522,10 +523,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -540,34 +541,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EquilateralTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public EquilateralTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EquilateralTriangle1BoxedVoid(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public EquilateralTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EquilateralTriangle1BoxedBoolean(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public EquilateralTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EquilateralTriangle1BoxedNumber(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public EquilateralTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EquilateralTriangle1BoxedString(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public EquilateralTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EquilateralTriangle1BoxedList(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public EquilateralTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new EquilateralTriangle1BoxedMap(validate(arg, configuration)); } @Override - public EquilateralTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public EquilateralTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -583,7 +584,7 @@ public EquilateralTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java index d91798f4e93..4b2eb51f91e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -56,7 +57,7 @@ public String sourceURI() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for sourceURI"); + throw new InvalidTypeException("Invalid value stored for sourceURI"); } return (String) value; } @@ -149,7 +150,7 @@ public FileMap getNewInstance(Map arg, List pathToItem, PathToSche for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -157,7 +158,7 @@ public FileMap getNewInstance(Map arg, List pathToItem, PathToSche Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -167,7 +168,7 @@ public FileMap getNewInstance(Map arg, List pathToItem, PathToSche return new FileMap(castProperties); } - public FileMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FileMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -179,29 +180,29 @@ public FileMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public File1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public File1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new File1BoxedMap(validate(arg, configuration)); } @Override - public File1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public File1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java index 8a07f63e2b0..cc4f912d614 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -100,12 +101,12 @@ public FilesList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof File.FileMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((File.FileMap) itemInstance); i += 1; @@ -125,29 +126,29 @@ public FilesList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public FilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FilesBoxedList(validate(arg, configuration)); } @Override - public FilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public FilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -169,7 +170,7 @@ public File.FileMap file() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof File.FileMap)) { - throw new RuntimeException("Invalid value stored for file"); + throw new InvalidTypeException("Invalid value stored for file"); } return (File.FileMap) value; } @@ -179,7 +180,7 @@ public FilesList files() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FilesList)) { - throw new RuntimeException("Invalid value stored for files"); + throw new InvalidTypeException("Invalid value stored for files"); } return (FilesList) value; } @@ -286,7 +287,7 @@ public FileSchemaTestClassMap getNewInstance(Map arg, List pathToI for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -294,7 +295,7 @@ public FileSchemaTestClassMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -304,7 +305,7 @@ public FileSchemaTestClassMap getNewInstance(Map arg, List pathToI return new FileSchemaTestClassMap(castProperties); } - public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -316,29 +317,29 @@ public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration config @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FileSchemaTestClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FileSchemaTestClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FileSchemaTestClass1BoxedMap(validate(arg, configuration)); } @Override - public FileSchemaTestClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public FileSchemaTestClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java index 5a2618fb230..a14f1cb5451 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -44,7 +45,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for bar"); + throw new InvalidTypeException("Invalid value stored for bar"); } return (String) value; } @@ -135,7 +136,7 @@ public FooMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -143,7 +144,7 @@ public FooMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -153,7 +154,7 @@ public FooMap getNewInstance(Map arg, List pathToItem, PathToSchem return new FooMap(castProperties); } - public FooMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FooMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -165,29 +166,29 @@ public FooMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Foo1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Foo1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Foo1BoxedMap(validate(arg, configuration)); } @Override - public Foo1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Foo1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java index bf716753fe8..ed61c57c7c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java @@ -13,6 +13,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DateJsonSchema; @@ -109,29 +110,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IntegerSchemaBoxedNumber(validate(arg, configuration)); } @Override - public IntegerSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -203,29 +204,29 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Int32withValidationsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Int32withValidationsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int32withValidationsBoxedNumber(validate(arg, configuration)); } @Override - public Int32withValidationsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Int32withValidationsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -305,29 +306,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberSchemaBoxedNumber(validate(arg, configuration)); } @Override - public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -383,29 +384,29 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FloatSchemaBoxedNumber(validate(arg, configuration)); } @Override - public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -472,29 +473,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DoubleSchemaBoxedNumber(validate(arg, configuration)); } @Override - public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -607,12 +608,12 @@ public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToI itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -632,29 +633,29 @@ public ArrayWithUniqueItemsList validate(List arg, SchemaConfiguration config } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayWithUniqueItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithUniqueItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayWithUniqueItemsBoxedList(validate(arg, configuration)); } @Override - public ArrayWithUniqueItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithUniqueItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -705,29 +706,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public StringSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new StringSchemaBoxedString(validate(arg, configuration)); } @Override - public StringSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public StringSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -844,29 +845,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public PasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PasswordBoxedString(validate(arg, configuration)); } @Override - public PasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -916,29 +917,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternWithDigitsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public PatternWithDigitsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PatternWithDigitsBoxedString(validate(arg, configuration)); } @Override - public PatternWithDigitsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PatternWithDigitsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -989,29 +990,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternWithDigitsAndDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public PatternWithDigitsAndDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PatternWithDigitsAndDelimiterBoxedString(validate(arg, configuration)); } @Override - public PatternWithDigitsAndDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PatternWithDigitsAndDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1062,7 +1063,7 @@ public static FormatTestMap of(Map arg, Sche public String date() { @Nullable Object value = get("date"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for date"); + throw new InvalidTypeException("Invalid value stored for date"); } return (String) value; } @@ -1070,7 +1071,7 @@ public String date() { public String password() { @Nullable Object value = get("password"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for password"); + throw new InvalidTypeException("Invalid value stored for password"); } return (String) value; } @@ -1080,7 +1081,7 @@ public Number int32() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int32"); + throw new InvalidTypeException("Invalid value stored for int32"); } return (Number) value; } @@ -1090,7 +1091,7 @@ public Number int32withValidations() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int32withValidations"); + throw new InvalidTypeException("Invalid value stored for int32withValidations"); } return (Number) value; } @@ -1100,7 +1101,7 @@ public Number int64() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int64"); + throw new InvalidTypeException("Invalid value stored for int64"); } return (Number) value; } @@ -1110,7 +1111,7 @@ public Number float32() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for float32"); + throw new InvalidTypeException("Invalid value stored for float32"); } return (Number) value; } @@ -1120,7 +1121,7 @@ public Number float64() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for float64"); + throw new InvalidTypeException("Invalid value stored for float64"); } return (Number) value; } @@ -1130,7 +1131,7 @@ public ArrayWithUniqueItemsList arrayWithUniqueItems() throws UnsetPropertyExcep throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayWithUniqueItemsList)) { - throw new RuntimeException("Invalid value stored for arrayWithUniqueItems"); + throw new InvalidTypeException("Invalid value stored for arrayWithUniqueItems"); } return (ArrayWithUniqueItemsList) value; } @@ -1140,7 +1141,7 @@ public String binary() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for binary"); + throw new InvalidTypeException("Invalid value stored for binary"); } return (String) value; } @@ -1150,7 +1151,7 @@ public String dateTime() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for dateTime"); + throw new InvalidTypeException("Invalid value stored for dateTime"); } return (String) value; } @@ -1160,7 +1161,7 @@ public String uuidNoExample() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for uuidNoExample"); + throw new InvalidTypeException("Invalid value stored for uuidNoExample"); } return (String) value; } @@ -1170,7 +1171,7 @@ public String pattern_with_digits() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for pattern_with_digits"); + throw new InvalidTypeException("Invalid value stored for pattern_with_digits"); } return (String) value; } @@ -1180,7 +1181,7 @@ public String pattern_with_digits_and_delimiter() throws UnsetPropertyException throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for pattern_with_digits_and_delimiter"); + throw new InvalidTypeException("Invalid value stored for pattern_with_digits_and_delimiter"); } return (String) value; } @@ -1190,7 +1191,7 @@ public Void noneProp() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Void)) { - throw new RuntimeException("Invalid value stored for noneProp"); + throw new InvalidTypeException("Invalid value stored for noneProp"); } return (Void) value; } @@ -1979,7 +1980,7 @@ public FormatTestMap getNewInstance(Map arg, List pathToItem, Path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1987,7 +1988,7 @@ public FormatTestMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1997,7 +1998,7 @@ public FormatTestMap getNewInstance(Map arg, List pathToItem, Path return new FormatTestMap(castProperties); } - public FormatTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FormatTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2009,29 +2010,29 @@ public FormatTestMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FormatTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FormatTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FormatTest1BoxedMap(validate(arg, configuration)); } @Override - public FormatTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public FormatTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java index b708fa92058..5692157bda6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -69,7 +70,7 @@ public String data() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for data"); + throw new InvalidTypeException("Invalid value stored for data"); } return (String) value; } @@ -79,7 +80,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); + throw new InvalidTypeException("Invalid value stored for id"); } return (Number) value; } @@ -204,7 +205,7 @@ public FromSchemaMap getNewInstance(Map arg, List pathToItem, Path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -212,7 +213,7 @@ public FromSchemaMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -222,7 +223,7 @@ public FromSchemaMap getNewInstance(Map arg, List pathToItem, Path return new FromSchemaMap(castProperties); } - public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -234,29 +235,29 @@ public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FromSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FromSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FromSchema1BoxedMap(validate(arg, configuration)); } @Override - public FromSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public FromSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java index 7c50a1c4e59..275d87f5474 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -65,7 +66,7 @@ public String color() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for color"); + throw new InvalidTypeException("Invalid value stored for color"); } return (String) value; } @@ -190,7 +191,7 @@ public static Fruit1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -202,7 +203,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,7 +215,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -225,24 +226,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -274,7 +275,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -301,7 +302,7 @@ public FruitMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -309,7 +310,7 @@ public FruitMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -319,7 +320,7 @@ public FruitMap getNewInstance(Map arg, List pathToItem, PathToSch return new FruitMap(castProperties); } - public FruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -331,7 +332,7 @@ public FruitMap validate(Map arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -346,10 +347,10 @@ public FruitMap validate(Map arg, SchemaConfiguration configuration) throw } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -364,34 +365,34 @@ public FruitMap validate(Map arg, SchemaConfiguration configuration) throw } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Fruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Fruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Fruit1BoxedVoid(validate(arg, configuration)); } @Override - public Fruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Fruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Fruit1BoxedBoolean(validate(arg, configuration)); } @Override - public Fruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Fruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Fruit1BoxedNumber(validate(arg, configuration)); } @Override - public Fruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Fruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Fruit1BoxedString(validate(arg, configuration)); } @Override - public Fruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Fruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Fruit1BoxedList(validate(arg, configuration)); } @Override - public Fruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Fruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Fruit1BoxedMap(validate(arg, configuration)); } @Override - public Fruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Fruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -407,7 +408,7 @@ public Fruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java index fccdffed6f0..e5d97263a06 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -120,7 +121,7 @@ public static FruitReq1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +133,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,7 +145,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -155,24 +156,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -204,7 +205,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -231,7 +232,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -239,7 +240,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -249,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -261,7 +262,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -276,10 +277,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -294,34 +295,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FruitReq1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public FruitReq1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FruitReq1BoxedVoid(validate(arg, configuration)); } @Override - public FruitReq1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public FruitReq1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FruitReq1BoxedBoolean(validate(arg, configuration)); } @Override - public FruitReq1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public FruitReq1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FruitReq1BoxedNumber(validate(arg, configuration)); } @Override - public FruitReq1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public FruitReq1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FruitReq1BoxedString(validate(arg, configuration)); } @Override - public FruitReq1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public FruitReq1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FruitReq1BoxedList(validate(arg, configuration)); } @Override - public FruitReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FruitReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FruitReq1BoxedMap(validate(arg, configuration)); } @Override - public FruitReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public FruitReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -337,7 +338,7 @@ public FruitReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java index 4ad2cc51e1f..cb3f4599c5b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -65,7 +66,7 @@ public String color() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for color"); + throw new InvalidTypeException("Invalid value stored for color"); } return (String) value; } @@ -190,7 +191,7 @@ public static GmFruit1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -202,7 +203,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,7 +215,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -225,24 +226,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -274,7 +275,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -301,7 +302,7 @@ public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -309,7 +310,7 @@ public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -319,7 +320,7 @@ public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToS return new GmFruitMap(castProperties); } - public GmFruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public GmFruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -331,7 +332,7 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -346,10 +347,10 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -364,34 +365,34 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public GmFruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public GmFruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new GmFruit1BoxedVoid(validate(arg, configuration)); } @Override - public GmFruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public GmFruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new GmFruit1BoxedBoolean(validate(arg, configuration)); } @Override - public GmFruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public GmFruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new GmFruit1BoxedNumber(validate(arg, configuration)); } @Override - public GmFruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public GmFruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new GmFruit1BoxedString(validate(arg, configuration)); } @Override - public GmFruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public GmFruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new GmFruit1BoxedList(validate(arg, configuration)); } @Override - public GmFruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public GmFruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new GmFruit1BoxedMap(validate(arg, configuration)); } @Override - public GmFruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public GmFruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -407,7 +408,7 @@ public GmFruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java index bdc5b75784b..4734ddc65a3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -54,7 +55,7 @@ public static GrandparentAnimalMap of(Map ar public String pet_type() { @Nullable Object value = get("pet_type"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for pet_type"); + throw new InvalidTypeException("Invalid value stored for pet_type"); } return (String) value; } @@ -158,7 +159,7 @@ public GrandparentAnimalMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -166,7 +167,7 @@ public GrandparentAnimalMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -176,7 +177,7 @@ public GrandparentAnimalMap getNewInstance(Map arg, List pathToIte return new GrandparentAnimalMap(castProperties); } - public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -188,29 +189,29 @@ public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public GrandparentAnimal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public GrandparentAnimal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new GrandparentAnimal1BoxedMap(validate(arg, configuration)); } @Override - public GrandparentAnimal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public GrandparentAnimal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java index 3e7968f1b15..4687de450d9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -68,7 +69,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for bar"); + throw new InvalidTypeException("Invalid value stored for bar"); } return (String) value; } @@ -78,7 +79,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for foo"); + throw new InvalidTypeException("Invalid value stored for foo"); } return (String) value; } @@ -185,7 +186,7 @@ public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -193,7 +194,7 @@ public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -203,7 +204,7 @@ public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, return new HasOnlyReadOnlyMap(castProperties); } - public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,29 +216,29 @@ public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HasOnlyReadOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HasOnlyReadOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new HasOnlyReadOnly1BoxedMap(validate(arg, configuration)); } @Override - public HasOnlyReadOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public HasOnlyReadOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java index b90d71cfee4..a499676d162 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -91,40 +92,40 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableMessageBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public NullableMessageBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullableMessageBoxedVoid(validate(arg, configuration)); } @Override - public NullableMessageBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public NullableMessageBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullableMessageBoxedString(validate(arg, configuration)); } @Override - public NullableMessageBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NullableMessageBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -145,7 +146,7 @@ public static HealthCheckResultMap of(Map ar throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new RuntimeException("Invalid value stored for NullableMessage"); + throw new InvalidTypeException("Invalid value stored for NullableMessage"); } return (@Nullable String) value; } @@ -244,7 +245,7 @@ public HealthCheckResultMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -252,7 +253,7 @@ public HealthCheckResultMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -262,7 +263,7 @@ public HealthCheckResultMap getNewInstance(Map arg, List pathToIte return new HealthCheckResultMap(castProperties); } - public HealthCheckResultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HealthCheckResultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -274,29 +275,29 @@ public HealthCheckResultMap validate(Map arg, SchemaConfiguration configur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HealthCheckResult1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HealthCheckResult1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new HealthCheckResult1BoxedMap(validate(arg, configuration)); } @Override - public HealthCheckResult1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public HealthCheckResult1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java index 3a76754f403..b20ad0b018a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java @@ -8,6 +8,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -178,29 +179,29 @@ public double validate(DoubleIntegerEnumEnums arg,SchemaConfiguration configurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnum1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerEnum1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IntegerEnum1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java index 5d67f71f851..74085a9268a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java @@ -8,6 +8,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -178,29 +179,29 @@ public double validate(DoubleIntegerEnumBigEnums arg,SchemaConfiguration configu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnumBig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerEnumBig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IntegerEnumBig1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnumBig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerEnumBig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java index c5618e31d67..3157279dfbf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java @@ -8,6 +8,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -168,29 +169,29 @@ public double validate(DoubleIntegerEnumOneValueEnums arg,SchemaConfiguration co } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnumOneValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerEnumOneValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IntegerEnumOneValue1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnumOneValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerEnumOneValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java index ad176b517e1..a4afc589221 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java @@ -8,6 +8,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -180,29 +181,29 @@ public double validate(DoubleIntegerEnumWithDefaultValueEnums arg,SchemaConfigur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnumWithDefaultValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerEnumWithDefaultValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IntegerEnumWithDefaultValue1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java index d5382218276..aca58126d3d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -88,29 +89,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerMax101BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerMax101BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IntegerMax101BoxedNumber(validate(arg, configuration)); } @Override - public IntegerMax101Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerMax101Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java index 551489c98f8..40f8b80b761 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -88,29 +89,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerMin151BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerMin151BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IntegerMin151BoxedNumber(validate(arg, configuration)); } @Override - public IntegerMin151Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerMin151Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java index 01a61a254d0..57a6f72619c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -102,29 +103,29 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new TriangleTypeBoxedString(validate(arg, configuration)); } @Override - public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -145,7 +146,7 @@ public String triangleType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for triangleType"); + throw new InvalidTypeException("Invalid value stored for triangleType"); } return (String) value; } @@ -236,7 +237,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -244,7 +245,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -254,7 +255,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -266,29 +267,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -366,7 +367,7 @@ public static IsoscelesTriangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -378,7 +379,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -390,7 +391,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -401,24 +402,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -450,7 +451,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -477,7 +478,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -485,7 +486,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -495,7 +496,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -507,7 +508,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -522,10 +523,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -540,34 +541,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IsoscelesTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public IsoscelesTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IsoscelesTriangle1BoxedVoid(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public IsoscelesTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IsoscelesTriangle1BoxedBoolean(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public IsoscelesTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IsoscelesTriangle1BoxedNumber(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public IsoscelesTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IsoscelesTriangle1BoxedString(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public IsoscelesTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IsoscelesTriangle1BoxedList(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public IsoscelesTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IsoscelesTriangle1BoxedMap(validate(arg, configuration)); } @Override - public IsoscelesTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public IsoscelesTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -583,7 +584,7 @@ public IsoscelesTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java index 99f46b05498..594b1fe65bc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -114,12 +115,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof FrozenMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((FrozenMap) itemInstance); i += 1; @@ -139,29 +140,29 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Items1BoxedList(validate(arg, configuration)); } @Override - public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java index 29a37d97892..6d33dabcc9a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -102,7 +103,7 @@ public static Items getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -114,7 +115,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -126,7 +127,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,24 +138,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -186,7 +187,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -213,7 +214,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -221,7 +222,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -231,7 +232,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,7 +244,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -258,10 +259,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -276,34 +277,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ItemsBoxedVoid(validate(arg, configuration)); } @Override - public ItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ItemsBoxedBoolean(validate(arg, configuration)); } @Override - public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ItemsBoxedNumber(validate(arg, configuration)); } @Override - public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ItemsBoxedString(validate(arg, configuration)); } @Override - public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ItemsBoxedList(validate(arg, configuration)); } @Override - public ItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ItemsBoxedMap(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -319,7 +320,7 @@ public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -440,7 +441,7 @@ public JSONPatchRequestList getNewInstance(List arg, List pathToItem, itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -462,29 +463,29 @@ public JSONPatchRequestList validate(List arg, SchemaConfiguration configurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequest1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequest1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new JSONPatchRequest1BoxedList(validate(arg, configuration)); } @Override - public JSONPatchRequest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java index 9e4766a2553..208f6dbb772 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -134,29 +135,29 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new OpBoxedString(validate(arg, configuration)); } @Override - public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -177,7 +178,7 @@ public static JSONPatchRequestAddReplaceTestMap of(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -469,7 +466,7 @@ public JSONPatchRequestAddReplaceTestMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -479,7 +476,7 @@ public JSONPatchRequestAddReplaceTestMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequestAddReplaceTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -491,29 +488,29 @@ public JSONPatchRequestAddReplaceTestMap validate(Map arg, SchemaConfigura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequestAddReplaceTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequestAddReplaceTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new JSONPatchRequestAddReplaceTest1BoxedMap(validate(arg, configuration)); } @Override - public JSONPatchRequestAddReplaceTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequestAddReplaceTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java index ccecd4a7216..756770311c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -132,29 +133,29 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new OpBoxedString(validate(arg, configuration)); } @Override - public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -173,27 +174,19 @@ public static JSONPatchRequestMoveCopyMap of(Map arg, SchemaConf } public String from() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("from"); } public String op() { String value = get("op"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for op"); + throw new InvalidTypeException("Invalid value stored for op"); } return (String) value; } public String path() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("path"); } } @@ -411,7 +404,7 @@ public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pa for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -419,12 +412,12 @@ public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -432,7 +425,7 @@ public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pa return new JSONPatchRequestMoveCopyMap(castProperties); } - public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -444,29 +437,29 @@ public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequestMoveCopy1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequestMoveCopy1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new JSONPatchRequestMoveCopy1BoxedMap(validate(arg, configuration)); } @Override - public JSONPatchRequestMoveCopy1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequestMoveCopy1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java index 909c63f3f69..e358e5e96d5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -119,29 +120,29 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new OpBoxedString(validate(arg, configuration)); } @Override - public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -161,17 +162,13 @@ public static JSONPatchRequestRemoveMap of(Map arg, SchemaConfig public String op() { String value = get("op"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for op"); + throw new InvalidTypeException("Invalid value stored for op"); } return (String) value; } public String path() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("path"); } } @@ -311,7 +308,7 @@ public JSONPatchRequestRemoveMap getNewInstance(Map arg, List path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -319,12 +316,12 @@ public JSONPatchRequestRemoveMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -332,7 +329,7 @@ public JSONPatchRequestRemoveMap getNewInstance(Map arg, List path return new JSONPatchRequestRemoveMap(castProperties); } - public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -344,29 +341,29 @@ public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfiguration con @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequestRemove1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequestRemove1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new JSONPatchRequestRemove1BoxedMap(validate(arg, configuration)); } @Override - public JSONPatchRequestRemove1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public JSONPatchRequestRemove1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java index 79d6eb48d01..4cd47033fbd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +109,7 @@ public static Mammal1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +121,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +133,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +144,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -192,7 +193,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -219,7 +220,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -237,7 +238,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,10 +265,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,34 +283,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Mammal1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Mammal1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Mammal1BoxedVoid(validate(arg, configuration)); } @Override - public Mammal1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Mammal1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Mammal1BoxedBoolean(validate(arg, configuration)); } @Override - public Mammal1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Mammal1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Mammal1BoxedNumber(validate(arg, configuration)); } @Override - public Mammal1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Mammal1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Mammal1BoxedString(validate(arg, configuration)); } @Override - public Mammal1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Mammal1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Mammal1BoxedList(validate(arg, configuration)); } @Override - public Mammal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Mammal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Mammal1BoxedMap(validate(arg, configuration)); } @Override - public Mammal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Mammal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +326,7 @@ public Mammal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java index 5c949106062..b0e6e922553 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -128,7 +129,7 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -136,12 +137,12 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -149,7 +150,7 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo return new AdditionalPropertiesMap(castProperties); } - public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -161,29 +162,29 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration confi @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalPropertiesBoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -271,7 +272,7 @@ public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -279,12 +280,12 @@ public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof AdditionalPropertiesMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (AdditionalPropertiesMap) propertyInstance); } @@ -292,7 +293,7 @@ public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, return new MapMapOfStringMap(castProperties); } - public MapMapOfStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapMapOfStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -304,29 +305,29 @@ public MapMapOfStringMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapMapOfStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapMapOfStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MapMapOfStringBoxedMap(validate(arg, configuration)); } @Override - public MapMapOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MapMapOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -396,29 +397,29 @@ public String validate(StringAdditionalPropertiesEnums arg,SchemaConfiguration c } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties2BoxedString(validate(arg, configuration)); } @Override - public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -512,7 +513,7 @@ public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -520,12 +521,12 @@ public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -533,7 +534,7 @@ public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, return new MapOfEnumStringMap(castProperties); } - public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -545,29 +546,29 @@ public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapOfEnumStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapOfEnumStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MapOfEnumStringBoxedMap(validate(arg, configuration)); } @Override - public MapOfEnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MapOfEnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -597,7 +598,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new RuntimeException("Value may not be null"); + throw new InvalidTypeException("Value may not be null"); } return (boolean) value; } @@ -671,7 +672,7 @@ public DirectMapMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -679,12 +680,12 @@ public DirectMapMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -692,7 +693,7 @@ public DirectMapMap getNewInstance(Map arg, List pathToItem, PathT return new DirectMapMap(castProperties); } - public DirectMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public DirectMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -704,29 +705,29 @@ public DirectMapMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DirectMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public DirectMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DirectMapBoxedMap(validate(arg, configuration)); } @Override - public DirectMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DirectMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -751,7 +752,7 @@ public MapMapOfStringMap map_map_of_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapMapOfStringMap)) { - throw new RuntimeException("Invalid value stored for map_map_of_string"); + throw new InvalidTypeException("Invalid value stored for map_map_of_string"); } return (MapMapOfStringMap) value; } @@ -761,7 +762,7 @@ public MapOfEnumStringMap map_of_enum_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapOfEnumStringMap)) { - throw new RuntimeException("Invalid value stored for map_of_enum_string"); + throw new InvalidTypeException("Invalid value stored for map_of_enum_string"); } return (MapOfEnumStringMap) value; } @@ -771,7 +772,7 @@ public DirectMapMap direct_map() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof DirectMapMap)) { - throw new RuntimeException("Invalid value stored for direct_map"); + throw new InvalidTypeException("Invalid value stored for direct_map"); } return (DirectMapMap) value; } @@ -781,7 +782,7 @@ public StringBooleanMap.StringBooleanMapMap indirect_map() throws UnsetPropertyE throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof StringBooleanMap.StringBooleanMapMap)) { - throw new RuntimeException("Invalid value stored for indirect_map"); + throw new InvalidTypeException("Invalid value stored for indirect_map"); } return (StringBooleanMap.StringBooleanMapMap) value; } @@ -920,7 +921,7 @@ public MapTestMap getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -928,7 +929,7 @@ public MapTestMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -938,7 +939,7 @@ public MapTestMap getNewInstance(Map arg, List pathToItem, PathToS return new MapTestMap(castProperties); } - public MapTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -950,29 +951,29 @@ public MapTestMap validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MapTest1BoxedMap(validate(arg, configuration)); } @Override - public MapTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MapTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java index 745291751f4..60737d39485 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; @@ -135,7 +136,7 @@ public MapMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -143,12 +144,12 @@ public MapMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Animal.AnimalMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Animal.AnimalMap) propertyInstance); } @@ -156,7 +157,7 @@ public MapMap getNewInstance(Map arg, List pathToItem, PathToSchem return new MapMap(castProperties); } - public MapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -168,29 +169,29 @@ public MapMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MapSchemaBoxedMap(validate(arg, configuration)); } @Override - public MapSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MapSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -214,7 +215,7 @@ public String dateTime() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for dateTime"); + throw new InvalidTypeException("Invalid value stored for dateTime"); } return (String) value; } @@ -337,7 +338,7 @@ public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map a for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -345,7 +346,7 @@ public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map a Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -355,7 +356,7 @@ public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map a return new MixedPropertiesAndAdditionalPropertiesClassMap(castProperties); } - public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -367,29 +368,29 @@ public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map arg, Sc @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MixedPropertiesAndAdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MixedPropertiesAndAdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MixedPropertiesAndAdditionalPropertiesClass1BoxedMap(validate(arg, configuration)); } @Override - public MixedPropertiesAndAdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MixedPropertiesAndAdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java index 8556b36f75d..646f92ae740 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -68,7 +69,7 @@ public static MoneyMap of(Map arg, SchemaCon public String amount() { @Nullable Object value = get("amount"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for amount"); + throw new InvalidTypeException("Invalid value stored for amount"); } return (String) value; } @@ -76,7 +77,7 @@ public String amount() { public String currency() { @Nullable Object value = get("currency"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for currency"); + throw new InvalidTypeException("Invalid value stored for currency"); } return (String) value; } @@ -218,7 +219,7 @@ public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +227,7 @@ public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -236,7 +237,7 @@ public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSch return new MoneyMap(castProperties); } - public MoneyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MoneyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,29 +249,29 @@ public MoneyMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Money1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Money1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Money1BoxedMap(validate(arg, configuration)); } @Override - public Money1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Money1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java index 49aeac11da7..b985e9350ac 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -146,7 +147,7 @@ public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, Pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -154,12 +155,12 @@ public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, Pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -167,7 +168,7 @@ public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, Pat return new MyObjectDtoMap(castProperties); } - public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -179,29 +180,29 @@ public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MyObjectDto1BoxedMap(validate(arg, configuration)); } @Override - public MyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java index 42f33135fe6..081f87d53d9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -89,7 +90,7 @@ public static NameMap of(Map arg, SchemaConf public Number name() { @Nullable Object value = get("name"); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for name"); + throw new InvalidTypeException("Invalid value stored for name"); } return (Number) value; } @@ -99,7 +100,7 @@ public Number snake_case() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for snake_case"); + throw new InvalidTypeException("Invalid value stored for snake_case"); } return (Number) value; } @@ -109,7 +110,7 @@ public String property() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for property"); + throw new InvalidTypeException("Invalid value stored for property"); } return (String) value; } @@ -289,7 +290,7 @@ public static Name1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -301,7 +302,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,7 +314,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -324,24 +325,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -373,7 +374,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -400,7 +401,7 @@ public NameMap getNewInstance(Map arg, List pathToItem, PathToSche for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -408,7 +409,7 @@ public NameMap getNewInstance(Map arg, List pathToItem, PathToSche Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -418,7 +419,7 @@ public NameMap getNewInstance(Map arg, List pathToItem, PathToSche return new NameMap(castProperties); } - public NameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public NameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,7 +431,7 @@ public NameMap validate(Map arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -445,10 +446,10 @@ public NameMap validate(Map arg, SchemaConfiguration configuration) throws } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -463,34 +464,34 @@ public NameMap validate(Map arg, SchemaConfiguration configuration) throws } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Name1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Name1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Name1BoxedVoid(validate(arg, configuration)); } @Override - public Name1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Name1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Name1BoxedBoolean(validate(arg, configuration)); } @Override - public Name1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Name1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Name1BoxedNumber(validate(arg, configuration)); } @Override - public Name1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Name1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Name1BoxedString(validate(arg, configuration)); } @Override - public Name1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Name1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Name1BoxedList(validate(arg, configuration)); } @Override - public Name1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Name1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Name1BoxedMap(validate(arg, configuration)); } @Override - public Name1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Name1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -506,7 +507,7 @@ public Name1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java index 0500ace9a46..dec315f92ed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -78,11 +79,7 @@ public static NoAdditionalPropertiesMap of(Map arg, SchemaConfig } public Number id() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("id"); } public Number petId() throws UnsetPropertyException { @@ -232,7 +229,7 @@ public NoAdditionalPropertiesMap getNewInstance(Map arg, List path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -240,12 +237,12 @@ public NoAdditionalPropertiesMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -253,7 +250,7 @@ public NoAdditionalPropertiesMap getNewInstance(Map arg, List path return new NoAdditionalPropertiesMap(castProperties); } - public NoAdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public NoAdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -265,29 +262,29 @@ public NoAdditionalPropertiesMap validate(Map arg, SchemaConfiguration con @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NoAdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public NoAdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NoAdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public NoAdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NoAdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java index 2bc824b0de6..d412dae60ee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java @@ -13,6 +13,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -91,7 +92,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -99,7 +100,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -109,7 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,40 +122,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties3BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties3BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties3BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties3BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -240,40 +241,40 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IntegerPropBoxedVoid(validate(arg, configuration)); } @Override - public IntegerPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IntegerPropBoxedNumber(validate(arg, configuration)); } @Override - public IntegerPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public IntegerPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -358,40 +359,40 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public NumberPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberPropBoxedVoid(validate(arg, configuration)); } @Override - public NumberPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public NumberPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberPropBoxedNumber(validate(arg, configuration)); } @Override - public NumberPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NumberPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -457,35 +458,35 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BooleanPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public BooleanPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BooleanPropBoxedVoid(validate(arg, configuration)); } @Override - public BooleanPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public BooleanPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BooleanPropBoxedBoolean(validate(arg, configuration)); } @Override - public BooleanPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public BooleanPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -493,7 +494,7 @@ public BooleanPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -559,40 +560,40 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public StringPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new StringPropBoxedVoid(validate(arg, configuration)); } @Override - public StringPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public StringPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new StringPropBoxedString(validate(arg, configuration)); } @Override - public StringPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public StringPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -659,40 +660,40 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DatePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public DatePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DatePropBoxedVoid(validate(arg, configuration)); } @Override - public DatePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public DatePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DatePropBoxedString(validate(arg, configuration)); } @Override - public DatePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DatePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -759,40 +760,40 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DatetimePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public DatetimePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DatetimePropBoxedVoid(validate(arg, configuration)); } @Override - public DatetimePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public DatetimePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DatetimePropBoxedString(validate(arg, configuration)); } @Override - public DatetimePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DatetimePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -899,12 +900,12 @@ public ArrayNullablePropList getNewInstance(List arg, List pathToItem itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof FrozenMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((FrozenMap) itemInstance); i += 1; @@ -924,40 +925,40 @@ public ArrayNullablePropList validate(List arg, SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ArrayNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayNullablePropBoxedList(validate(arg, configuration)); } @Override - public ArrayNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1015,7 +1016,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1023,7 +1024,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1033,7 +1034,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1045,40 +1046,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Items1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Items1BoxedVoid(validate(arg, configuration)); } @Override - public Items1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Items1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Items1BoxedMap(validate(arg, configuration)); } @Override - public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1179,12 +1180,12 @@ public ArrayAndItemsNullablePropList getNewInstance(List arg, List pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance == null || itemInstance instanceof FrozenMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((@Nullable FrozenMap) itemInstance); i += 1; @@ -1204,40 +1205,40 @@ public ArrayAndItemsNullablePropList validate(List arg, SchemaConfiguration c } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayAndItemsNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ArrayAndItemsNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayAndItemsNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayAndItemsNullablePropBoxedList(validate(arg, configuration)); } @Override - public ArrayAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1295,7 +1296,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1303,7 +1304,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1313,7 +1314,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1325,40 +1326,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Items2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Items2BoxedVoid(validate(arg, configuration)); } @Override - public Items2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Items2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Items2BoxedMap(validate(arg, configuration)); } @Override - public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1438,12 +1439,12 @@ public ArrayItemsNullableList getNewInstance(List arg, List pathToIte itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance == null || itemInstance instanceof FrozenMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((@Nullable FrozenMap) itemInstance); i += 1; @@ -1463,29 +1464,29 @@ public ArrayItemsNullableList validate(List arg, SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayItemsNullableBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayItemsNullableBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayItemsNullableBoxedList(validate(arg, configuration)); } @Override - public ArrayItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1604,7 +1605,7 @@ public ObjectNullablePropMap getNewInstance(Map arg, List pathToIt for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1612,12 +1613,12 @@ public ObjectNullablePropMap getNewInstance(Map arg, List pathToIt Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof FrozenMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (FrozenMap) propertyInstance); } @@ -1625,7 +1626,7 @@ public ObjectNullablePropMap getNewInstance(Map arg, List pathToIt return new ObjectNullablePropMap(castProperties); } - public ObjectNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1637,40 +1638,40 @@ public ObjectNullablePropMap validate(Map arg, SchemaConfiguration configu @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ObjectNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectNullablePropBoxedMap(validate(arg, configuration)); } @Override - public ObjectNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1728,7 +1729,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1736,7 +1737,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1746,7 +1747,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1758,40 +1759,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties1BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1906,7 +1907,7 @@ public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1914,12 +1915,12 @@ public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance == null || propertyInstance instanceof FrozenMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable FrozenMap) propertyInstance); } @@ -1927,7 +1928,7 @@ public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List return new ObjectAndItemsNullablePropMap(castProperties); } - public ObjectAndItemsNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectAndItemsNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1939,40 +1940,40 @@ public ObjectAndItemsNullablePropMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectAndItemsNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ObjectAndItemsNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectAndItemsNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectAndItemsNullablePropBoxedMap(validate(arg, configuration)); } @Override - public ObjectAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2030,7 +2031,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2038,7 +2039,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -2048,7 +2049,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2060,40 +2061,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties2BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AdditionalProperties2BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2187,7 +2188,7 @@ public ObjectItemsNullableMap getNewInstance(Map arg, List pathToI for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2195,12 +2196,12 @@ public ObjectItemsNullableMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance == null || propertyInstance instanceof FrozenMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable FrozenMap) propertyInstance); } @@ -2208,7 +2209,7 @@ public ObjectItemsNullableMap getNewInstance(Map arg, List pathToI return new ObjectItemsNullableMap(castProperties); } - public ObjectItemsNullableMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectItemsNullableMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2220,29 +2221,29 @@ public ObjectItemsNullableMap validate(Map arg, SchemaConfiguration config @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectItemsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectItemsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectItemsNullableBoxedMap(validate(arg, configuration)); } @Override - public ObjectItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2275,7 +2276,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Number)) { - throw new RuntimeException("Invalid value stored for integer_prop"); + throw new InvalidTypeException("Invalid value stored for integer_prop"); } return (@Nullable Number) value; } @@ -2285,7 +2286,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Number)) { - throw new RuntimeException("Invalid value stored for number_prop"); + throw new InvalidTypeException("Invalid value stored for number_prop"); } return (@Nullable Number) value; } @@ -2295,7 +2296,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for boolean_prop"); + throw new InvalidTypeException("Invalid value stored for boolean_prop"); } return (@Nullable Boolean) value; } @@ -2305,7 +2306,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new RuntimeException("Invalid value stored for string_prop"); + throw new InvalidTypeException("Invalid value stored for string_prop"); } return (@Nullable String) value; } @@ -2315,7 +2316,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new RuntimeException("Invalid value stored for date_prop"); + throw new InvalidTypeException("Invalid value stored for date_prop"); } return (@Nullable String) value; } @@ -2325,7 +2326,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new RuntimeException("Invalid value stored for datetime_prop"); + throw new InvalidTypeException("Invalid value stored for datetime_prop"); } return (@Nullable String) value; } @@ -2335,7 +2336,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ArrayNullablePropList)) { - throw new RuntimeException("Invalid value stored for array_nullable_prop"); + throw new InvalidTypeException("Invalid value stored for array_nullable_prop"); } return (@Nullable ArrayNullablePropList) value; } @@ -2345,7 +2346,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ArrayAndItemsNullablePropList)) { - throw new RuntimeException("Invalid value stored for array_and_items_nullable_prop"); + throw new InvalidTypeException("Invalid value stored for array_and_items_nullable_prop"); } return (@Nullable ArrayAndItemsNullablePropList) value; } @@ -2355,7 +2356,7 @@ public ArrayItemsNullableList array_items_nullable() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayItemsNullableList)) { - throw new RuntimeException("Invalid value stored for array_items_nullable"); + throw new InvalidTypeException("Invalid value stored for array_items_nullable"); } return (ArrayItemsNullableList) value; } @@ -2365,7 +2366,7 @@ public ArrayItemsNullableList array_items_nullable() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ObjectNullablePropMap)) { - throw new RuntimeException("Invalid value stored for object_nullable_prop"); + throw new InvalidTypeException("Invalid value stored for object_nullable_prop"); } return (@Nullable ObjectNullablePropMap) value; } @@ -2375,7 +2376,7 @@ public ArrayItemsNullableList array_items_nullable() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ObjectAndItemsNullablePropMap)) { - throw new RuntimeException("Invalid value stored for object_and_items_nullable_prop"); + throw new InvalidTypeException("Invalid value stored for object_and_items_nullable_prop"); } return (@Nullable ObjectAndItemsNullablePropMap) value; } @@ -2385,7 +2386,7 @@ public ObjectItemsNullableMap object_items_nullable() throws UnsetPropertyExcept throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ObjectItemsNullableMap)) { - throw new RuntimeException("Invalid value stored for object_items_nullable"); + throw new InvalidTypeException("Invalid value stored for object_items_nullable"); } return (ObjectItemsNullableMap) value; } @@ -2394,7 +2395,7 @@ public ObjectItemsNullableMap object_items_nullable() throws UnsetPropertyExcept throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value == null || value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for " + name); + throw new InvalidTypeException("Invalid value stored for " + name); } return (@Nullable FrozenMap) value; } @@ -2772,7 +2773,7 @@ public NullableClassMap getNewInstance(Map arg, List pathToItem, P for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2780,12 +2781,12 @@ public NullableClassMap getNewInstance(Map arg, List pathToItem, P Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance == null || propertyInstance instanceof Object)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable Object) propertyInstance); } @@ -2793,7 +2794,7 @@ public NullableClassMap getNewInstance(Map arg, List pathToItem, P return new NullableClassMap(castProperties); } - public NullableClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public NullableClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2805,29 +2806,29 @@ public NullableClassMap validate(Map arg, SchemaConfiguration configuratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public NullableClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullableClass1BoxedMap(validate(arg, configuration)); } @Override - public NullableClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NullableClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java index a182ebc1218..4a127d0c38e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -122,7 +123,7 @@ public static NullableShape1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -134,7 +135,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -146,7 +147,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -157,24 +158,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,7 +207,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -233,7 +234,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -241,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -251,7 +252,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -263,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -278,10 +279,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -296,34 +297,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableShape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public NullableShape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullableShape1BoxedVoid(validate(arg, configuration)); } @Override - public NullableShape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public NullableShape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullableShape1BoxedBoolean(validate(arg, configuration)); } @Override - public NullableShape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public NullableShape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullableShape1BoxedNumber(validate(arg, configuration)); } @Override - public NullableShape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public NullableShape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullableShape1BoxedString(validate(arg, configuration)); } @Override - public NullableShape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public NullableShape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullableShape1BoxedList(validate(arg, configuration)); } @Override - public NullableShape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public NullableShape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullableShape1BoxedMap(validate(arg, configuration)); } @Override - public NullableShape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NullableShape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -339,7 +340,7 @@ public NullableShape1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurat } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java index 82eff01189c..d52f8c2d9bb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java @@ -8,6 +8,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -88,40 +89,40 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public NullableString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullableString1BoxedVoid(validate(arg, configuration)); } @Override - public NullableString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public NullableString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullableString1BoxedString(validate(arg, configuration)); } @Override - public NullableString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NullableString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java index 40f333f0b3d..2aec9f86eb4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -56,7 +57,7 @@ public Number JustNumber() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for JustNumber"); + throw new InvalidTypeException("Invalid value stored for JustNumber"); } return (Number) value; } @@ -165,7 +166,7 @@ public NumberOnlyMap getNewInstance(Map arg, List pathToItem, Path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -173,7 +174,7 @@ public NumberOnlyMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -183,7 +184,7 @@ public NumberOnlyMap getNewInstance(Map arg, List pathToItem, Path return new NumberOnlyMap(castProperties); } - public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,29 +196,29 @@ public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public NumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberOnly1BoxedMap(validate(arg, configuration)); } @Override - public NumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java index b07cf3e7b49..d839b2752c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -88,29 +89,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberWithExclusiveMinMax1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public NumberWithExclusiveMinMax1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberWithExclusiveMinMax1BoxedNumber(validate(arg, configuration)); } @Override - public NumberWithExclusiveMinMax1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NumberWithExclusiveMinMax1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java index cf0349c6748..b859f61f42c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -88,29 +89,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberWithValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public NumberWithValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberWithValidations1BoxedNumber(validate(arg, configuration)); } @Override - public NumberWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NumberWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java index c3d1cef070f..7440322d228 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -54,7 +55,7 @@ public static ObjWithRequiredPropsMap of(Map public String a() { @Nullable Object value = get("a"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for a"); + throw new InvalidTypeException("Invalid value stored for a"); } return (String) value; } @@ -161,7 +162,7 @@ public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -169,7 +170,7 @@ public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -179,7 +180,7 @@ public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathTo return new ObjWithRequiredPropsMap(castProperties); } - public ObjWithRequiredPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjWithRequiredPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,29 +192,29 @@ public ObjWithRequiredPropsMap validate(Map arg, SchemaConfiguration confi @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjWithRequiredProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjWithRequiredProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjWithRequiredProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjWithRequiredProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjWithRequiredProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java index 721ccab7180..8d1712ddba9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -54,7 +55,7 @@ public static ObjWithRequiredPropsBaseMap of(Map arg, List pa for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -166,7 +167,7 @@ public ObjWithRequiredPropsBaseMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -176,7 +177,7 @@ public ObjWithRequiredPropsBaseMap getNewInstance(Map arg, List pa return new ObjWithRequiredPropsBaseMap(castProperties); } - public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -188,29 +189,29 @@ public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjWithRequiredPropsBase1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjWithRequiredPropsBase1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjWithRequiredPropsBase1BoxedMap(validate(arg, configuration)); } @Override - public ObjWithRequiredPropsBase1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjWithRequiredPropsBase1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java index 8709961bd10..2b92bc15f29 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +67,7 @@ public static ObjectModelWithArgAndArgsPropertiesMap of(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -229,7 +230,7 @@ public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -239,7 +240,7 @@ public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(Map arg, List return new ObjectModelWithArgAndArgsPropertiesMap(castProperties); } - public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -251,29 +252,29 @@ public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectModelWithArgAndArgsProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectModelWithArgAndArgsProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectModelWithArgAndArgsProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectModelWithArgAndArgsProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectModelWithArgAndArgsProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java index 8e8d69563b7..46d4dd148c3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -46,7 +47,7 @@ public Number myNumber() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for myNumber"); + throw new InvalidTypeException("Invalid value stored for myNumber"); } return (Number) value; } @@ -56,7 +57,7 @@ public String myString() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for myString"); + throw new InvalidTypeException("Invalid value stored for myString"); } return (String) value; } @@ -66,7 +67,7 @@ public boolean myBoolean() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for myBoolean"); + throw new InvalidTypeException("Invalid value stored for myBoolean"); } return (boolean) value; } @@ -209,7 +210,7 @@ public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -217,7 +218,7 @@ public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -227,7 +228,7 @@ public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pat return new ObjectModelWithRefPropsMap(castProperties); } - public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -239,29 +240,29 @@ public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectModelWithRefProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectModelWithRefProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectModelWithRefProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjectModelWithRefProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectModelWithRefProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java index e9986ba7011..83ae5af726f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -63,11 +64,7 @@ public static Schema1Map of(Map arg, SchemaC } public @Nullable Object test() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("test"); } public String name() throws UnsetPropertyException { @@ -75,7 +72,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); + throw new InvalidTypeException("Invalid value stored for name"); } return (String) value; } @@ -236,7 +233,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -244,7 +241,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -254,7 +251,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -266,29 +263,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -366,7 +363,7 @@ public static ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -378,7 +375,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -390,7 +387,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -401,24 +398,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -450,7 +447,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -477,7 +474,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -485,7 +482,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -495,7 +492,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -507,7 +504,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -522,10 +519,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -540,34 +537,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -583,7 +580,7 @@ public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed validateAndBox(@Null } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java index 0b6133faf4b..0b16a14b9db 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -68,7 +69,7 @@ public FrozenMap someProp() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for someProp"); + throw new InvalidTypeException("Invalid value stored for someProp"); } return (FrozenMap) value; } @@ -78,7 +79,7 @@ public FrozenMap someprop() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for someprop"); + throw new InvalidTypeException("Invalid value stored for someprop"); } return (FrozenMap) value; } @@ -187,7 +188,7 @@ public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -195,7 +196,7 @@ public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -205,7 +206,7 @@ public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithCollidingPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -217,29 +218,29 @@ public ObjectWithCollidingPropertiesMap validate(Map arg, SchemaConfigurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithCollidingProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithCollidingProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithCollidingProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithCollidingProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithCollidingProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java index 6581484c416..fe684c55bfe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DecimalJsonSchema; @@ -58,7 +59,7 @@ public String length() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for length"); + throw new InvalidTypeException("Invalid value stored for length"); } return (String) value; } @@ -68,7 +69,7 @@ public String width() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for width"); + throw new InvalidTypeException("Invalid value stored for width"); } return (String) value; } @@ -78,7 +79,7 @@ public Money.MoneyMap cost() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Money.MoneyMap)) { - throw new RuntimeException("Invalid value stored for cost"); + throw new InvalidTypeException("Invalid value stored for cost"); } return (Money.MoneyMap) value; } @@ -201,7 +202,7 @@ public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -209,7 +210,7 @@ public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -219,7 +220,7 @@ public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List return new ObjectWithDecimalPropertiesMap(castProperties); } - public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -231,29 +232,29 @@ public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithDecimalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithDecimalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithDecimalProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithDecimalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithDecimalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java index 9eaf1306f8d..de3ef5c0fd5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -247,7 +248,7 @@ public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -255,7 +256,7 @@ public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -265,7 +266,7 @@ public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithDifficultlyNamedPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -277,29 +278,29 @@ public ObjectWithDifficultlyNamedPropsMap validate(Map arg, SchemaConfigur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithDifficultlyNamedProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithDifficultlyNamedProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithDifficultlyNamedProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithDifficultlyNamedProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithDifficultlyNamedProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java index c88a642a47a..e5dd13be7c0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -80,29 +81,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -172,7 +173,7 @@ public static SomeProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +185,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -196,7 +197,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,24 +208,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -256,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -283,7 +284,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -291,7 +292,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -301,7 +302,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,7 +314,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -328,10 +329,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -346,34 +347,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public SomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomePropBoxedVoid(validate(arg, configuration)); } @Override - public SomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public SomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomePropBoxedBoolean(validate(arg, configuration)); } @Override - public SomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public SomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomePropBoxedNumber(validate(arg, configuration)); } @Override - public SomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public SomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomePropBoxedString(validate(arg, configuration)); } @Override - public SomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public SomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomePropBoxedList(validate(arg, configuration)); } @Override - public SomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomePropBoxedMap(validate(arg, configuration)); } @Override - public SomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public SomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -389,7 +390,7 @@ public SomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -543,7 +544,7 @@ public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -551,7 +552,7 @@ public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -561,7 +562,7 @@ public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List return new ObjectWithInlineCompositionPropertyMap(castProperties); } - public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -573,29 +574,29 @@ public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithInlineCompositionProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithInlineCompositionProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithInlineCompositionProperty1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithInlineCompositionProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithInlineCompositionProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java index bb4e4b05c6d..6503902e3e9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -43,7 +44,7 @@ public static ObjectWithInvalidNamedRefedPropertiesMap of(Map arg, Li for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -198,7 +199,7 @@ public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(Map arg, Li Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -208,7 +209,7 @@ public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(Map arg, Li return new ObjectWithInvalidNamedRefedPropertiesMap(castProperties); } - public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -220,29 +221,29 @@ public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaCo @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithInvalidNamedRefedProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithInvalidNamedRefedProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithInvalidNamedRefedProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithInvalidNamedRefedProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithInvalidNamedRefedProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java index fba62004ad4..c27d1e36619 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -68,7 +69,7 @@ public Number a() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for a"); + throw new InvalidTypeException("Invalid value stored for a"); } return (Number) value; } @@ -77,7 +78,7 @@ public String getAdditionalProperty(String name) throws UnsetPropertyException, throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for " + name); + throw new InvalidTypeException("Invalid value stored for " + name); } return (String) value; } @@ -194,7 +195,7 @@ public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -202,12 +203,12 @@ public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } 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"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } @@ -215,7 +216,7 @@ public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithNonIntersectingValuesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -227,29 +228,29 @@ public ObjectWithNonIntersectingValuesMap validate(Map arg, SchemaConfigur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithNonIntersectingValues1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithNonIntersectingValues1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithNonIntersectingValues1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithNonIntersectingValues1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithNonIntersectingValues1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java index d8b8726ab28..5f76e1a3b33 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -82,7 +83,7 @@ public String a() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for a"); + throw new InvalidTypeException("Invalid value stored for a"); } return (String) value; } @@ -92,7 +93,7 @@ public Number b() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for b"); + throw new InvalidTypeException("Invalid value stored for b"); } return (Number) value; } @@ -209,7 +210,7 @@ public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -217,12 +218,12 @@ public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } 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"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } @@ -230,7 +231,7 @@ public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List return new ObjectWithOnlyOptionalPropsMap(castProperties); } - public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,29 +243,29 @@ public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithOnlyOptionalProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithOnlyOptionalProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithOnlyOptionalProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithOnlyOptionalProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithOnlyOptionalProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java index fedaf9d618a..224aad5414a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -56,7 +57,7 @@ public String test() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for test"); + throw new InvalidTypeException("Invalid value stored for test"); } return (String) value; } @@ -147,7 +148,7 @@ public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -155,7 +156,7 @@ public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -165,7 +166,7 @@ public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List return new ObjectWithOptionalTestPropMap(castProperties); } - public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,29 +178,29 @@ public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithOptionalTestProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithOptionalTestProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithOptionalTestProp1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithOptionalTestProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithOptionalTestProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java index bc80404533f..55808b655b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -65,7 +66,7 @@ public static ObjectWithValidations1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -73,7 +74,7 @@ public static ObjectWithValidations1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -83,7 +84,7 @@ public static ObjectWithValidations1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -95,29 +96,29 @@ public static ObjectWithValidations1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithValidations1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java index 095cd4d6adb..de3df444595 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -146,29 +147,29 @@ public String validate(StringStatusEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new StatusBoxedString(validate(arg, configuration)); } @Override - public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -205,7 +206,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); + throw new InvalidTypeException("Invalid value stored for id"); } return (Number) value; } @@ -215,7 +216,7 @@ public Number petId() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for petId"); + throw new InvalidTypeException("Invalid value stored for petId"); } return (Number) value; } @@ -225,7 +226,7 @@ public Number quantity() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for quantity"); + throw new InvalidTypeException("Invalid value stored for quantity"); } return (Number) value; } @@ -235,7 +236,7 @@ public String shipDate() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for shipDate"); + throw new InvalidTypeException("Invalid value stored for shipDate"); } return (String) value; } @@ -245,7 +246,7 @@ public String status() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for status"); + throw new InvalidTypeException("Invalid value stored for status"); } return (String) value; } @@ -255,7 +256,7 @@ public boolean complete() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for complete"); + throw new InvalidTypeException("Invalid value stored for complete"); } return (boolean) value; } @@ -474,7 +475,7 @@ public OrderMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -482,7 +483,7 @@ public OrderMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -492,7 +493,7 @@ public OrderMap getNewInstance(Map arg, List pathToItem, PathToSch return new OrderMap(castProperties); } - public OrderMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public OrderMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -504,29 +505,29 @@ public OrderMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Order1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Order1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Order1BoxedMap(validate(arg, configuration)); } @Override - public Order1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Order1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java index 4029137d41a..7341ce01c3f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -125,12 +126,12 @@ public ResultsList getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof MyObjectDto.MyObjectDtoMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((MyObjectDto.MyObjectDtoMap) itemInstance); i += 1; @@ -150,29 +151,29 @@ public ResultsList validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ResultsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ResultsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ResultsBoxedList(validate(arg, configuration)); } @Override - public ResultsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ResultsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -192,7 +193,7 @@ public static PaginatedResultMyObjectDtoMap of(Map arg, SchemaCo public Number count() { Object value = get("count"); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for count"); + throw new InvalidTypeException("Invalid value stored for count"); } return (Number) value; } @@ -200,7 +201,7 @@ public Number count() { public ResultsList results() { Object value = get("results"); if (!(value instanceof ResultsList)) { - throw new RuntimeException("Invalid value stored for results"); + throw new InvalidTypeException("Invalid value stored for results"); } return (ResultsList) value; } @@ -354,7 +355,7 @@ public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -362,12 +363,12 @@ public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } 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"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } @@ -375,7 +376,7 @@ public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List return new PaginatedResultMyObjectDtoMap(castProperties); } - public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -387,29 +388,29 @@ public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PaginatedResultMyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PaginatedResultMyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PaginatedResultMyObjectDto1BoxedMap(validate(arg, configuration)); } @Override - public PaginatedResultMyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PaginatedResultMyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java index 891f53e085b..d9acac7bd8a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -67,7 +68,7 @@ public static ParentPet1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -75,7 +76,7 @@ public static ParentPet1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -85,7 +86,7 @@ public static ParentPet1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -97,29 +98,29 @@ public static ParentPet1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ParentPet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ParentPet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ParentPet1BoxedMap(validate(arg, configuration)); } @Override - public ParentPet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ParentPet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java index 6e0157524b4..22e72fa1bb5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -139,12 +140,12 @@ public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -164,29 +165,29 @@ public PhotoUrlsList validate(List arg, SchemaConfiguration configuration) th } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PhotoUrlsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public PhotoUrlsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PhotoUrlsBoxedList(validate(arg, configuration)); } @Override - public PhotoUrlsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PhotoUrlsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringStatusEnums implements StringValueMethod { @@ -257,29 +258,29 @@ public String validate(StringStatusEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new StatusBoxedString(validate(arg, configuration)); } @Override - public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -354,12 +355,12 @@ public TagsList getNewInstance(List arg, List pathToItem, PathToSchem itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Tag.TagMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((Tag.TagMap) itemInstance); i += 1; @@ -379,29 +380,29 @@ public TagsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TagsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public TagsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new TagsBoxedList(validate(arg, configuration)); } @Override - public TagsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public TagsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -426,7 +427,7 @@ public static PetMap of(Map arg, SchemaConfi public String name() { @Nullable Object value = get("name"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); + throw new InvalidTypeException("Invalid value stored for name"); } return (String) value; } @@ -434,7 +435,7 @@ public String name() { public PhotoUrlsList photoUrls() { @Nullable Object value = get("photoUrls"); if (!(value instanceof PhotoUrlsList)) { - throw new RuntimeException("Invalid value stored for photoUrls"); + throw new InvalidTypeException("Invalid value stored for photoUrls"); } return (PhotoUrlsList) value; } @@ -444,7 +445,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); + throw new InvalidTypeException("Invalid value stored for id"); } return (Number) value; } @@ -454,7 +455,7 @@ public Category.CategoryMap category() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Category.CategoryMap)) { - throw new RuntimeException("Invalid value stored for category"); + throw new InvalidTypeException("Invalid value stored for category"); } return (Category.CategoryMap) value; } @@ -464,7 +465,7 @@ public TagsList tags() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof TagsList)) { - throw new RuntimeException("Invalid value stored for tags"); + throw new InvalidTypeException("Invalid value stored for tags"); } return (TagsList) value; } @@ -474,7 +475,7 @@ public String status() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for status"); + throw new InvalidTypeException("Invalid value stored for status"); } return (String) value; } @@ -711,7 +712,7 @@ public PetMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -719,7 +720,7 @@ public PetMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -729,7 +730,7 @@ public PetMap getNewInstance(Map arg, List pathToItem, PathToSchem return new PetMap(castProperties); } - public PetMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PetMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -741,29 +742,29 @@ public PetMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Pet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Pet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Pet1BoxedMap(validate(arg, configuration)); } @Override - public Pet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Pet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java index 68fab7484ef..9a385a57d58 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -107,7 +108,7 @@ public static Pig1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -119,7 +120,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,7 +132,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,24 +143,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -218,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -236,7 +237,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -263,10 +264,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,34 +282,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Pig1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Pig1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Pig1BoxedVoid(validate(arg, configuration)); } @Override - public Pig1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Pig1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Pig1BoxedBoolean(validate(arg, configuration)); } @Override - public Pig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Pig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Pig1BoxedNumber(validate(arg, configuration)); } @Override - public Pig1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Pig1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Pig1BoxedString(validate(arg, configuration)); } @Override - public Pig1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Pig1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Pig1BoxedList(validate(arg, configuration)); } @Override - public Pig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Pig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Pig1BoxedMap(validate(arg, configuration)); } @Override - public Pig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Pig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -324,7 +325,7 @@ public Pig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java index 3908dffc525..e0555909702 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +58,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); + throw new InvalidTypeException("Invalid value stored for name"); } return (String) value; } @@ -67,7 +68,7 @@ public PlayerMap enemyPlayer() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof PlayerMap)) { - throw new RuntimeException("Invalid value stored for enemyPlayer"); + throw new InvalidTypeException("Invalid value stored for enemyPlayer"); } return (PlayerMap) value; } @@ -176,7 +177,7 @@ public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -184,7 +185,7 @@ public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -194,7 +195,7 @@ public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSc return new PlayerMap(castProperties); } - public PlayerMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PlayerMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,29 +207,29 @@ public PlayerMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Player1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Player1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Player1BoxedMap(validate(arg, configuration)); } @Override - public Player1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Player1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java index 12a5cb206e6..6e03a2081a6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -56,7 +57,7 @@ public String key() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for key"); + throw new InvalidTypeException("Invalid value stored for key"); } return (String) value; } @@ -149,7 +150,7 @@ public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -157,7 +158,7 @@ public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -167,7 +168,7 @@ public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathT return new PublicKeyMap(castProperties); } - public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -179,29 +180,29 @@ public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PublicKey1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PublicKey1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PublicKey1BoxedMap(validate(arg, configuration)); } @Override - public PublicKey1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PublicKey1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java index c46fd11c75b..eb0913bb7b3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -107,7 +108,7 @@ public static Quadrilateral1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -119,7 +120,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,7 +132,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,24 +143,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -218,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -236,7 +237,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -263,10 +264,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,34 +282,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Quadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Quadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Quadrilateral1BoxedVoid(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Quadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Quadrilateral1BoxedBoolean(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Quadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Quadrilateral1BoxedNumber(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Quadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Quadrilateral1BoxedString(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Quadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Quadrilateral1BoxedList(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Quadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Quadrilateral1BoxedMap(validate(arg, configuration)); } @Override - public Quadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Quadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -324,7 +325,7 @@ public Quadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurat } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java index 2f2db60c5e5..a78c73750d0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -103,29 +104,29 @@ public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ShapeTypeBoxedString(validate(arg, configuration)); } @Override - public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -156,7 +157,7 @@ public static QuadrilateralInterfaceMap of(Map> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -359,7 +360,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -371,7 +372,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -382,24 +383,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -431,7 +432,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -458,7 +459,7 @@ public QuadrilateralInterfaceMap getNewInstance(Map arg, List path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -466,7 +467,7 @@ public QuadrilateralInterfaceMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -476,7 +477,7 @@ public QuadrilateralInterfaceMap getNewInstance(Map arg, List path return new QuadrilateralInterfaceMap(castProperties); } - public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -488,7 +489,7 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration con } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -503,10 +504,10 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -521,34 +522,34 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QuadrilateralInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QuadrilateralInterface1BoxedVoid(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QuadrilateralInterface1BoxedBoolean(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QuadrilateralInterface1BoxedNumber(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QuadrilateralInterface1BoxedString(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QuadrilateralInterface1BoxedList(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QuadrilateralInterface1BoxedMap(validate(arg, configuration)); } @Override - public QuadrilateralInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -564,7 +565,7 @@ public QuadrilateralInterface1Boxed validateAndBox(@Nullable Object arg, SchemaC } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java index 6e3420867ce..68e6ae7401f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -68,7 +69,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for bar"); + throw new InvalidTypeException("Invalid value stored for bar"); } return (String) value; } @@ -78,7 +79,7 @@ public String baz() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for baz"); + throw new InvalidTypeException("Invalid value stored for baz"); } return (String) value; } @@ -185,7 +186,7 @@ public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, P for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -193,7 +194,7 @@ public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, P Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -203,7 +204,7 @@ public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, P return new ReadOnlyFirstMap(castProperties); } - public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,29 +216,29 @@ public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReadOnlyFirst1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ReadOnlyFirst1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ReadOnlyFirst1BoxedMap(validate(arg, configuration)); } @Override - public ReadOnlyFirst1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ReadOnlyFirst1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java index 0e8d8c58426..81d5e0b308c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -52,11 +53,7 @@ public static ReqPropsFromExplicitAddPropsMap of(Map arg, Schema } public String validName() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("validName"); } public String getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -210,7 +207,7 @@ public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,12 +215,12 @@ public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -231,7 +228,7 @@ public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException { + public ReqPropsFromExplicitAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,29 +240,29 @@ public ReqPropsFromExplicitAddPropsMap validate(Map arg, SchemaConfigurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReqPropsFromExplicitAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ReqPropsFromExplicitAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ReqPropsFromExplicitAddProps1BoxedMap(validate(arg, configuration)); } @Override - public ReqPropsFromExplicitAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ReqPropsFromExplicitAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java index 88595c25790..403e71edb6c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -52,11 +53,7 @@ public static ReqPropsFromTrueAddPropsMap of(Map arg, List pa for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -370,7 +367,7 @@ public ReqPropsFromTrueAddPropsMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -380,7 +377,7 @@ public ReqPropsFromTrueAddPropsMap getNewInstance(Map arg, List pa return new ReqPropsFromTrueAddPropsMap(castProperties); } - public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -392,29 +389,29 @@ public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReqPropsFromTrueAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ReqPropsFromTrueAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ReqPropsFromTrueAddProps1BoxedMap(validate(arg, configuration)); } @Override - public ReqPropsFromTrueAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ReqPropsFromTrueAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java index 26a7234885a..e35c0546b48 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -40,11 +41,7 @@ public static ReqPropsFromUnsetAddPropsMap of(Map arg, List p for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -289,7 +286,7 @@ public ReqPropsFromUnsetAddPropsMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -299,7 +296,7 @@ public ReqPropsFromUnsetAddPropsMap getNewInstance(Map arg, List p return new ReqPropsFromUnsetAddPropsMap(castProperties); } - public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -311,29 +308,29 @@ public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReqPropsFromUnsetAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ReqPropsFromUnsetAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ReqPropsFromUnsetAddProps1BoxedMap(validate(arg, configuration)); } @Override - public ReqPropsFromUnsetAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ReqPropsFromUnsetAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java index e09c2c586b1..cde9348b342 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -184,7 +185,7 @@ public static ReturnSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -196,7 +197,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,7 +209,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -219,24 +220,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -268,7 +269,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -295,7 +296,7 @@ public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -303,7 +304,7 @@ public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -313,7 +314,7 @@ public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSc return new ReturnMap(castProperties); } - public ReturnMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ReturnMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -325,7 +326,7 @@ public ReturnMap validate(Map arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -340,10 +341,10 @@ public ReturnMap validate(Map arg, SchemaConfiguration configuration) thro } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -358,34 +359,34 @@ public ReturnMap validate(Map arg, SchemaConfiguration configuration) thro } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReturnSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ReturnSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ReturnSchema1BoxedVoid(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ReturnSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ReturnSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ReturnSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ReturnSchema1BoxedNumber(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ReturnSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ReturnSchema1BoxedString(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ReturnSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ReturnSchema1BoxedList(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ReturnSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ReturnSchema1BoxedMap(validate(arg, configuration)); } @Override - public ReturnSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ReturnSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -401,7 +402,7 @@ public ReturnSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurati } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java index 3a6e545b3a1..a3a51048188 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -102,29 +103,29 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new TriangleTypeBoxedString(validate(arg, configuration)); } @Override - public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -145,7 +146,7 @@ public String triangleType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for triangleType"); + throw new InvalidTypeException("Invalid value stored for triangleType"); } return (String) value; } @@ -236,7 +237,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -244,7 +245,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -254,7 +255,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -266,29 +267,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -366,7 +367,7 @@ public static ScaleneTriangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -378,7 +379,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -390,7 +391,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -401,24 +402,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -450,7 +451,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -477,7 +478,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -485,7 +486,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -495,7 +496,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -507,7 +508,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -522,10 +523,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -540,34 +541,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ScaleneTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ScaleneTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ScaleneTriangle1BoxedVoid(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ScaleneTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ScaleneTriangle1BoxedBoolean(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ScaleneTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ScaleneTriangle1BoxedNumber(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ScaleneTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ScaleneTriangle1BoxedString(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ScaleneTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ScaleneTriangle1BoxedList(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ScaleneTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ScaleneTriangle1BoxedMap(validate(arg, configuration)); } @Override - public ScaleneTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ScaleneTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -583,7 +584,7 @@ public ScaleneTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfigur } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java index ddd41386c39..4ef90595cef 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -78,7 +79,7 @@ public Number name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for name"); + throw new InvalidTypeException("Invalid value stored for name"); } return (Number) value; } @@ -223,7 +224,7 @@ public static Schema200Response1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,7 +236,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -247,7 +248,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,24 +259,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -307,7 +308,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -334,7 +335,7 @@ public Schema200ResponseMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -342,7 +343,7 @@ public Schema200ResponseMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -352,7 +353,7 @@ public Schema200ResponseMap getNewInstance(Map arg, List pathToIte return new Schema200ResponseMap(castProperties); } - public Schema200ResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema200ResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -364,7 +365,7 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -379,10 +380,10 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -397,34 +398,34 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema200Response1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Schema200Response1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema200Response1BoxedVoid(validate(arg, configuration)); } @Override - public Schema200Response1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Schema200Response1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema200Response1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema200Response1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Schema200Response1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema200Response1BoxedNumber(validate(arg, configuration)); } @Override - public Schema200Response1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Schema200Response1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema200Response1BoxedString(validate(arg, configuration)); } @Override - public Schema200Response1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema200Response1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema200Response1BoxedList(validate(arg, configuration)); } @Override - public Schema200Response1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema200Response1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema200Response1BoxedMap(validate(arg, configuration)); } @Override - public Schema200Response1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema200Response1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -440,7 +441,7 @@ public Schema200Response1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java index 4b3d12e860b..391c432945d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -99,12 +100,12 @@ public SelfReferencingArrayModelList getNewInstance(List arg, List pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof SelfReferencingArrayModelList)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((SelfReferencingArrayModelList) itemInstance); i += 1; @@ -124,29 +125,29 @@ public SelfReferencingArrayModelList validate(List arg, SchemaConfiguration c } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SelfReferencingArrayModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public SelfReferencingArrayModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SelfReferencingArrayModel1BoxedList(validate(arg, configuration)); } @Override - public SelfReferencingArrayModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public SelfReferencingArrayModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java index cf46cae884b..06512cff6c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -44,7 +45,7 @@ public SelfReferencingObjectModelMap selfRef() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof SelfReferencingObjectModelMap)) { - throw new RuntimeException("Invalid value stored for selfRef"); + throw new InvalidTypeException("Invalid value stored for selfRef"); } return (SelfReferencingObjectModelMap) value; } @@ -53,7 +54,7 @@ public SelfReferencingObjectModelMap getAdditionalProperty(String name) throws U throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof SelfReferencingObjectModelMap)) { - throw new RuntimeException("Invalid value stored for " + name); + throw new InvalidTypeException("Invalid value stored for " + name); } return (SelfReferencingObjectModelMap) value; } @@ -152,7 +153,7 @@ public SelfReferencingObjectModelMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -160,7 +161,7 @@ public SelfReferencingObjectModelMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -170,7 +171,7 @@ public SelfReferencingObjectModelMap getNewInstance(Map arg, List return new SelfReferencingObjectModelMap(castProperties); } - public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -182,29 +183,29 @@ public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SelfReferencingObjectModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SelfReferencingObjectModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SelfReferencingObjectModel1BoxedMap(validate(arg, configuration)); } @Override - public SelfReferencingObjectModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public SelfReferencingObjectModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java index 707b7d06ec3..42a01a295f5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -107,7 +108,7 @@ public static Shape1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -119,7 +120,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,7 +132,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,24 +143,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -218,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -236,7 +237,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -263,10 +264,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,34 +282,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Shape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Shape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Shape1BoxedVoid(validate(arg, configuration)); } @Override - public Shape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Shape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Shape1BoxedBoolean(validate(arg, configuration)); } @Override - public Shape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Shape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Shape1BoxedNumber(validate(arg, configuration)); } @Override - public Shape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Shape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Shape1BoxedString(validate(arg, configuration)); } @Override - public Shape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Shape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Shape1BoxedList(validate(arg, configuration)); } @Override - public Shape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Shape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Shape1BoxedMap(validate(arg, configuration)); } @Override - public Shape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Shape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -324,7 +325,7 @@ public Shape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java index de5a61a3518..f2ee34e6eee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -122,7 +123,7 @@ public static ShapeOrNull1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -134,7 +135,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -146,7 +147,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -157,24 +158,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,7 +207,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -233,7 +234,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -241,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -251,7 +252,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -263,7 +264,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -278,10 +279,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -296,34 +297,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapeOrNull1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ShapeOrNull1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ShapeOrNull1BoxedVoid(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ShapeOrNull1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ShapeOrNull1BoxedBoolean(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ShapeOrNull1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ShapeOrNull1BoxedNumber(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ShapeOrNull1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ShapeOrNull1BoxedString(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ShapeOrNull1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ShapeOrNull1BoxedList(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ShapeOrNull1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ShapeOrNull1BoxedMap(validate(arg, configuration)); } @Override - public ShapeOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ShapeOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -339,7 +340,7 @@ public ShapeOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java index 21e800bc477..e003d011a1f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -102,29 +103,29 @@ public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration conf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QuadrilateralTypeBoxedString(validate(arg, configuration)); } @Override - public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -145,7 +146,7 @@ public String quadrilateralType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for quadrilateralType"); + throw new InvalidTypeException("Invalid value stored for quadrilateralType"); } return (String) value; } @@ -236,7 +237,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -244,7 +245,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -254,7 +255,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -266,29 +267,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -366,7 +367,7 @@ public static SimpleQuadrilateral1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -378,7 +379,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -390,7 +391,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -401,24 +402,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -450,7 +451,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -477,7 +478,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -485,7 +486,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -495,7 +496,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -507,7 +508,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -522,10 +523,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -540,34 +541,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SimpleQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public SimpleQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SimpleQuadrilateral1BoxedVoid(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public SimpleQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SimpleQuadrilateral1BoxedBoolean(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public SimpleQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SimpleQuadrilateral1BoxedNumber(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public SimpleQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SimpleQuadrilateral1BoxedString(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public SimpleQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SimpleQuadrilateral1BoxedList(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SimpleQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SimpleQuadrilateral1BoxedMap(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public SimpleQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -583,7 +584,7 @@ public SimpleQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java index 8718a67dee6..f2be945112a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -106,7 +107,7 @@ public static SomeObject1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -118,7 +119,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,7 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,24 +142,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -190,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -217,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -235,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -247,7 +248,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,10 +263,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,34 +281,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SomeObject1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public SomeObject1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeObject1BoxedVoid(validate(arg, configuration)); } @Override - public SomeObject1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public SomeObject1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeObject1BoxedBoolean(validate(arg, configuration)); } @Override - public SomeObject1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public SomeObject1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeObject1BoxedNumber(validate(arg, configuration)); } @Override - public SomeObject1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public SomeObject1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeObject1BoxedString(validate(arg, configuration)); } @Override - public SomeObject1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public SomeObject1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeObject1BoxedList(validate(arg, configuration)); } @Override - public SomeObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SomeObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeObject1BoxedMap(validate(arg, configuration)); } @Override - public SomeObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public SomeObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -323,7 +324,7 @@ public SomeObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java index a215bad464d..ded331f552f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -56,7 +57,7 @@ public String a() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for a"); + throw new InvalidTypeException("Invalid value stored for a"); } return (String) value; } @@ -149,7 +150,7 @@ public SpecialModelnameMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -157,7 +158,7 @@ public SpecialModelnameMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -167,7 +168,7 @@ public SpecialModelnameMap getNewInstance(Map arg, List pathToItem return new SpecialModelnameMap(castProperties); } - public SpecialModelnameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SpecialModelnameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -179,29 +180,29 @@ public SpecialModelnameMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SpecialModelname1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SpecialModelname1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SpecialModelname1BoxedMap(validate(arg, configuration)); } @Override - public SpecialModelname1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public SpecialModelname1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java index 3cd9d77465b..a68c7c2ef85 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -52,7 +53,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new RuntimeException("Value may not be null"); + throw new InvalidTypeException("Value may not be null"); } return (boolean) value; } @@ -132,7 +133,7 @@ public StringBooleanMapMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -140,12 +141,12 @@ public StringBooleanMapMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -153,7 +154,7 @@ public StringBooleanMapMap getNewInstance(Map arg, List pathToItem return new StringBooleanMapMap(castProperties); } - public StringBooleanMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public StringBooleanMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -165,29 +166,29 @@ public StringBooleanMapMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringBooleanMap1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public StringBooleanMap1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new StringBooleanMap1BoxedMap(validate(arg, configuration)); } @Override - public StringBooleanMap1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public StringBooleanMap1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java index 75aa221d691..2be475bc0f4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java @@ -8,6 +8,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -141,40 +142,40 @@ public String validate(StringStringEnumEnums arg,SchemaConfiguration configurati } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringEnum1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public StringEnum1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new StringEnum1BoxedVoid(validate(arg, configuration)); } @Override - public StringEnum1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public StringEnum1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new StringEnum1BoxedString(validate(arg, configuration)); } @Override - public StringEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public StringEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java index 995121cb014..ea6617a8b7a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -96,35 +97,35 @@ public String validate(StringStringEnumWithDefaultValueEnums arg,SchemaConfigura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public StringEnumWithDefaultValue1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public StringEnumWithDefaultValue1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new StringEnumWithDefaultValue1BoxedString(validate(arg, configuration)); } @Override - public StringEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public StringEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java index 8cb16f298db..c618fe0a225 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -68,29 +69,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringWithValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public StringWithValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new StringWithValidation1BoxedString(validate(arg, configuration)); } @Override - public StringWithValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public StringWithValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java index 6b1b1a88433..bb7cc4c9bf1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -69,7 +70,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); + throw new InvalidTypeException("Invalid value stored for id"); } return (Number) value; } @@ -79,7 +80,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); + throw new InvalidTypeException("Invalid value stored for name"); } return (String) value; } @@ -204,7 +205,7 @@ public TagMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -212,7 +213,7 @@ public TagMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -222,7 +223,7 @@ public TagMap getNewInstance(Map arg, List pathToItem, PathToSchem return new TagMap(castProperties); } - public TagMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public TagMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -234,29 +235,29 @@ public TagMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Tag1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Tag1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Tag1BoxedMap(validate(arg, configuration)); } @Override - public Tag1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Tag1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java index 3bc2f282022..9a6a0546bd6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +109,7 @@ public static Triangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +121,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +133,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +144,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -192,7 +193,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -219,7 +220,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -237,7 +238,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,10 +265,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,34 +283,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Triangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Triangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Triangle1BoxedVoid(validate(arg, configuration)); } @Override - public Triangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Triangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Triangle1BoxedBoolean(validate(arg, configuration)); } @Override - public Triangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Triangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Triangle1BoxedNumber(validate(arg, configuration)); } @Override - public Triangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Triangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Triangle1BoxedString(validate(arg, configuration)); } @Override - public Triangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Triangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Triangle1BoxedList(validate(arg, configuration)); } @Override - public Triangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Triangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Triangle1BoxedMap(validate(arg, configuration)); } @Override - public Triangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Triangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +326,7 @@ public Triangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java index 56a2cbfeeb5..8e0505b9eb8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -103,29 +104,29 @@ public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ShapeTypeBoxedString(validate(arg, configuration)); } @Override - public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -156,7 +157,7 @@ public static TriangleInterfaceMap of(Map ar public String shapeType() { @Nullable Object value = get("shapeType"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for shapeType"); + throw new InvalidTypeException("Invalid value stored for shapeType"); } return (String) value; } @@ -164,7 +165,7 @@ public String shapeType() { public String triangleType() { @Nullable Object value = get("triangleType"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for triangleType"); + throw new InvalidTypeException("Invalid value stored for triangleType"); } return (String) value; } @@ -347,7 +348,7 @@ public static TriangleInterface1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -359,7 +360,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -371,7 +372,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -382,24 +383,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -431,7 +432,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -458,7 +459,7 @@ public TriangleInterfaceMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -466,7 +467,7 @@ public TriangleInterfaceMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -476,7 +477,7 @@ public TriangleInterfaceMap getNewInstance(Map arg, List pathToIte return new TriangleInterfaceMap(castProperties); } - public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -488,7 +489,7 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -503,10 +504,10 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -521,34 +522,34 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new TriangleInterface1BoxedVoid(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new TriangleInterface1BoxedBoolean(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new TriangleInterface1BoxedNumber(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new TriangleInterface1BoxedString(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new TriangleInterface1BoxedList(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new TriangleInterface1BoxedMap(validate(arg, configuration)); } @Override - public TriangleInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public TriangleInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -564,7 +565,7 @@ public TriangleInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java index 8455abea757..3f8a3975eb4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java @@ -8,6 +8,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -70,29 +71,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UUIDString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public UUIDString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UUIDString1BoxedString(validate(arg, configuration)); } @Override - public UUIDString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public UUIDString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java index ff051614480..feca1011e62 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -195,7 +196,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -203,7 +204,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -213,7 +214,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -225,40 +226,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithNoDeclaredPropsNullableBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithNoDeclaredPropsNullableBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithNoDeclaredPropsNullableBoxedVoid(validate(arg, configuration)); } @Override - public ObjectWithNoDeclaredPropsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithNoDeclaredPropsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithNoDeclaredPropsNullableBoxedMap(validate(arg, configuration)); } @Override - public ObjectWithNoDeclaredPropsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithNoDeclaredPropsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -348,7 +349,7 @@ public static AnyTypeExceptNullProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -360,7 +361,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -372,7 +373,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -383,24 +384,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -432,7 +433,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -459,7 +460,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -467,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -477,7 +478,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -489,7 +490,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -504,10 +505,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -522,34 +523,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyTypeExceptNullPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeExceptNullPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeExceptNullPropBoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeExceptNullPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeExceptNullPropBoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeExceptNullPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeExceptNullPropBoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeExceptNullPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeExceptNullPropBoxedString(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeExceptNullPropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeExceptNullPropBoxedList(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeExceptNullPropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeExceptNullPropBoxedMap(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeExceptNullPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -565,7 +566,7 @@ public AnyTypeExceptNullPropBoxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -609,7 +610,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for id"); + throw new InvalidTypeException("Invalid value stored for id"); } return (Number) value; } @@ -619,7 +620,7 @@ public String username() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for username"); + throw new InvalidTypeException("Invalid value stored for username"); } return (String) value; } @@ -629,7 +630,7 @@ public String firstName() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for firstName"); + throw new InvalidTypeException("Invalid value stored for firstName"); } return (String) value; } @@ -639,7 +640,7 @@ public String lastName() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for lastName"); + throw new InvalidTypeException("Invalid value stored for lastName"); } return (String) value; } @@ -649,7 +650,7 @@ public String email() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for email"); + throw new InvalidTypeException("Invalid value stored for email"); } return (String) value; } @@ -659,7 +660,7 @@ public String password() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for password"); + throw new InvalidTypeException("Invalid value stored for password"); } return (String) value; } @@ -669,7 +670,7 @@ public String phone() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for phone"); + throw new InvalidTypeException("Invalid value stored for phone"); } return (String) value; } @@ -679,7 +680,7 @@ public Number userStatus() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for userStatus"); + throw new InvalidTypeException("Invalid value stored for userStatus"); } return (Number) value; } @@ -689,7 +690,7 @@ public FrozenMap objectWithNoDeclaredProps() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for objectWithNoDeclaredProps"); + throw new InvalidTypeException("Invalid value stored for objectWithNoDeclaredProps"); } return (FrozenMap) value; } @@ -699,7 +700,7 @@ public FrozenMap objectWithNoDeclaredProps() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof FrozenMap)) { - throw new RuntimeException("Invalid value stored for objectWithNoDeclaredPropsNullable"); + throw new InvalidTypeException("Invalid value stored for objectWithNoDeclaredPropsNullable"); } return (@Nullable FrozenMap) value; } @@ -1168,7 +1169,7 @@ public UserMap getNewInstance(Map arg, List pathToItem, PathToSche for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1176,7 +1177,7 @@ public UserMap getNewInstance(Map arg, List pathToItem, PathToSche Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1186,7 +1187,7 @@ public UserMap getNewInstance(Map arg, List pathToItem, PathToSche return new UserMap(castProperties); } - public UserMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public UserMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1198,29 +1199,29 @@ public UserMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public User1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public User1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new User1BoxedMap(validate(arg, configuration)); } @Override - public User1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public User1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java index 10d89abd9fd..ae2e8a60d52 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -117,29 +118,29 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -161,7 +162,7 @@ public static WhaleMap of(Map arg, SchemaCon public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for className"); + throw new InvalidTypeException("Invalid value stored for className"); } return (String) value; } @@ -171,7 +172,7 @@ public boolean hasBaleen() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for hasBaleen"); + throw new InvalidTypeException("Invalid value stored for hasBaleen"); } return (boolean) value; } @@ -181,7 +182,7 @@ public boolean hasTeeth() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new RuntimeException("Invalid value stored for hasTeeth"); + throw new InvalidTypeException("Invalid value stored for hasTeeth"); } return (boolean) value; } @@ -323,7 +324,7 @@ public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -331,7 +332,7 @@ public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -341,7 +342,7 @@ public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSch return new WhaleMap(castProperties); } - public WhaleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public WhaleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -353,29 +354,29 @@ public WhaleMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Whale1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Whale1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Whale1BoxedMap(validate(arg, configuration)); } @Override - public Whale1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Whale1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java index 0b9d57cfa03..168d9e099dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -110,29 +111,29 @@ public String validate(StringTypeEnums arg,SchemaConfiguration configuration) th } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public TypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new TypeBoxedString(validate(arg, configuration)); } @Override - public TypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public TypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringClassNameEnums implements StringValueMethod { @@ -199,29 +200,29 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -242,7 +243,7 @@ public static ZebraMap of(Map arg, SchemaCon public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for className"); + throw new InvalidTypeException("Invalid value stored for className"); } return (String) value; } @@ -252,7 +253,7 @@ public String type() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for type"); + throw new InvalidTypeException("Invalid value stored for type"); } return (String) value; } @@ -453,7 +454,7 @@ public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -461,7 +462,7 @@ public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -471,7 +472,7 @@ public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSch return new ZebraMap(castProperties); } - public ZebraMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ZebraMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -483,29 +484,29 @@ public ZebraMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Zebra1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Zebra1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Zebra1BoxedMap(validate(arg, configuration)); } @Override - public Zebra1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Zebra1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index 3413af1911e..9b64de10f0c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -21,7 +21,6 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; import org.openapijsonschematools.client.securityschemes.SecurityScheme; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.checkerframework.checker.nullness.qual.Nullable; import java.time.Duration; @@ -32,7 +31,6 @@ public class ApiConfiguration { private final ServerInfo serverInfo; - private final ServerIndexInfo serverIndexInfo; private final SecurityInfo securityInfo; private final SecurityIndexInfo securityIndexInfo; private final @Nullable Duration timeout; @@ -40,16 +38,14 @@ public class ApiConfiguration { public ApiConfiguration() { serverInfo = new ServerInfo(); - serverIndexInfo = new ServerIndexInfo(); securityInfo = new SecurityInfo(); securityIndexInfo = new SecurityIndexInfo(); securitySchemeInfo = new HashMap<>(); timeout = null; } - public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, List securitySchemes, SecurityIndexInfo securityIndexInfo, Duration timeout) { + public ApiConfiguration(ServerInfo serverInfo, SecurityIndexInfo securityIndexInfo, List securitySchemes, Duration timeout) { this.serverInfo = serverInfo; - this.serverIndexInfo = serverIndexInfo; this.securityInfo = new SecurityInfo(); this.securityIndexInfo = securityIndexInfo; securitySchemeInfo = new HashMap<>(); @@ -60,83 +56,35 @@ public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, } public static class ServerInfo { - protected final RootServerInfo.RootServerInfo1 rootServerInfo; - protected final FooGetServerInfo.FooGetServerInfo1 fooGetServerInfo; - protected final PetfindbystatusServerInfo.PetfindbystatusServerInfo1 petfindbystatusServerInfo; + protected final RootServerInfo rootServerInfo; + protected final FooGetServerInfo fooGetServerInfo; + protected final PetfindbystatusServerInfo petfindbystatusServerInfo; public ServerInfo() { - rootServerInfo = new RootServerInfo.RootServerInfo1(); - fooGetServerInfo = new FooGetServerInfo.FooGetServerInfo1(); - petfindbystatusServerInfo = new PetfindbystatusServerInfo.PetfindbystatusServerInfo1(); + rootServerInfo = new RootServerInfo(); + fooGetServerInfo = new FooGetServerInfo(); + petfindbystatusServerInfo = new PetfindbystatusServerInfo(); } public ServerInfo( - RootServerInfo. @Nullable RootServerInfo1 rootServerInfo, - FooGetServerInfo. @Nullable FooGetServerInfo1 fooGetServerInfo, - PetfindbystatusServerInfo. @Nullable PetfindbystatusServerInfo1 petfindbystatusServerInfo + @Nullable RootServerInfo rootServerInfo, + @Nullable FooGetServerInfo fooGetServerInfo, + @Nullable PetfindbystatusServerInfo petfindbystatusServerInfo ) { - this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo.RootServerInfo1::new); - this.fooGetServerInfo = Objects.requireNonNullElseGet(fooGetServerInfo, FooGetServerInfo.FooGetServerInfo1::new); - this.petfindbystatusServerInfo = Objects.requireNonNullElseGet(petfindbystatusServerInfo, PetfindbystatusServerInfo.PetfindbystatusServerInfo1::new); - } - } - - public static class ServerIndexInfo { - protected RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex; - protected FooGetServerInfo. @Nullable ServerIndex fooGetServerInfoServerIndex; - protected PetfindbystatusServerInfo. @Nullable ServerIndex petfindbystatusServerInfoServerIndex; - public ServerIndexInfo() {} - - public ServerIndexInfo rootServerInfoServerIndex(RootServerInfo.ServerIndex serverIndex) { - this.rootServerInfoServerIndex = serverIndex; - return this; - } - - public ServerIndexInfo fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex serverIndex) { - this.fooGetServerInfoServerIndex = serverIndex; - return this; - } - - public ServerIndexInfo petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex serverIndex) { - this.petfindbystatusServerInfoServerIndex = serverIndex; - return this; + this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo::new); + this.fooGetServerInfo = Objects.requireNonNullElseGet(fooGetServerInfo, FooGetServerInfo::new); + this.petfindbystatusServerInfo = Objects.requireNonNullElseGet(petfindbystatusServerInfo, PetfindbystatusServerInfo::new); } } public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { - var serverProvider = serverInfo.rootServerInfo; - if (serverIndex == null) { - RootServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.rootServerInfoServerIndex; - if (configServerIndex == null) { - throw new RuntimeException("rootServerInfoServerIndex is unset"); - } - return serverProvider.getServer(configServerIndex); - } - return serverProvider.getServer(serverIndex); + return serverInfo.rootServerInfo.getServer(serverIndex); } - public Server getServer(FooGetServerInfo. @Nullable ServerIndex serverIndex) { - var serverProvider = serverInfo.fooGetServerInfo; - if (serverIndex == null) { - FooGetServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.fooGetServerInfoServerIndex; - if (configServerIndex == null) { - throw new RuntimeException("fooGetServerInfoServerIndex is unset"); - } - return serverProvider.getServer(configServerIndex); - } - return serverProvider.getServer(serverIndex); + return serverInfo.fooGetServerInfo.getServer(serverIndex); } - public Server getServer(PetfindbystatusServerInfo. @Nullable ServerIndex serverIndex) { - var serverProvider = serverInfo.petfindbystatusServerInfo; - if (serverIndex == null) { - PetfindbystatusServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.petfindbystatusServerInfoServerIndex; - if (configServerIndex == null) { - throw new RuntimeException("petfindbystatusServerInfoServerIndex is unset"); - } - return serverProvider.getServer(configServerIndex); - } - return serverProvider.getServer(serverIndex); + return serverInfo.petfindbystatusServerInfo.getServer(serverIndex); } public static class SecurityInfo { @@ -174,20 +122,20 @@ public SecurityInfo() { } public static class SecurityIndexInfo { - public FakeDeleteSecurityInfo. @Nullable SecurityIndex fakeDeleteSecurityInfoSecurityIndex; - public FakePostSecurityInfo. @Nullable SecurityIndex fakePostSecurityInfoSecurityIndex; - public FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex; - public FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; - public FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex; - public PetPostSecurityInfo. @Nullable SecurityIndex petPostSecurityInfoSecurityIndex; - public PetPutSecurityInfo. @Nullable SecurityIndex petPutSecurityInfoSecurityIndex; - public PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex; - public PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex; - public PetpetidDeleteSecurityInfo. @Nullable SecurityIndex petpetidDeleteSecurityInfoSecurityIndex; - public PetpetidGetSecurityInfo. @Nullable SecurityIndex petpetidGetSecurityInfoSecurityIndex; - public PetpetidPostSecurityInfo. @Nullable SecurityIndex petpetidPostSecurityInfoSecurityIndex; - public PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex; - public StoreinventoryGetSecurityInfo. @Nullable SecurityIndex storeinventoryGetSecurityInfoSecurityIndex; + protected FakeDeleteSecurityInfo. @Nullable SecurityIndex fakeDeleteSecurityInfoSecurityIndex; + protected FakePostSecurityInfo. @Nullable SecurityIndex fakePostSecurityInfoSecurityIndex; + protected FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex; + protected FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; + protected FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex; + protected PetPostSecurityInfo. @Nullable SecurityIndex petPostSecurityInfoSecurityIndex; + protected PetPutSecurityInfo. @Nullable SecurityIndex petPutSecurityInfoSecurityIndex; + protected PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex; + protected PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex; + protected PetpetidDeleteSecurityInfo. @Nullable SecurityIndex petpetidDeleteSecurityInfoSecurityIndex; + protected PetpetidGetSecurityInfo. @Nullable SecurityIndex petpetidGetSecurityInfoSecurityIndex; + protected PetpetidPostSecurityInfo. @Nullable SecurityIndex petpetidPostSecurityInfoSecurityIndex; + protected PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex; + protected StoreinventoryGetSecurityInfo. @Nullable SecurityIndex storeinventoryGetSecurityInfoSecurityIndex; public SecurityIndexInfo() {} @@ -262,155 +210,155 @@ public SecurityIndexInfo storeinventoryGetSecurityInfoSecurityIndex(Storeinvento } } - public SecurityRequirementObject getSecurityRequirementObject(FakeDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(FakeDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.fakeDeleteSecurityInfo; if (securityIndex == null) { FakeDeleteSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakeDeleteSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("fakeDeleteSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("fakeDeleteSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakePostSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(FakePostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.fakePostSecurityInfo; if (securityIndex == null) { FakePostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakePostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("fakePostSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("fakePostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.fakemultiplesecuritiesGetSecurityInfo; if (securityIndex == null) { FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakemultiplesecuritiesGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("fakemultiplesecuritiesGetSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("fakemultiplesecuritiesGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.fakepetiduploadimagewithrequiredfilePostSecurityInfo; if (securityIndex == null) { FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.fakeclassnametestPatchSecurityInfo; if (securityIndex == null) { FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakeclassnametestPatchSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("fakeclassnametestPatchSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("fakeclassnametestPatchSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetPostSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(PetPostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.petPostSecurityInfo; if (securityIndex == null) { PetPostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petPostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("petPostSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("petPostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetPutSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(PetPutSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.petPutSecurityInfo; if (securityIndex == null) { PetPutSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petPutSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("petPutSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("petPutSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.petfindbystatusGetSecurityInfo; if (securityIndex == null) { PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petfindbystatusGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("petfindbystatusGetSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("petfindbystatusGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.petfindbytagsGetSecurityInfo; if (securityIndex == null) { PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petfindbytagsGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("petfindbytagsGetSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("petfindbytagsGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(PetpetidDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.petpetidDeleteSecurityInfo; if (securityIndex == null) { PetpetidDeleteSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetidDeleteSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("petpetidDeleteSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("petpetidDeleteSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidGetSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(PetpetidGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.petpetidGetSecurityInfo; if (securityIndex == null) { PetpetidGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetidGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("petpetidGetSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("petpetidGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidPostSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(PetpetidPostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.petpetidPostSecurityInfo; if (securityIndex == null) { PetpetidPostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetidPostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("petpetidPostSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("petpetidPostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.petpetiduploadimagePostSecurityInfo; if (securityIndex == null) { PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetiduploadimagePostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("petpetiduploadimagePostSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("petpetiduploadimagePostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(StoreinventoryGetSecurityInfo. @Nullable SecurityIndex securityIndex) { + public SecurityRequirementObject getSecurityRequirementObject(StoreinventoryGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { var securityInfoInstance = securityInfo.storeinventoryGetSecurityInfo; if (securityIndex == null) { StoreinventoryGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.storeinventoryGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new RuntimeException("storeinventoryGetSecurityInfoSecurityIndex is unset"); + throw new UnsetPropertyException("storeinventoryGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } @@ -429,7 +377,7 @@ public Map> getDefaultHeaders() { return new HashMap<>(); } - public @Nullable Duration getTimeout() { + public@Nullable Duration getTimeout() { return timeout; } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java index 268e9373289..3bea6999da1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.exceptions; @SuppressWarnings("serial") -public class BaseException extends Exception { +public class BaseException extends RuntimeException { public BaseException(String s) { super(s); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java index 0fc91100784..2b09f2f77df 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -5,21 +5,18 @@ import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.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 final Map> content; - public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, AbstractMap.SimpleEntry> content) { + public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, Map> content) { super(required, ParameterStyle.SIMPLE, explode, allowReserved); this.content = content; } @@ -31,28 +28,34 @@ private static HttpHeaders toHeaders(String name, String value) { } @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"); + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { + for (Map.Entry> entry: content.entrySet()) { + var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; + String contentType = entry.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + var value = ContentTypeSerializer.toJson(castInData); + return toHeaders(name, value); + } else { + throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); + } } + throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) { 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"); + for (Map.Entry> entry: content.entrySet()) { + String contentType = entry.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + return entry.getValue().schema().validate(deserializedJson, configuration); + } else { + throw new RuntimeException("Header deserialization of "+contentType+" has not yet been implemented"); + } } + throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } return deserializedJson; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java index 42387a7859b..ac9f6274b0d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java @@ -2,13 +2,11 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.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; + HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration); + @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration); } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java index 11707301d30..7bac0c8a6be 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java @@ -1,22 +1,26 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.ArrayList; +import java.util.AbstractMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; +import static java.util.stream.Collectors.toList; +import static java.util.stream.Collectors.toMap; + 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 { + private static String percentEncode(String s) { if (s == null) { return ""; } @@ -27,11 +31,11 @@ private static String percentEncode(String s) throws NotImplementedException { .replace("%7E", "~"); // This could be done faster with more hand-crafted code. } catch (UnsupportedEncodingException wow) { - throw new NotImplementedException(wow.getMessage()); + throw new RuntimeException(wow.getMessage(), wow); } } - private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) throws NotImplementedException { + private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) { /* 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= @@ -58,7 +62,7 @@ private static String percentEncode(String s) throws NotImplementedException { // 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); + throw new InvalidTypeException("Unable to generate a rfc6570 item representation of "+item); } private static String rfc6570StrNumberExpansion( @@ -67,7 +71,7 @@ private static String rfc6570StrNumberExpansion( 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; @@ -83,15 +87,11 @@ private static String rfc6570ListExpansion( 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); - } + ) { + var itemValues = inData.stream() + .map(v -> rfc6570ItemValue(v, percentEncode)) + .filter(Objects::nonNull) + .collect(toList()); if (itemValues.isEmpty()) { // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 return ""; @@ -116,19 +116,12 @@ private static String rfc6570MapExpansion( 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); - } + ) { + var inDataMap = inData.entrySet().stream() + .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), rfc6570ItemValue(entry.getValue(), percentEncode))) + .filter(entry -> entry.getValue() != null) + .collect(toMap(Map.Entry::getKey, Map.Entry::getValue, (x, y) -> y, LinkedHashMap::new)); + if (inDataMap.isEmpty()) { // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 return ""; @@ -150,7 +143,7 @@ protected static String rfc6570Expansion( boolean explode, boolean percentEncode, PrefixSeparatorIterator prefixSeparatorIterator - ) throws NotImplementedException { + ) { /* Separator is for separate variables like dict with explode true, not for array item separation @@ -188,6 +181,6 @@ protected static String rfc6570Expansion( ); } // bool, bytes, etc - throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); + throw new InvalidTypeException("Unable to generate a rfc6570 representation of "+inData); } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java index 0f929d9c63b..e4fcfd99924 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java @@ -3,8 +3,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.parameter.ParameterStyle; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; @@ -32,7 +30,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { var castInData = validate ? schema.validate(inData, configuration) : inData; boolean usedExplode = explode != null && explode; var value = StyleSerializer.serializeSimple(castInData, name, usedExplode, false); @@ -51,7 +49,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid 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 { + private List<@Nullable Object> getList(JsonSchema schema, List inData) { Class> itemsSchemaCls = schema.items == null ? UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.class : schema.items; JsonSchema itemSchema = JsonSchemaFactory.getInstance(itemsSchemaCls); List<@Nullable Object> castList = new ArrayList<>(); @@ -62,7 +60,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return castList; } - private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { + private @Nullable Object getCastInData(JsonSchema schema, List inData) { if (schema.type == null) { if (inData.size() == 1) { return inData.get(0); @@ -70,7 +68,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid 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"); + throw new RuntimeException("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) { @@ -78,16 +76,16 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid } 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"); + throw new RuntimeException("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"); + throw new RuntimeException("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 { + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) { @Nullable Object castInData = getCastInData(schema, inData); if (validate) { return schema.validate(castInData, configuration); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java index f5fa5a0a75b..d18be288684 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; public class StyleSerializer extends Rfc6570Serializer { public static String serializeSimple( @@ -9,7 +8,7 @@ public static String serializeSimple( String name, boolean explode, boolean percentEncode - ) throws NotImplementedException { + ) { var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); return rfc6570Expansion( name, @@ -25,7 +24,7 @@ public static String serializeForm( String name, boolean explode, boolean percentEncode - ) throws NotImplementedException { + ) { // todo check that the prefix and suffix matches this one PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); return rfc6570Expansion( @@ -41,7 +40,7 @@ public static String serializeMatrix( @Nullable Object inData, String name, boolean explode - ) throws NotImplementedException { + ) { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); return rfc6570Expansion( name, @@ -56,7 +55,7 @@ public static String serializeLabel( @Nullable Object inData, String name, boolean explode - ) throws NotImplementedException { + ) { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); return rfc6570Expansion( name, @@ -71,7 +70,7 @@ public static String serializeSpaceDelimited( @Nullable Object inData, String name, boolean explode - ) throws NotImplementedException { + ) { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); return rfc6570Expansion( name, @@ -86,7 +85,7 @@ public static String serializePipeDelimited( @Nullable Object inData, String name, boolean explode - ) throws NotImplementedException { + ) { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); return rfc6570Expansion( name, diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java index d5e00cc2fa9..79a3e781051 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java @@ -3,28 +3,30 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import java.util.Map; import java.util.AbstractMap; public class ContentParameter extends ParameterBase implements Parameter { - public final AbstractMap.SimpleEntry> content; + public final Map> content; - public ContentParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, AbstractMap.SimpleEntry> content) { + public ContentParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, Map> 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"); + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { + for (Map.Entry> entry: content.entrySet()) { + String contentType = entry.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + var value = ContentTypeSerializer.toJson(inData); + return new AbstractMap.SimpleEntry<>(name, value); + } else { + throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); + } } + throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java index dcd3b6faf6b..b04b2ca1754 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.Map; @@ -14,7 +13,7 @@ protected CookieSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData) throws NotImplementedException { + public String serialize(Map inData) { String result = ""; Map sortedData = new TreeMap<>(inData); for (Map.Entry entry: sortedData.entrySet()) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java index 1969f2c0b21..b4a23229944 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.LinkedHashMap; @@ -15,7 +14,7 @@ protected HeadersSerializer(Map parameters) { this.parameters = parameters; } - public Map> serialize(Map inData) throws NotImplementedException { + public Map> serialize(Map inData) { Map> results = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java index adf3896d557..9fe0745417c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; + AbstractMap.SimpleEntry serialize(@Nullable Object inData); } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java index 78015037211..5864f89c901 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.Map; @@ -13,7 +12,7 @@ protected PathSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException { + public String serialize(Map inData, String pathWithPlaceholders) { String result = pathWithPlaceholders; for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java index 880151ed144..91ea0b041bb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.HashMap; @@ -15,7 +14,7 @@ protected QuerySerializer(Map parameters) { this.parameters = parameters; } - public Map getQueryMap(Map inData) throws NotImplementedException { + public Map getQueryMap(Map inData) { Map results = new HashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java index eef0b6bc371..8acfdafcc8a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java @@ -2,7 +2,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.header.StyleSerializer; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import java.util.AbstractMap; @@ -27,7 +26,7 @@ private ParameterStyle getStyle() { } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { ParameterStyle usedStyle = getStyle(); boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; String value; @@ -53,7 +52,7 @@ public AbstractMap.SimpleEntry serialize(@Nullable Object inData } else { // usedStyle == ParameterStyle.DEEP_OBJECT // query - throw new NotImplementedException("Style deep object serialization has not yet been implemented."); + throw new RuntimeException("Style deep object serialization has not yet been implemented."); } return new AbstractMap.SimpleEntry<>(name, value); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java index b6dd1d97b37..185309045a1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.RequestBody; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Anotherfakedummy; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -62,7 +59,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java index ee80dad1860..e7c62840101 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java index b01a73ce335..27ad3c01c6a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java index 475bc216c9f..ca28ef6c947 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java @@ -6,13 +6,10 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.delete.PathParameters; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.Parameters; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; import java.io.IOException; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -65,7 +62,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java index 84e1e36efe5..596022972c9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java @@ -6,13 +6,10 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.get.PathParameters; import org.openapijsonschematools.client.paths.commonparamsubdir.get.Parameters; import org.openapijsonschematools.client.paths.commonparamsubdir.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; import java.io.IOException; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -66,7 +63,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java index 113973108cf..8abf71cc65e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java @@ -6,13 +6,10 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.post.PathParameters; import org.openapijsonschematools.client.paths.commonparamsubdir.post.Parameters; import org.openapijsonschematools.client.paths.commonparamsubdir.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; import java.io.IOException; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -65,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java index a721eaf3fb8..e8300624dfc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter0.Schema0; @@ -129,7 +130,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +138,12 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -150,7 +151,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,29 +163,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java index 0dc2b07dfaf..f7821fd56ce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter1.Schema1; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String subDir() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("subDir"); } } @@ -149,7 +146,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -157,12 +154,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -170,7 +167,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -182,29 +179,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java index 3a0905419c6..ac61599b023 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java index 4110959c0e3..4f908c5276b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -86,29 +87,29 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema11BoxedString(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java index 9fbb4015a95..662156732d6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String subDir() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("subDir"); } } @@ -149,7 +146,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -157,12 +154,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -170,7 +167,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -182,29 +179,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java index e8c5c6bd329..dac75cd1483 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.parameter0.Schema0; @@ -129,7 +130,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +138,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -150,7 +151,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,29 +163,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java index a491608f72f..2e9856cd26e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java index b6b17e739c3..d8f4f419e84 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -86,29 +87,29 @@ public String validate(StringRouteParamSchemaEnums0 arg,SchemaConfiguration conf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RouteParamSchema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public RouteParamSchema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new RouteParamSchema01BoxedString(validate(arg, configuration)); } @Override - public RouteParamSchema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public RouteParamSchema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java index 4bdf41e9a2f..ceba836e2ef 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.parameter0.Schema0; @@ -129,7 +130,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +138,12 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -150,7 +151,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,29 +163,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java index f0dcd660250..a37a27cda32 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String subDir() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("subDir"); } } @@ -149,7 +146,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -157,12 +154,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -170,7 +167,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -182,29 +179,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java index 12bcf6c08de..3ac09dfbbb6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java index 64e2a73038f..06270fdd0cc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java @@ -7,13 +7,10 @@ import org.openapijsonschematools.client.paths.fake.delete.QueryParameters; import org.openapijsonschematools.client.paths.fake.delete.Parameters; import org.openapijsonschematools.client.paths.fake.delete.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fake; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -34,7 +31,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -77,7 +74,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java index 94d40088458..f31068710a5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java @@ -7,13 +7,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.get.Parameters; import org.openapijsonschematools.client.paths.fake.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fake; @@ -34,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -82,7 +79,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java index 913a462909d..0bc3c524f25 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.patch.RequestBody; import org.openapijsonschematools.client.paths.fake.patch.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fake; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -62,7 +59,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java index 18da6442b7b..5a370e1d851 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; import org.openapijsonschematools.client.paths.fake.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fake; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -34,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -79,7 +76,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java index 1d8502b4091..143eff49895 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java @@ -4,17 +4,22 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class FakeDeleteSecurityInfo { public static class FakeDeleteSecurityInfo1 implements SecurityRequirementObjectProvider { - public final FakeDeleteSecurityRequirementObject0 security0; + final public EnumMap securities; public FakeDeleteSecurityInfo1() { - security0 = new FakeDeleteSecurityRequirementObject0(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakeDeleteSecurityRequirementObject0()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java index 85b788d456c..1cd54a34b9b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter1.Schema1; @@ -59,7 +60,7 @@ public static HeaderParametersMap of(Map arg public String required_boolean_group() { @Nullable Object value = get("required_boolean_group"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for required_boolean_group"); + throw new InvalidTypeException("Invalid value stored for required_boolean_group"); } return (String) value; } @@ -69,7 +70,7 @@ public String boolean_group() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for boolean_group"); + throw new InvalidTypeException("Invalid value stored for boolean_group"); } return (String) value; } @@ -187,7 +188,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -195,7 +196,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -205,7 +206,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -217,29 +218,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java index 17b5e6d69e9..338a0580300 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter0.Schema0; @@ -63,7 +64,7 @@ public static QueryParametersMap of(Map arg, public Number required_int64_group() { @Nullable Object value = get("required_int64_group"); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for required_int64_group"); + throw new InvalidTypeException("Invalid value stored for required_int64_group"); } return (Number) value; } @@ -71,7 +72,7 @@ public Number required_int64_group() { public String required_string_group() { @Nullable Object value = get("required_string_group"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for required_string_group"); + throw new InvalidTypeException("Invalid value stored for required_string_group"); } return (String) value; } @@ -81,7 +82,7 @@ public Number int64_group() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for int64_group"); + throw new InvalidTypeException("Invalid value stored for int64_group"); } return (Number) value; } @@ -91,7 +92,7 @@ public String string_group() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for string_group"); + throw new InvalidTypeException("Invalid value stored for string_group"); } return (String) value; } @@ -292,7 +293,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -300,7 +301,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -310,7 +311,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -322,29 +323,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java index 1ea719d635f..5e220e5decd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fake.delete.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java index 417a8c466fb..0fc48284aa6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -86,29 +87,29 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema11BoxedString(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java index 595c106806d..1bb4d6193c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -86,29 +87,29 @@ public String validate(StringSchemaEnums4 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema41BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Schema41BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema41BoxedString(validate(arg, configuration)); } @Override - public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java index 6e85c71e181..f58e04d481f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.get.parameters.parameter0.Schema0; @@ -60,7 +61,7 @@ public String enum_header_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for enum_header_string"); + throw new InvalidTypeException("Invalid value stored for enum_header_string"); } return (String) value; } @@ -70,7 +71,7 @@ public Schema0.SchemaList0 enum_header_string_array() throws UnsetPropertyExcept throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Schema0.SchemaList0)) { - throw new RuntimeException("Invalid value stored for enum_header_string_array"); + throw new InvalidTypeException("Invalid value stored for enum_header_string_array"); } return (Schema0.SchemaList0) value; } @@ -169,7 +170,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -177,7 +178,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -187,7 +188,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -199,29 +200,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java index 837ef9d55d7..9e6ff8205ec 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.get.parameters.parameter2.Schema2; @@ -64,7 +65,7 @@ public Number enum_query_double() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for enum_query_double"); + throw new InvalidTypeException("Invalid value stored for enum_query_double"); } return (Number) value; } @@ -74,7 +75,7 @@ public String enum_query_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for enum_query_string"); + throw new InvalidTypeException("Invalid value stored for enum_query_string"); } return (String) value; } @@ -84,7 +85,7 @@ public Number enum_query_integer() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new RuntimeException("Invalid value stored for enum_query_integer"); + throw new InvalidTypeException("Invalid value stored for enum_query_integer"); } return (Number) value; } @@ -94,7 +95,7 @@ public Schema2.SchemaList2 enum_query_string_array() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Schema2.SchemaList2)) { - throw new RuntimeException("Invalid value stored for enum_query_string_array"); + throw new InvalidTypeException("Invalid value stored for enum_query_string_array"); } return (Schema2.SchemaList2) value; } @@ -285,7 +286,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -293,7 +294,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -303,7 +304,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -315,29 +316,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java index 3f8f13a779a..c14807b0629 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fake.get; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java index 6027d75594f..4216c774363 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.fake.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fake.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -40,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java index 2b31d119440..8d4b0be69ff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -92,35 +93,35 @@ public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Items0BoxedString(validate(arg, configuration)); } @Override - public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -200,12 +201,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -225,29 +226,29 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java index 02907bcc352..d3e4cdf4429 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -90,35 +91,35 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema11BoxedString(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java index ffb41afbb75..df2e535ac26 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -92,35 +93,35 @@ public String validate(StringItemsEnums2 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public Items2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Items2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Items2BoxedString(validate(arg, configuration)); } @Override - public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -200,12 +201,12 @@ public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -225,29 +226,29 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema21BoxedList(validate(arg, configuration)); } @Override - public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java index 37fb6b578b6..cdf9d19c5f3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -90,35 +91,35 @@ public String validate(StringSchemaEnums3 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public Schema31BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Schema31BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema31BoxedString(validate(arg, configuration)); } @Override - public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java index e7762fe4493..1e2d7c15b13 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java @@ -8,6 +8,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -159,29 +160,29 @@ public double validate(DoubleSchemaEnums4 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema41BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Schema41BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema41BoxedNumber(validate(arg, configuration)); } @Override - public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java index 18dcf62eda7..d726146199c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java @@ -8,6 +8,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -114,29 +115,29 @@ public double validate(DoubleSchemaEnums5 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema51BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Schema51BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema51BoxedNumber(validate(arg, configuration)); } @Override - public Schema51Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema51Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index ea8f9b6295e..bbe2de005a6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -100,35 +101,35 @@ public String validate(StringApplicationxwwwformurlencodedItemsEnums arg,SchemaC } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public ApplicationxwwwformurlencodedItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedItemsBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -208,12 +209,12 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList getNewInstance(List< itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -233,29 +234,29 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList validate(List arg } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedEnumFormStringArrayBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedEnumFormStringArrayBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringApplicationxwwwformurlencodedEnumFormStringEnums implements StringValueMethod { @@ -327,35 +328,35 @@ public String validate(StringApplicationxwwwformurlencodedEnumFormStringEnums ar } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public ApplicationxwwwformurlencodedEnumFormStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedEnumFormStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedEnumFormStringBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedEnumFormStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedEnumFormStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -377,7 +378,7 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList enum_form_string_arr throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ApplicationxwwwformurlencodedEnumFormStringArrayList)) { - throw new RuntimeException("Invalid value stored for enum_form_string_array"); + throw new InvalidTypeException("Invalid value stored for enum_form_string_array"); } return (ApplicationxwwwformurlencodedEnumFormStringArrayList) value; } @@ -387,7 +388,7 @@ public String enum_form_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for enum_form_string"); + throw new InvalidTypeException("Invalid value stored for enum_form_string"); } return (String) value; } @@ -494,7 +495,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -502,7 +503,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -512,7 +513,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -524,29 +525,29 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java index 34af3ea2174..bad071e523a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fake.get.responses.code404response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code404Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java index 5ea188b2480..903ab9cd2b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fake.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java index 9e368e1e05c..dcd5c9d2941 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fake.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java index 013b581a6d4..feaf2d3706d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java @@ -4,17 +4,22 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class FakePostSecurityInfo { public static class FakePostSecurityInfo1 implements SecurityRequirementObjectProvider { - public final FakePostSecurityRequirementObject0 security0; + final public EnumMap securities; public FakePostSecurityInfo1() { - security0 = new FakePostSecurityRequirementObject0(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakePostSecurityRequirementObject0()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java index f1df9eb31ed..818941bb213 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fake.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java index 7a2562b0a60..0347ac523e0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.fake.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fake.post.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -40,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index bb231ecf95e..20f4442dd32 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -13,6 +13,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DateJsonSchema; @@ -100,29 +101,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedIntegerBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -183,29 +184,29 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedInt32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedInt32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedInt32BoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedInt32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedInt32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -284,29 +285,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedNumberBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -361,29 +362,29 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedFloatBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedFloatBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedFloatBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedFloatBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedFloatBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -439,29 +440,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedDoubleBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedDoubleBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedDoubleBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedDoubleBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedDoubleBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -512,29 +513,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedStringBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -584,29 +585,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -689,35 +690,35 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public ApplicationxwwwformurlencodedDateTimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedDateTimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedDateTimeBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedDateTimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedDateTimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -767,29 +768,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedPasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedPasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedPasswordBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedPasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedPasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -833,7 +834,7 @@ public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1540,7 +1541,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1550,7 +1551,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1562,29 +1563,29 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java index 4e6abc094e0..fb498802410 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java index 07c73d4f887..51b9bccff48 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeadditionalpropertieswitharrayofenums; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java index b58e901cf8c..c1f5f3adacd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java index be8ef287de3..fd1ec82a26a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java index 0a17d85055f..5a4986b6599 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java index ddc35d6146a..24fc177d34a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.RequestBody; import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakebodywithfileschema; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -62,7 +59,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java index a46287e74b1..3ce0af9cb18 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakebodywithfileschema.put; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java index 0beb85a7c98..cc35746e142 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java index ba8cd1a869b..6a6f5e33381 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java @@ -6,13 +6,10 @@ import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.QueryParameters; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.Parameters; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakebodywithqueryparams; @@ -33,7 +30,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -68,7 +65,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java index 03360b53511..24e01b5b448 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.parameter0.Schema0; @@ -54,11 +55,7 @@ public static QueryParametersMap of(Map arg, SchemaConfiguration } public String query() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("query"); } } @@ -143,7 +140,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -151,12 +148,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -164,7 +161,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -176,29 +173,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java index 8d9663e8ef7..ec82360b6dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java index 6109b533036..cd75c88f985 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java index 9740580cca0..5629b6ac700 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.QueryParameters; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.Parameters; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakecasesensitiveparams; import java.io.IOException; @@ -30,7 +27,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +56,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java index f3482c8b143..4b7ad8f27be 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter0.Schema0; @@ -60,7 +61,7 @@ public static QueryParametersMap of(Map arg, public String SomeVar() { @Nullable Object value = get("SomeVar"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for SomeVar"); + throw new InvalidTypeException("Invalid value stored for SomeVar"); } return (String) value; } @@ -68,7 +69,7 @@ public String SomeVar() { public String someVar() { @Nullable Object value = get("someVar"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for someVar"); + throw new InvalidTypeException("Invalid value stored for someVar"); } return (String) value; } @@ -76,7 +77,7 @@ public String someVar() { public String some_var() { @Nullable Object value = get("some_var"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for some_var"); + throw new InvalidTypeException("Invalid value stored for some_var"); } return (String) value; } @@ -284,7 +285,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -292,7 +293,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -302,7 +303,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,29 +315,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java index 657dc7e0feb..a82cea7d6d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java index dd5ea58f497..f718be09069 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.RequestBody; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeclassnametest; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -34,7 +31,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -75,7 +72,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java index a4a739aad43..3d2274ab9ac 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java @@ -4,17 +4,22 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class FakeclassnametestPatchSecurityInfo { public static class FakeclassnametestPatchSecurityInfo1 implements SecurityRequirementObjectProvider { - public final FakeclassnametestPatchSecurityRequirementObject0 security0; + final public EnumMap securities; public FakeclassnametestPatchSecurityInfo1() { - security0 = new FakeclassnametestPatchSecurityRequirementObject0(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakeclassnametestPatchSecurityRequirementObject0()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java index 6c0629531b3..20b70774ed5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java index 89d40f66041..aa4e6dc53e3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java index cedaa59345b..d63e6878058 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.PathParameters; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.Parameters; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakedeletecoffeeid; import java.io.IOException; @@ -30,7 +27,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -58,7 +55,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java index afb07c84f67..086a2e9a146 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.parameter0.Schema0; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String id() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("id"); } } @@ -143,7 +140,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -151,12 +148,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -164,7 +161,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -176,29 +173,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java index 992b7a97bbf..4707c2d13b3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.Code200Response; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -46,7 +44,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java index 1035e7e22d1..e770ec7cffa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java index 9e1fcb44bc3..ae08b521620 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java @@ -3,13 +3,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakehealth.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakehealth; import java.io.IOException; @@ -28,7 +25,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -53,7 +50,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java index 60cdc4cf144..06d52e39237 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakehealth.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java index 1de1e383c20..c627ade2788 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakehealth.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java index 6b9aec9067f..7e6343f7f04 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.RequestBody; import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeinlineadditionalproperties; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -62,7 +59,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java index 85529afa41c..628b1efee55 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java index aa94f2fbb73..37c62eb8e53 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 552865b8b4c..76ae9ff97d4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -121,7 +122,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -129,12 +130,12 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -142,7 +143,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -154,29 +155,29 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java index 06f4d279174..58b236864ec 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java @@ -6,13 +6,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.Parameters; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeinlinecomposition; @@ -33,7 +30,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -75,7 +72,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java index 144b9be7749..e562508fcb9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter0.Schema0; @@ -60,7 +61,7 @@ public static QueryParametersMap of(Map arg, throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new RuntimeException("Invalid value stored for compositionAtRoot"); + throw new InvalidTypeException("Invalid value stored for compositionAtRoot"); } return (@Nullable Object) value; } @@ -70,7 +71,7 @@ public Schema1.SchemaMap1 compositionInProperty() throws UnsetPropertyException throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Schema1.SchemaMap1)) { - throw new RuntimeException("Invalid value stored for compositionInProperty"); + throw new InvalidTypeException("Invalid value stored for compositionInProperty"); } return (Schema1.SchemaMap1) value; } @@ -211,7 +212,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,7 +220,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -229,7 +230,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,29 +242,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java index 0264be90b7b..062e79c82e3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakeinlinecomposition.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -49,7 +48,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java index ce85d87ccd8..eca3f947dfa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java index 2ce60fa7be0..ccc4f70f4e3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -78,29 +79,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema00BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Schema00BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema00BoxedString(validate(arg, configuration)); } @Override - public Schema00Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema00Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -170,7 +171,7 @@ public static Schema01 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -182,7 +183,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -194,7 +195,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -205,24 +206,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +255,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -281,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -289,7 +290,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -299,7 +300,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -311,7 +312,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -326,10 +327,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -344,34 +345,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedVoid(validate(arg, configuration)); } @Override - public Schema01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedBoolean(validate(arg, configuration)); } @Override - public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedNumber(validate(arg, configuration)); } @Override - public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedString(validate(arg, configuration)); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedMap(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -387,7 +388,7 @@ public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java index 44cb10452d6..53b54f01e86 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -80,29 +81,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedString(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -172,7 +173,7 @@ public static SomeProp1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +185,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -196,7 +197,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,24 +208,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -256,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -283,7 +284,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -291,7 +292,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -301,7 +302,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,7 +314,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -328,10 +329,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -346,34 +347,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SomeProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public SomeProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeProp1BoxedVoid(validate(arg, configuration)); } @Override - public SomeProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public SomeProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeProp1BoxedBoolean(validate(arg, configuration)); } @Override - public SomeProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public SomeProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeProp1BoxedNumber(validate(arg, configuration)); } @Override - public SomeProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public SomeProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeProp1BoxedString(validate(arg, configuration)); } @Override - public SomeProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public SomeProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeProp1BoxedList(validate(arg, configuration)); } @Override - public SomeProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SomeProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new SomeProp1BoxedMap(validate(arg, configuration)); } @Override - public SomeProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public SomeProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -389,7 +390,7 @@ public SomeProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -537,7 +538,7 @@ public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -545,7 +546,7 @@ public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -555,7 +556,7 @@ public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToS return new SchemaMap1(castProperties); } - public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -567,29 +568,29 @@ public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema11BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema11BoxedMap(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 90eeb11bea9..2c96cc9523d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -78,29 +79,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Applicationjson0BoxedString(validate(arg, configuration)); } @Override - public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -170,7 +171,7 @@ public static ApplicationjsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -182,7 +183,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -194,7 +195,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -205,24 +206,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +255,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -281,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -289,7 +290,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -299,7 +300,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -311,7 +312,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -326,10 +327,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -344,34 +345,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedString(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -387,7 +388,7 @@ public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCo } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 469b099493b..21b63d62157 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -80,29 +81,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Multipartformdata0BoxedString(validate(arg, configuration)); } @Override - public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -172,7 +173,7 @@ public static MultipartformdataSomeProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +185,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -196,7 +197,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,24 +208,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -256,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -283,7 +284,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -291,7 +292,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -301,7 +302,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,7 +314,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -328,10 +329,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -346,34 +347,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedVoid(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedBoolean(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedNumber(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedString(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedList(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -389,7 +390,7 @@ public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, Schem } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -537,7 +538,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -545,7 +546,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -555,7 +556,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -567,29 +568,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java index d8bdbbf90a7..27d0bbde2b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.multipartformdata.MultipartformdataSchema; @@ -52,15 +50,19 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); - } else { - MultipartformdataMediaType thisMediaType = (MultipartformdataMediaType) mediaType; + } else if (mediaType instanceof MultipartformdataMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new MultipartformdataResponseBody(deserializedBody); } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java index 168cbeb975c..695b0da9c5b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -78,29 +79,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Applicationjson0BoxedString(validate(arg, configuration)); } @Override - public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -170,7 +171,7 @@ public static ApplicationjsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -182,7 +183,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -194,7 +195,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -205,24 +206,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +255,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -281,7 +282,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -289,7 +290,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -299,7 +300,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -311,7 +312,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -326,10 +327,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -344,34 +345,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedString(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -387,7 +388,7 @@ public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCo } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java index 68748fd1603..2a1e790f1a2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java @@ -14,6 +14,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -80,29 +81,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Multipartformdata0BoxedString(validate(arg, configuration)); } @Override - public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -172,7 +173,7 @@ public static MultipartformdataSomeProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +185,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -196,7 +197,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,24 +208,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -256,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -283,7 +284,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -291,7 +292,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -301,7 +302,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,7 +314,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -328,10 +329,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -346,34 +347,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedVoid(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedBoolean(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedNumber(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedString(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedList(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSomePropBoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -389,7 +390,7 @@ public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, Schem } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -537,7 +538,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -545,7 +546,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -555,7 +556,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -567,29 +568,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java index 7f09ba7a1f4..9f77930f8c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakejsonformdata.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakejsonformdata.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakejsonformdata; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java index 50a121737b4..d7fbbcbadcb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakejsonformdata.get; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java index f583e035a7d..c33a942e753 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 9a70e8487d3..6ecf0882708 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +67,7 @@ public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -223,7 +224,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -233,7 +234,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -245,29 +246,29 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java index 11acaae5b01..3fab6a5ef14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakejsonpatch.patch.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakejsonpatch.patch.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakejsonpatch; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java index f9b1f076f6b..468041f351a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakejsonpatch.patch; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonpatchjsonRequestBody requestBody0 = (ApplicationjsonpatchjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java index 8b8c72ea1e2..d2adc74ceed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java index 256707d6c16..15f87d7ccda 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakejsonwithcharset; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java index 6843dc22e74..5ae2a3289b0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakejsonwithcharset.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { Applicationjsoncharsetutf8RequestBody requestBody0 = (Applicationjsoncharsetutf8RequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java index c4ad7ae4d22..2c6b3699664 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java index d1c8cfba01a..a8ca91508c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.code200response.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - Applicationjsoncharsetutf8MediaType thisMediaType = (Applicationjsoncharsetutf8MediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new Applicationjsoncharsetutf8ResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof Applicationjsoncharsetutf8MediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new Applicationjsoncharsetutf8ResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java index eec76f14d75..ffa442b65ff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakemultiplerequestbodycontenttypes; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java index 0566e226c14..bfc18b8c3f8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -49,7 +48,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java index 0eeb2290be0..a9d9f512c9a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 16a494f8b3d..7abe38bfe8a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -56,7 +57,7 @@ public String a() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for a"); + throw new InvalidTypeException("Invalid value stored for a"); } return (String) value; } @@ -141,7 +142,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -149,7 +150,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -159,7 +160,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -171,29 +172,29 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 684ede7bd69..79627668a08 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -56,7 +57,7 @@ public String b() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for b"); + throw new InvalidTypeException("Invalid value stored for b"); } return (String) value; } @@ -141,7 +142,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -149,7 +150,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -159,7 +160,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -171,29 +172,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java index 30659d828c6..9f1305f5a53 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java index c741ed63ddb..803c41e74f4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java @@ -3,13 +3,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakemultipleresponsebodies; import java.io.IOException; @@ -28,7 +25,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -53,7 +50,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java index 3325b9085a8..1a783d3ac7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.Code202Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -47,7 +45,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java index 567d4148b74..512d493671e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java index 2783f09c99f..d1636e41852 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code202response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code202Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java index d7db1ca4247..b8228e447f7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakemultiplesecurities; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -66,7 +63,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java index ed1fd5216aa..0a641952eca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java @@ -6,28 +6,24 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class FakemultiplesecuritiesGetSecurityInfo { public static class FakemultiplesecuritiesGetSecurityInfo1 implements SecurityRequirementObjectProvider { - public final FakemultiplesecuritiesGetSecurityRequirementObject0 security0; - public final FakemultiplesecuritiesGetSecurityRequirementObject1 security1; - public final FakemultiplesecuritiesGetSecurityRequirementObject2 security2; + final public EnumMap securities; public FakemultiplesecuritiesGetSecurityInfo1() { - security0 = new FakemultiplesecuritiesGetSecurityRequirementObject0(); - security1 = new FakemultiplesecuritiesGetSecurityRequirementObject1(); - security2 = new FakemultiplesecuritiesGetSecurityRequirementObject2(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakemultiplesecuritiesGetSecurityRequirementObject0()), + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new FakemultiplesecuritiesGetSecurityRequirementObject1()), + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new FakemultiplesecuritiesGetSecurityRequirementObject2()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - case SECURITY_1: - return security1; - default: - return security2; - } + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java index 94d796bdc3c..ce504a325bf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java index 14964db98f2..e7e77c03021 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java index e4f5836bd16..45ba37fafc8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeobjinquery.get.Parameters; import org.openapijsonschematools.client.paths.fakeobjinquery.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakeobjinquery; import java.io.IOException; @@ -30,7 +27,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -62,7 +59,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java index 351fd68acab..b5adb891967 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.parameter0.Schema0; @@ -129,7 +130,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +138,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Schema0.SchemaMap0)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Schema0.SchemaMap0) propertyInstance); } @@ -150,7 +151,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,29 +163,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java index 1cb6c0ca42e..e17ef11e287 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java index f94e9fadd7a..de7150e15d9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -56,7 +57,7 @@ public String keyword() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for keyword"); + throw new InvalidTypeException("Invalid value stored for keyword"); } return (String) value; } @@ -141,7 +142,7 @@ public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -149,7 +150,7 @@ public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -159,7 +160,7 @@ public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToS return new SchemaMap0(castProperties); } - public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -171,29 +172,29 @@ public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedMap(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java index 6f8f32dcdab..81a3f7cf9c1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java @@ -9,13 +9,10 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.PathParameters; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Parameters; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeparametercollisions1ababselfab; @@ -36,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -94,7 +91,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java index 0acba3877bc..aa7682206d1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter14.Schema14; @@ -66,7 +67,7 @@ public String aB() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for aB"); + throw new InvalidTypeException("Invalid value stored for aB"); } return (String) value; } @@ -76,7 +77,7 @@ public String Ab() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for Ab"); + throw new InvalidTypeException("Invalid value stored for Ab"); } return (String) value; } @@ -86,7 +87,7 @@ public String self() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for self"); + throw new InvalidTypeException("Invalid value stored for self"); } return (String) value; } @@ -227,7 +228,7 @@ public CookieParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -235,7 +236,7 @@ public CookieParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -245,7 +246,7 @@ public CookieParametersMap getNewInstance(Map arg, List pathToItem return new CookieParametersMap(castProperties); } - public CookieParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public CookieParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -257,29 +258,29 @@ public CookieParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public CookieParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public CookieParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new CookieParameters1BoxedMap(validate(arg, configuration)); } @Override - public CookieParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public CookieParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java index 904e373ed76..0e2a00abf38 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter5.Schema5; @@ -64,7 +65,7 @@ public String aB() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for aB"); + throw new InvalidTypeException("Invalid value stored for aB"); } return (String) value; } @@ -74,7 +75,7 @@ public String self() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for self"); + throw new InvalidTypeException("Invalid value stored for self"); } return (String) value; } @@ -199,7 +200,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -207,7 +208,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -217,7 +218,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -229,29 +230,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java index 8e4742efa0f..f71498c6051 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter10.Schema10; @@ -64,7 +65,7 @@ public static PathParametersMap of(Map arg, public String Ab() { @Nullable Object value = get("Ab"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for Ab"); + throw new InvalidTypeException("Invalid value stored for Ab"); } return (String) value; } @@ -72,7 +73,7 @@ public String Ab() { public String aB() { @Nullable Object value = get("aB"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for aB"); + throw new InvalidTypeException("Invalid value stored for aB"); } return (String) value; } @@ -80,7 +81,7 @@ public String aB() { public String self() { @Nullable Object value = get("self"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for self"); + throw new InvalidTypeException("Invalid value stored for self"); } return (String) value; } @@ -760,7 +761,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -768,7 +769,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -778,7 +779,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -790,29 +791,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java index 0a9975c014b..c4613b418f0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter0.Schema0; @@ -66,7 +67,7 @@ public String aB() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for aB"); + throw new InvalidTypeException("Invalid value stored for aB"); } return (String) value; } @@ -76,7 +77,7 @@ public String Ab() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for Ab"); + throw new InvalidTypeException("Invalid value stored for Ab"); } return (String) value; } @@ -86,7 +87,7 @@ public String self() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for self"); + throw new InvalidTypeException("Invalid value stored for self"); } return (String) value; } @@ -227,7 +228,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -235,7 +236,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -245,7 +246,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -257,29 +258,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java index a51c3ec8a0d..61c0cb2c691 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java index 63bb9a16183..6f9f5877987 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java index 7cda67e481f..6cb92112b23 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java index 76762c2106d..cdf5aef2647 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakepemcontenttype.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakepemcontenttype.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakepemcontenttype; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java index 1f480bb4f6c..ff68a6c95d5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakepemcontenttype.get; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationxpemfileRequestBody requestBody0 = (ApplicationxpemfileRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java index c0cddd94174..617d012d016 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java index 499c915f8f3..35ea54800af 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.code200response.content.applicationxpemfile.ApplicationxpemfileSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationxpemfileMediaType thisMediaType = (ApplicationxpemfileMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationxpemfileResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationxpemfileMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationxpemfileResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java index bc14ed14094..9b74bbfdf80 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java @@ -7,13 +7,10 @@ import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.PathParameters; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.Parameters; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakepetiduploadimagewithrequiredfile; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -36,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -84,7 +81,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java index 8dab76a488c..c06bb045cf8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java @@ -4,17 +4,22 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class FakepetiduploadimagewithrequiredfilePostSecurityInfo { public static class FakepetiduploadimagewithrequiredfilePostSecurityInfo1 implements SecurityRequirementObjectProvider { - public final FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0 security0; + final public EnumMap securities; public FakepetiduploadimagewithrequiredfilePostSecurityInfo1() { - security0 = new FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java index a568880cab5..136cee7d885 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.parameter0.Schema0; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number petId() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("petId"); } } @@ -161,7 +158,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -169,12 +166,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -182,7 +179,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -194,29 +191,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java index 0788c7362cb..3fc03d40157 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java index ae1b734dfce..10353a08dc3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 50a815585cb..ff272e85252 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -68,7 +69,7 @@ public static MultipartformdataSchemaMap of(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -200,7 +201,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -210,7 +211,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -222,29 +223,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java index e12ad3e1ff1..df5ef4ffa28 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java index 1d2525666c8..265b436de28 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.QueryParameters; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.Parameters; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakequeryparamwithjsoncontenttype; import java.io.IOException; @@ -30,7 +27,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +56,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java index 12618cb5ee0..8cd9c1628ed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson.Schema0; @@ -54,11 +55,7 @@ public static QueryParametersMap of(Map arg, } public @Nullable Object someParam() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("someParam"); } } @@ -191,7 +188,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -199,12 +196,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } 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"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable Object) propertyInstance); } @@ -212,7 +209,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -224,29 +221,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java index 67fcc96df1a..dc6b9ebe721 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java index ac6cbea3c13..0195dc24e67 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java @@ -6,6 +6,7 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson.Schema0; import java.util.AbstractMap; +import java.util.Map; public class Parameter0 { @@ -28,7 +29,9 @@ public Parameter01() { null, null, false, - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java index 1c25969ab61..44a7d6d9a17 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java index 79bfed8fe0c..63643897a3f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java @@ -3,13 +3,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeredirection.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakeredirection; import java.io.IOException; @@ -28,7 +25,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -53,7 +50,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java index addd1e3384e..1678ade8102 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.fakeredirection.get.responses.Code303Response; import org.openapijsonschematools.client.paths.fakeredirection.get.responses.Code3XXResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -52,7 +50,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java index 80bbe5222cf..fe6da3290d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code303Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java index fc5125abeca..0bceda71429 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code3XXResponse1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java index d640b1e04c5..34eafefc4d0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefobjinquery.get.Parameters; import org.openapijsonschematools.client.paths.fakerefobjinquery.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakerefobjinquery; import java.io.IOException; @@ -30,7 +27,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -62,7 +59,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java index 5f291a86045..b8e5f47e5e7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.components.schemas.Foo; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -129,7 +130,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +138,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Foo.FooMap)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Foo.FooMap) propertyInstance); } @@ -150,7 +151,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,29 +163,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java index fa40e5c878e..1a8dca8dcdd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java index 3b1dad9974c..5d30e214a16 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsarraymodel; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java index cd7db4c428b..331c85336ed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakerefsarraymodel.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java index dbe304b8a0f..da739f84545 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java index c6902020026..d2fa881818b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java index 13d1ccbab8f..a9b53d07eb6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsarrayofenums; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java index b9c573e092d..614bd30d021 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakerefsarrayofenums.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java index 4e054707d20..3c02dbbae03 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java index 9ee1287a9d1..9b5ea0b64fb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java index 95db0847da6..0176df73b8d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakerefsboolean.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsboolean.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsboolean; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java index 7d6c5aea5e6..892772867fc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakerefsboolean.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java index 755d4d97568..ef2da8a829a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java index 2f85215f463..390ac805456 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java index 97d3e46b39c..a5b8064bca9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefscomposedoneofnumberwithvalidations; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java index 9c7d24a6e84..705f750a6d0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java index bdc96d2297e..bffd6a98a2a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java index aa7d008cb6e..2261c15e675 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java index 02719172619..59028a026b9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakerefsenum.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsenum.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsenum; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java index 4166ca11c2b..f149f2bc22f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakerefsenum.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java index 9668bb4535f..c2b067d4643 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java index 23ed2009366..8e6a2da362b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java index 278c82a493c..7b153f79789 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsmammal.post.RequestBody; import org.openapijsonschematools.client.paths.fakerefsmammal.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsmammal; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -62,7 +59,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java index 7fba66cb6d8..c5b28579c34 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakerefsmammal.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java index 47df1517739..de909f096bc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java index 6565afc0de3..2d9310a09b8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java index 1eaba218885..aa78925f60b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakerefsnumber.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsnumber.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsnumber; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java index 8494dd01aaa..dd306ec59bd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakerefsnumber.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java index 64721d3dfb9..622310c701c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java index 9e8e93aca7f..bb1a8ebb079 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java index a8a554dc678..5d619094fd5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsobjectmodelwithrefprops; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java index 36aacc1eb10..c00f02f2221 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java index cf4c1d15769..838601e6f24 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java index a2b03d8a56d..83e7c808d89 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java index c2b331a1125..764b6e55111 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakerefsstring.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsstring.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsstring; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java index 8cbfffaff80..ba47936d312 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakerefsstring.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java index c2d043e5a24..331a3bc8816 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java index 78842227518..7642e09bbab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java index 58e670e37cc..87003260f1b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java @@ -3,13 +3,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakeresponsewithoutschema; import java.io.IOException; @@ -28,7 +25,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -53,7 +50,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java index 829ad9e8208..0c0edb117cd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java index 01622b70b62..d9cc9ea080e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.AbstractMap; @@ -26,7 +24,7 @@ public Code200Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java index 98a0fd0f5e2..c93f7b5e452 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.faketestqueryparamters.put.QueryParameters; import org.openapijsonschematools.client.paths.faketestqueryparamters.put.Parameters; import org.openapijsonschematools.client.paths.faketestqueryparamters.put.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Faketestqueryparamters; import java.io.IOException; @@ -30,7 +27,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +56,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java index c4573b4f79d..8c8a5f005bf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.components.schemas.StringWithValidation; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter0.Schema0; @@ -66,7 +67,7 @@ public static QueryParametersMap of(Map arg, public Schema4.SchemaList4 context() { @Nullable Object value = get("context"); if (!(value instanceof Schema4.SchemaList4)) { - throw new RuntimeException("Invalid value stored for context"); + throw new InvalidTypeException("Invalid value stored for context"); } return (Schema4.SchemaList4) value; } @@ -74,7 +75,7 @@ public Schema4.SchemaList4 context() { public Schema2.SchemaList2 http() { @Nullable Object value = get("http"); if (!(value instanceof Schema2.SchemaList2)) { - throw new RuntimeException("Invalid value stored for http"); + throw new InvalidTypeException("Invalid value stored for http"); } return (Schema2.SchemaList2) value; } @@ -82,7 +83,7 @@ public Schema2.SchemaList2 http() { public Schema1.SchemaList1 ioutil() { @Nullable Object value = get("ioutil"); if (!(value instanceof Schema1.SchemaList1)) { - throw new RuntimeException("Invalid value stored for ioutil"); + throw new InvalidTypeException("Invalid value stored for ioutil"); } return (Schema1.SchemaList1) value; } @@ -90,7 +91,7 @@ public Schema1.SchemaList1 ioutil() { public Schema0.SchemaList0 pipe() { @Nullable Object value = get("pipe"); if (!(value instanceof Schema0.SchemaList0)) { - throw new RuntimeException("Invalid value stored for pipe"); + throw new InvalidTypeException("Invalid value stored for pipe"); } return (Schema0.SchemaList0) value; } @@ -98,7 +99,7 @@ public Schema0.SchemaList0 pipe() { public String refParam() { @Nullable Object value = get("refParam"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for refParam"); + throw new InvalidTypeException("Invalid value stored for refParam"); } return (String) value; } @@ -106,7 +107,7 @@ public String refParam() { public Schema3.SchemaList3 url() { @Nullable Object value = get("url"); if (!(value instanceof Schema3.SchemaList3)) { - throw new RuntimeException("Invalid value stored for url"); + throw new InvalidTypeException("Invalid value stored for url"); } return (Schema3.SchemaList3) value; } @@ -1456,7 +1457,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1464,7 +1465,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1474,7 +1475,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1486,29 +1487,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java index e24c9f4f38b..68868dd0442 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java index 6a6b47f4a85..0c364247e83 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -104,12 +105,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -129,29 +130,29 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java index c386c6cd560..53e9e106e7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -104,12 +105,12 @@ public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -129,29 +130,29 @@ public SchemaList1 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema11BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema11BoxedList(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java index b9a650f1e17..8b001cea7dc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -104,12 +105,12 @@ public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -129,29 +130,29 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema21BoxedList(validate(arg, configuration)); } @Override - public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java index 2e44f938af9..6f94b32c521 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -104,12 +105,12 @@ public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -129,29 +130,29 @@ public SchemaList3 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema31BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema31BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema31BoxedList(validate(arg, configuration)); } @Override - public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java index 5dcc583172d..92352108c2d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -104,12 +105,12 @@ public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -129,29 +130,29 @@ public SchemaList4 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema41BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema41BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema41BoxedList(validate(arg, configuration)); } @Override - public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java index 0cfde8026ef..2af6f43a3cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.RequestBody; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeuploaddownloadfile; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -62,7 +59,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java index 480f5c0801a..0dbaf136d1e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationoctetstreamRequestBody requestBody0 = (ApplicationoctetstreamRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java index 2a8598335a0..f7be0054859 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java index f9b8bd33e16..ed9e9a5ddd3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.code200response.content.applicationoctetstream.ApplicationoctetstreamSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationoctetstreamMediaType thisMediaType = (ApplicationoctetstreamMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationoctetstreamResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationoctetstreamMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationoctetstreamResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java index 87f187dd7e6..15587ef4551 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakeuploadfile.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeuploadfile.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeuploadfile; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java index c9165873f80..972187e5cca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakeuploadfile.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java index d57c98d7c24..033ad2c8f72 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index bc7210852e6..36009ea124b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -68,7 +69,7 @@ public static MultipartformdataSchemaMap of(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -200,7 +201,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -210,7 +211,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -222,29 +223,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java index 5ef05875230..28e807c4652 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java index 7be8841da1e..d5ebe401be7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.paths.fakeuploadfiles.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeuploadfiles.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeuploadfiles; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -66,7 +63,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java index 418dbfd9b9a..221c62968d4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.fakeuploadfiles.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java index 2507eff62d3..1fa96a8e7e1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index ceefe884ce3..08b9aaee4b3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -113,12 +114,12 @@ public MultipartformdataFilesList getNewInstance(List arg, List pathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -138,29 +139,29 @@ public MultipartformdataFilesList validate(List arg, SchemaConfiguration conf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataFilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataFilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataFilesBoxedList(validate(arg, configuration)); } @Override - public MultipartformdataFilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataFilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -181,7 +182,7 @@ public MultipartformdataFilesList files() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MultipartformdataFilesList)) { - throw new RuntimeException("Invalid value stored for files"); + throw new InvalidTypeException("Invalid value stored for files"); } return (MultipartformdataFilesList) value; } @@ -266,7 +267,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -274,7 +275,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -284,7 +285,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -296,29 +297,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java index 8491068775e..3a6ae53b8c7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java index fe290c34307..05d40d58ab6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java @@ -3,13 +3,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakewildcardresponses; import java.io.IOException; @@ -28,7 +25,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -53,7 +50,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java index 70451e1cb4c..2070a4ae1db 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java @@ -7,8 +7,6 @@ import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code4XXResponse; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code5XXResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -82,7 +80,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java index 4bb1a115b72..5ff45188ea1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code1xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code1XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java index 8138d8bc1a7..d3071a30f8b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java index 3d9e6eb5638..f228579433a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code2xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code2XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java index 5a177c3e8ae..ed9d6a23972 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code3xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code3XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java index 944465a02ea..eb7716a00f8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code4xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code4XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java index 46d31fd8f01..9f7c642f907 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code5xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public Code5XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java index ca58d9e23fe..bcb2ea6f22e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java @@ -3,13 +3,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; import org.openapijsonschematools.client.paths.foo.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Foo; import java.io.IOException; @@ -28,7 +25,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -53,7 +50,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java index 2a4ba33c38a..45d598bb653 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java @@ -1,39 +1,72 @@ package org.openapijsonschematools.client.paths.foo.get; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer0; import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer1; import org.openapijsonschematools.client.servers.Server; import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; +import java.util.AbstractMap; +import java.util.Map; import java.util.Objects; +import java.util.EnumMap; -public class FooGetServerInfo { - public static class FooGetServerInfo1 implements ServerProvider { - public final FooGetServer0 server0; - public final FooGetServer1 server1; +public class FooGetServerInfo implements ServerProvider { + final private Servers servers; + final private ServerIndex serverIndex; - public FooGetServerInfo1() { - server0 = new FooGetServer0(); - server1 = new FooGetServer1(); + public FooGetServerInfo() { + this.servers = new Servers(); + this.serverIndex = ServerIndex.SERVER_0; + } + + public FooGetServerInfo(Servers servers, ServerIndex serverIndex) { + this.servers = servers; + this.serverIndex = serverIndex; + } + + public static class Servers { + private final EnumMap servers; + + public Servers() { + servers = new EnumMap<>( + Map.ofEntries( + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_0, + new FooGetServer0() + ), + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_1, + new FooGetServer1() + ) + ) + ); } - public FooGetServerInfo1( + public Servers( @Nullable FooGetServer0 server0, @Nullable FooGetServer1 server1 ) { - this.server0 = Objects.requireNonNullElseGet(server0, FooGetServer0::new); - this.server1 = Objects.requireNonNullElseGet(server1, FooGetServer1::new); + servers = new EnumMap<>( + Map.ofEntries( + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_0, + Objects.requireNonNullElseGet(server0, FooGetServer0::new) + ), + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_1, + Objects.requireNonNullElseGet(server1, FooGetServer1::new) + ) + ) + ); } - @Override - public Server getServer(ServerIndex serverIndex) { - switch (serverIndex) { - case SERVER_0: - return server0; - default: - return server1; + public Server get(ServerIndex serverIndex) { + if (servers.containsKey(serverIndex)) { + return get(serverIndex); } + throw new UnsetPropertyException(serverIndex+" is unset"); } } @@ -41,4 +74,11 @@ public enum ServerIndex { SERVER_0, SERVER_1 } + + public Server getServer(@Nullable ServerIndex serverIndex) { + if (serverIndex == null) { + return servers.get(this.serverIndex); + } + return servers.get(serverIndex); + } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java index 63a2d1d6c22..21bffb7e427 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.foo.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -29,7 +27,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java index 28ef2eae71c..91752fd80e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.foo.get.responses.codedefaultresponse.content.applicationjson.ApplicationjsonSchema; @@ -39,10 +37,16 @@ public CodedefaultResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } + if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); + } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java index 860a1e86279..8e89dece1b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java @@ -12,6 +12,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -120,7 +121,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -128,7 +129,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -138,7 +139,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -150,29 +151,29 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java index 336ea6edf71..4c00686226e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.servers.ServerWithVariables; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.paths.foo.get.servers.server1.Variables; @@ -10,23 +9,16 @@ import java.util.AbstractMap; public class FooGetServer1 extends ServerWithVariables { - private static Variables.VariablesMap getVariables() { - try { - return Variables.Variables1.getInstance().validate( - MapUtils.makeMap( - new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) - ), - new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ); - } catch (ValidationException e) { - throw new RuntimeException(e); - } - } public FooGetServer1() { super( "https://petstore.swagger.io/{version}", - getVariables() + Variables.Variables1.getInstance().validate( + MapUtils.makeMap( + new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) + ), + new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) + ) ); } public FooGetServer1(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java index 8cc25687164..58d5f36188c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -111,35 +112,35 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new VersionBoxedString(validate(arg, configuration)); } @Override - public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -156,11 +157,7 @@ public static VariablesMap of(Map arg, SchemaConfiguration confi } public String version() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("version"); } } @@ -251,7 +248,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -259,12 +256,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -272,7 +269,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -284,29 +281,29 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java index 8ac322b163d..4f3edb0706a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; import org.openapijsonschematools.client.paths.pet.post.RequestBody; import org.openapijsonschematools.client.paths.pet.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Pet; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -34,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -75,7 +72,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java index e75a9b792d3..60f2021f717 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.pet.put.PetPutSecurityInfo; import org.openapijsonschematools.client.paths.pet.put.RequestBody; import org.openapijsonschematools.client.paths.pet.put.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Pet; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -34,7 +31,7 @@ public static Void put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -75,7 +72,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Void put(PutRequest request) throws IOException, InterruptedException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java index 91df6b3f3e8..33c0fb012db 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java @@ -6,28 +6,24 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class PetPostSecurityInfo { public static class PetPostSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetPostSecurityRequirementObject0 security0; - public final PetPostSecurityRequirementObject1 security1; - public final PetPostSecurityRequirementObject2 security2; + final public EnumMap securities; public PetPostSecurityInfo1() { - security0 = new PetPostSecurityRequirementObject0(); - security1 = new PetPostSecurityRequirementObject1(); - security2 = new PetPostSecurityRequirementObject2(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetPostSecurityRequirementObject0()), + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetPostSecurityRequirementObject1()), + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new PetPostSecurityRequirementObject2()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - case SECURITY_1: - return security1; - default: - return security2; - } + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java index 1e44c96d53e..db2e91906cc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.pet.post.responses.Code200Response; import org.openapijsonschematools.client.paths.pet.post.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -40,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java index 207a4ef554f..539923899ea 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code405Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java index 35d27e66846..a8276f457ba 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java @@ -5,24 +5,23 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class PetPutSecurityInfo { public static class PetPutSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetPutSecurityRequirementObject0 security0; - public final PetPutSecurityRequirementObject1 security1; + final public EnumMap securities; public PetPutSecurityInfo1() { - security0 = new PetPutSecurityRequirementObject0(); - security1 = new PetPutSecurityRequirementObject1(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetPutSecurityRequirementObject0()), + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetPutSecurityRequirementObject1()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - default: - return security1; - } + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java index c5ef091d53a..73c9bfd8cd1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.paths.pet.put.responses.Code404Response; import org.openapijsonschematools.client.paths.pet.put.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -35,7 +33,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java index 27021cdf728..e94b1366c9a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java index b74b875389c..15458d50d4f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java index 350e155a9c0..e3ba5312b16 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code405Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java index aa30e9bf00f..50f9742a8b3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java @@ -6,13 +6,10 @@ import org.openapijsonschematools.client.paths.petfindbystatus.get.QueryParameters; import org.openapijsonschematools.client.paths.petfindbystatus.get.Parameters; import org.openapijsonschematools.client.paths.petfindbystatus.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petfindbystatus; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -33,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -72,7 +69,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java index 03839fc4b75..6e499330caf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java @@ -1,39 +1,72 @@ package org.openapijsonschematools.client.paths.petfindbystatus; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer0; import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer1; import org.openapijsonschematools.client.servers.Server; import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; +import java.util.AbstractMap; +import java.util.Map; import java.util.Objects; +import java.util.EnumMap; -public class PetfindbystatusServerInfo { - public static class PetfindbystatusServerInfo1 implements ServerProvider { - public final PetfindbystatusServer0 server0; - public final PetfindbystatusServer1 server1; +public class PetfindbystatusServerInfo implements ServerProvider { + final private Servers servers; + final private ServerIndex serverIndex; - public PetfindbystatusServerInfo1() { - server0 = new PetfindbystatusServer0(); - server1 = new PetfindbystatusServer1(); + public PetfindbystatusServerInfo() { + this.servers = new Servers(); + this.serverIndex = ServerIndex.SERVER_0; + } + + public PetfindbystatusServerInfo(Servers servers, ServerIndex serverIndex) { + this.servers = servers; + this.serverIndex = serverIndex; + } + + public static class Servers { + private final EnumMap servers; + + public Servers() { + servers = new EnumMap<>( + Map.ofEntries( + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_0, + new PetfindbystatusServer0() + ), + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_1, + new PetfindbystatusServer1() + ) + ) + ); } - public PetfindbystatusServerInfo1( + public Servers( @Nullable PetfindbystatusServer0 server0, @Nullable PetfindbystatusServer1 server1 ) { - this.server0 = Objects.requireNonNullElseGet(server0, PetfindbystatusServer0::new); - this.server1 = Objects.requireNonNullElseGet(server1, PetfindbystatusServer1::new); + servers = new EnumMap<>( + Map.ofEntries( + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_0, + Objects.requireNonNullElseGet(server0, PetfindbystatusServer0::new) + ), + new AbstractMap.SimpleEntry<>( + ServerIndex.SERVER_1, + Objects.requireNonNullElseGet(server1, PetfindbystatusServer1::new) + ) + ) + ); } - @Override - public Server getServer(ServerIndex serverIndex) { - switch (serverIndex) { - case SERVER_0: - return server0; - default: - return server1; + public Server get(ServerIndex serverIndex) { + if (servers.containsKey(serverIndex)) { + return get(serverIndex); } + throw new UnsetPropertyException(serverIndex+" is unset"); } } @@ -41,4 +74,11 @@ public enum ServerIndex { SERVER_0, SERVER_1 } + + public Server getServer(@Nullable ServerIndex serverIndex) { + if (serverIndex == null) { + return servers.get(this.serverIndex); + } + return servers.get(serverIndex); + } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java index 7e2dd18d844..feb7a695ede 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java @@ -6,28 +6,24 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class PetfindbystatusGetSecurityInfo { public static class PetfindbystatusGetSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetfindbystatusGetSecurityRequirementObject0 security0; - public final PetfindbystatusGetSecurityRequirementObject1 security1; - public final PetfindbystatusGetSecurityRequirementObject2 security2; + final public EnumMap securities; public PetfindbystatusGetSecurityInfo1() { - security0 = new PetfindbystatusGetSecurityRequirementObject0(); - security1 = new PetfindbystatusGetSecurityRequirementObject1(); - security2 = new PetfindbystatusGetSecurityRequirementObject2(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetfindbystatusGetSecurityRequirementObject0()), + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetfindbystatusGetSecurityRequirementObject1()), + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new PetfindbystatusGetSecurityRequirementObject2()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - case SECURITY_1: - return security1; - default: - return security2; - } + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java index 90468bd21f2..7ce798858e4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.parameter0.Schema0; @@ -55,11 +56,7 @@ public static QueryParametersMap of(Map> arg, SchemaConfigu } public Schema0.SchemaList0 status() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("status"); } } @@ -144,7 +141,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -152,12 +149,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Schema0.SchemaList0)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Schema0.SchemaList0) propertyInstance); } @@ -165,7 +162,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,29 +174,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java index 4e008e2a33b..bb6a09ea78c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.Code200Response; import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -40,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java index d45479cd0dd..5594071aee6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -94,35 +95,35 @@ public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Items0BoxedString(validate(arg, configuration)); } @Override - public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -202,12 +203,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -227,29 +228,29 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java index 3ea6e1da098..43e52729869 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java index e36810b4c40..365a0597ded 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.servers.ServerWithVariables; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.paths.petfindbystatus.servers.server1.Variables; @@ -10,23 +9,16 @@ import java.util.AbstractMap; public class PetfindbystatusServer1 extends ServerWithVariables { - private static Variables.VariablesMap getVariables() { - try { - return Variables.Variables1.getInstance().validate( - MapUtils.makeMap( - new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) - ), - new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ); - } catch (ValidationException e) { - throw new RuntimeException(e); - } - } public PetfindbystatusServer1() { super( "https://petstore.swagger.io/{version}", - getVariables() + Variables.Variables1.getInstance().validate( + MapUtils.makeMap( + new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) + ), + new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) + ) ); } public PetfindbystatusServer1(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java index 402b2e4be8b..e622b7ac02a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -111,35 +112,35 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new VersionBoxedString(validate(arg, configuration)); } @Override - public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -156,11 +157,7 @@ public static VariablesMap of(Map arg, SchemaConfiguration confi } public String version() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("version"); } } @@ -251,7 +248,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -259,12 +256,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -272,7 +269,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -284,29 +281,29 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java index f29d6b59081..0ce665bc5e0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java @@ -6,13 +6,10 @@ import org.openapijsonschematools.client.paths.petfindbytags.get.QueryParameters; import org.openapijsonschematools.client.paths.petfindbytags.get.Parameters; import org.openapijsonschematools.client.paths.petfindbytags.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petfindbytags; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -33,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -72,7 +69,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java index 4c4856f98eb..7005499fb3e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java @@ -5,24 +5,23 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class PetfindbytagsGetSecurityInfo { public static class PetfindbytagsGetSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetfindbytagsGetSecurityRequirementObject0 security0; - public final PetfindbytagsGetSecurityRequirementObject1 security1; + final public EnumMap securities; public PetfindbytagsGetSecurityInfo1() { - security0 = new PetfindbytagsGetSecurityRequirementObject0(); - security1 = new PetfindbytagsGetSecurityRequirementObject1(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetfindbytagsGetSecurityRequirementObject0()), + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetfindbytagsGetSecurityRequirementObject1()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - default: - return security1; - } + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java index 11bb6b1896d..c4ef93d3f01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petfindbytags.get.parameters.parameter0.Schema0; @@ -55,11 +56,7 @@ public static QueryParametersMap of(Map> arg, SchemaConfigu } public Schema0.SchemaList0 tags() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("tags"); } } @@ -144,7 +141,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -152,12 +149,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Schema0.SchemaList0)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Schema0.SchemaList0) propertyInstance); } @@ -165,7 +162,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,29 +174,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java index b29be24d716..82003a8b683 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.petfindbytags.get.responses.Code200Response; import org.openapijsonschematools.client.paths.petfindbytags.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -40,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java index 420ca7fe8b4..1660a363a63 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java @@ -9,6 +9,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -104,12 +105,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -129,29 +130,29 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java index b674ee9ab33..7d7ae379884 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java index 4504536c416..4d3f69226eb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java @@ -7,13 +7,10 @@ import org.openapijsonschematools.client.paths.petpetid.delete.PathParameters; import org.openapijsonschematools.client.paths.petpetid.delete.Parameters; import org.openapijsonschematools.client.paths.petpetid.delete.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petpetid; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -34,7 +31,7 @@ public static Void delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -78,7 +75,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Void delete(DeleteRequest request) throws IOException, InterruptedException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java index d61d683a408..f3dc2ac9e94 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java @@ -6,13 +6,10 @@ import org.openapijsonschematools.client.paths.petpetid.get.PathParameters; import org.openapijsonschematools.client.paths.petpetid.get.Parameters; import org.openapijsonschematools.client.paths.petpetid.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petpetid; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -33,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -71,7 +68,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java index b9ad09b7104..0d1433ab2ae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java @@ -7,13 +7,10 @@ import org.openapijsonschematools.client.paths.petpetid.post.PathParameters; import org.openapijsonschematools.client.paths.petpetid.post.Parameters; import org.openapijsonschematools.client.paths.petpetid.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Petpetid; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -36,7 +33,7 @@ public static Void post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -84,7 +81,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Void post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java index 044c81974e6..e35183de207 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter0.Schema0; @@ -129,7 +130,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +138,12 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -150,7 +151,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,29 +163,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java index ed599dfe636..59fe1814cc8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter1.Schema1; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number petId() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("petId"); } } @@ -161,7 +158,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -169,12 +166,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -182,7 +179,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -194,29 +191,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java index 941f3f23abf..c71ee0107bc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java @@ -5,24 +5,23 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class PetpetidDeleteSecurityInfo { public static class PetpetidDeleteSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetpetidDeleteSecurityRequirementObject0 security0; - public final PetpetidDeleteSecurityRequirementObject1 security1; + final public EnumMap securities; public PetpetidDeleteSecurityInfo1() { - security0 = new PetpetidDeleteSecurityRequirementObject0(); - security1 = new PetpetidDeleteSecurityRequirementObject1(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetidDeleteSecurityRequirementObject0()), + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetpetidDeleteSecurityRequirementObject1()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - default: - return security1; - } + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java index 6c5d7573a1a..5211c9c2cd3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.petpetid.delete.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +25,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java index 48b687555cd..1fdfd986a90 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java index 65b7c41a406..d6dc72541d6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.get.parameters.parameter0.Schema0; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number petId() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("petId"); } } @@ -161,7 +158,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -169,12 +166,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -182,7 +179,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -194,29 +191,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java index 4d21d88f82e..ea5c2dfa9c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java @@ -4,17 +4,22 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class PetpetidGetSecurityInfo { public static class PetpetidGetSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetpetidGetSecurityRequirementObject0 security0; + final public EnumMap securities; public PetpetidGetSecurityInfo1() { - security0 = new PetpetidGetSecurityRequirementObject0(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetidGetSecurityRequirementObject0()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java index b0be031e585..9717fcb81d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.paths.petpetid.get.responses.Code400Response; import org.openapijsonschematools.client.paths.petpetid.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -44,7 +42,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java index 2e28a301c5d..ebd39fc2a6e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -52,15 +50,19 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java index 5bbc55f84a2..7a6c696b19d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java index 0aa19c5d169..58e9da0d7dc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java index a4306745deb..8b31aa07e75 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.post.parameters.parameter0.Schema0; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number petId() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("petId"); } } @@ -161,7 +158,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -169,12 +166,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -182,7 +179,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -194,29 +191,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java index 3763c38088a..192ccc51c6c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java @@ -5,24 +5,23 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class PetpetidPostSecurityInfo { public static class PetpetidPostSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetpetidPostSecurityRequirementObject0 security0; - public final PetpetidPostSecurityRequirementObject1 security1; + final public EnumMap securities; public PetpetidPostSecurityInfo1() { - security0 = new PetpetidPostSecurityRequirementObject0(); - security1 = new PetpetidPostSecurityRequirementObject1(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetidPostSecurityRequirementObject0()), + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetpetidPostSecurityRequirementObject1()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - switch (securityIndex) { - case SECURITY_0: - return security0; - default: - return security1; - } + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java index 00ba6ed79f2..bcfe59527bb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.petpetid.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java index 0f129ddcc1d..b0e7a2d9012 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.petpetid.post.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +25,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 0b10b8675bd..0d9bbc0816a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -68,7 +69,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for name"); + throw new InvalidTypeException("Invalid value stored for name"); } return (String) value; } @@ -78,7 +79,7 @@ public String status() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for status"); + throw new InvalidTypeException("Invalid value stored for status"); } return (String) value; } @@ -179,7 +180,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -187,7 +188,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -197,7 +198,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -209,29 +210,29 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java index 4dfaf36ff01..62d6a28f1be 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code405Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java index 372c6fffde0..f628d4069c0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java @@ -7,13 +7,10 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PathParameters; import org.openapijsonschematools.client.paths.petpetiduploadimage.post.Parameters; import org.openapijsonschematools.client.paths.petpetiduploadimage.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Petpetiduploadimage; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -36,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -84,7 +81,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java index 9418fd079ae..8621fb63da8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.parameter0.Schema0; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number petId() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("petId"); } } @@ -161,7 +158,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -169,12 +166,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -182,7 +179,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -194,29 +191,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java index 0418c7b90c0..1ec53a24fb0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java @@ -4,17 +4,22 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class PetpetiduploadimagePostSecurityInfo { public static class PetpetiduploadimagePostSecurityInfo1 implements SecurityRequirementObjectProvider { - public final PetpetiduploadimagePostSecurityRequirementObject0 security0; + final public EnumMap securities; public PetpetiduploadimagePostSecurityInfo1() { - security0 = new PetpetiduploadimagePostSecurityRequirementObject0(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetiduploadimagePostSecurityRequirementObject0()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java index 81fe04dc837..8fd7c0f6302 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.petpetiduploadimage.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java index ed5b656f912..2510fe73af5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.Code200Response; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -37,7 +35,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index e6b3f39636f..f809a516e10 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -69,7 +70,7 @@ public String additionalMetadata() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for additionalMetadata"); + throw new InvalidTypeException("Invalid value stored for additionalMetadata"); } return (String) value; } @@ -79,7 +80,7 @@ public String file() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for file"); + throw new InvalidTypeException("Invalid value stored for file"); } return (String) value; } @@ -180,7 +181,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -188,7 +189,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -198,7 +199,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -210,29 +211,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java index 111e91bdcf4..6670ce4e8dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java @@ -3,13 +3,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.solidus.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Solidus; import java.io.IOException; @@ -28,7 +25,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -53,7 +50,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java index 2c1b302e62b..8f8f1f3fc78 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.solidus.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -36,7 +34,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java index 49e7b1d5ab7..d6aefad8f01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; import org.openapijsonschematools.client.paths.storeinventory.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Storeinventory; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -66,7 +63,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java index 1390a3b9d94..ce5360d0cdb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.storeinventory.get.responses.Code200Response; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -37,7 +35,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java index 5c661cfd67c..c263a4e51f8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java @@ -4,17 +4,22 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; +import java.util.AbstractMap; +import java.util.Map; +import java.util.EnumMap; + public class StoreinventoryGetSecurityInfo { public static class StoreinventoryGetSecurityInfo1 implements SecurityRequirementObjectProvider { - public final StoreinventoryGetSecurityRequirementObject0 security0; + final public EnumMap securities; public StoreinventoryGetSecurityInfo1() { - security0 = new StoreinventoryGetSecurityRequirementObject0(); + this.securities = new EnumMap<>(Map.ofEntries( + new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new StoreinventoryGetSecurityRequirementObject0()) + )); } - @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return security0; + return securities.get(securityIndex); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java index ba0d5c15793..b357d8afaf0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.storeorder.post.RequestBody; import org.openapijsonschematools.client.paths.storeorder.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Storeorder; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -62,7 +59,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java index 917836e859f..fa09117b1c6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.storeorder.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java index c62c12edaf2..22f2bd6a7f1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.storeorder.post.responses.Code200Response; import org.openapijsonschematools.client.paths.storeorder.post.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -40,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java index fc535ab3955..955c9af34c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -52,15 +50,19 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java index 3d9ae44d402..bf641ab9529 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java index 12139abd4b9..d3afe2ab708 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.storeorderorderid.delete.PathParameters; import org.openapijsonschematools.client.paths.storeorderorderid.delete.Parameters; import org.openapijsonschematools.client.paths.storeorderorderid.delete.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Storeorderorderid; import java.io.IOException; @@ -30,7 +27,7 @@ public static Void delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -58,7 +55,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Void delete(DeleteRequest request) throws IOException, InterruptedException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java index e585a91d120..67fd560dc7c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.storeorderorderid.get.PathParameters; import org.openapijsonschematools.client.paths.storeorderorderid.get.Parameters; import org.openapijsonschematools.client.paths.storeorderorderid.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Storeorderorderid; import java.io.IOException; @@ -30,7 +27,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -58,7 +55,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java index d1a63779d53..52aaca5fe26 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.parameter0.Schema0; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String order_id() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("order_id"); } } @@ -143,7 +140,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -151,12 +148,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -164,7 +161,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -176,29 +173,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java index 5e9f34d93b7..f811aab1d28 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code400Response; import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -31,7 +29,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java index 7ad936566fc..a0291a06814 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java index 565b71b9a4f..99efb7324e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java index 106faf07142..d52c74e5c24 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.parameter0.Schema0; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number order_id() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("order_id"); } } @@ -161,7 +158,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -169,12 +166,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -182,7 +179,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -194,29 +191,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java index 5c23d3cc14c..9aa9e0eb735 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code400Response; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -44,7 +42,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java index 9d05f93bfb2..44fca5e5ac4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java @@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -83,29 +84,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Schema01BoxedNumber(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java index e0cea6e6191..44e93fc81e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -52,15 +50,19 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java index c3304e02b39..00aa94771da 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java index 5de14a5ccd1..eb7b27cea75 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java index 51f43cc60ac..596a04b8a31 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.user.post.RequestBody; import org.openapijsonschematools.client.paths.user.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.User; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -62,7 +59,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java index 52a467ba8dd..9db899fe59e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.user.post; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java index c1cc62b43da..cd6bedeaa49 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.user.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -29,7 +27,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java index 20148c56e39..e3555812d7d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java index a2d805d6d78..b227be4320d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.usercreatewitharray.post.RequestBody; import org.openapijsonschematools.client.paths.usercreatewitharray.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Usercreatewitharray; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -62,7 +59,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java index 79c988e4f1b..90079ade7ee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -29,7 +27,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java index bd617d9262d..1de3940666e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java index f8f78fabe13..664e4d200f5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java @@ -4,13 +4,10 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.usercreatewithlist.post.RequestBody; import org.openapijsonschematools.client.paths.usercreatewithlist.post.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Usercreatewithlist; @@ -31,7 +28,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -62,7 +59,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java index 8c24f5ea31e..4d37cf3af39 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -29,7 +27,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java index a8989114b04..71c7481101d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java index c2660417c71..97207e125a0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.userlogin.get.QueryParameters; import org.openapijsonschematools.client.paths.userlogin.get.Parameters; import org.openapijsonschematools.client.paths.userlogin.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userlogin; import java.io.IOException; @@ -30,7 +27,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +56,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java index 01dd3860ee8..8c5b619443c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter0.Schema0; @@ -58,7 +59,7 @@ public static QueryParametersMap of(Map arg, public String password() { @Nullable Object value = get("password"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for password"); + throw new InvalidTypeException("Invalid value stored for password"); } return (String) value; } @@ -66,7 +67,7 @@ public String password() { public String username() { @Nullable Object value = get("username"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for username"); + throw new InvalidTypeException("Invalid value stored for username"); } return (String) value; } @@ -196,7 +197,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -204,7 +205,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -214,7 +215,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -226,29 +227,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java index 0df32af2421..f31d4fdabf4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.Code200ResponseHeadersSchema; import org.openapijsonschematools.client.paths.userlogin.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -41,7 +39,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java index 399cc9fd94f..fc6f3fd1454 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -54,19 +52,23 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override - protected Code200ResponseHeadersSchema.Code200ResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected Code200ResponseHeadersSchema.Code200ResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java index a30d61bec1a..ff44cd75c14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java index 4b54d1e388b..5d9afd9e8f9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java @@ -13,6 +13,7 @@ import org.openapijsonschematools.client.components.schemas.StringWithValidation; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xexpiresafter.XExpiresAfterSchema; @@ -65,7 +66,7 @@ public static Code200ResponseHeadersSchemaMap of(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -338,7 +339,7 @@ public Code200ResponseHeadersSchemaMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -348,7 +349,7 @@ public Code200ResponseHeadersSchemaMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException { + public Code200ResponseHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -360,29 +361,29 @@ public Code200ResponseHeadersSchemaMap validate(Map arg, SchemaConfigurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Code200ResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Code200ResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Code200ResponseHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public Code200ResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Code200ResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java index f7e9a714406..0bc9ca1d34c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java @@ -5,6 +5,7 @@ import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xratelimit.content.applicationjson.XRateLimitSchema; import java.util.AbstractMap; +import java.util.Map; public class XRateLimit { @@ -24,7 +25,9 @@ public XRateLimit1() { true, null, false, - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) + ) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java index efc687945ab..d11d947f0b9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java @@ -3,13 +3,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.userlogout.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userlogout; import java.io.IOException; @@ -28,7 +25,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -53,7 +50,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java index 0093801140c..9bf34248b51 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java @@ -2,8 +2,6 @@ import org.openapijsonschematools.client.paths.userlogout.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -29,7 +27,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java index 223efea0cce..0b3743c7e0a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.userusername.delete.PathParameters; import org.openapijsonschematools.client.paths.userusername.delete.Parameters; import org.openapijsonschematools.client.paths.userusername.delete.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userusername; import java.io.IOException; @@ -30,7 +27,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -58,7 +55,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java index 503ec431719..759d511e42a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java @@ -5,13 +5,10 @@ import org.openapijsonschematools.client.paths.userusername.get.PathParameters; import org.openapijsonschematools.client.paths.userusername.get.Parameters; import org.openapijsonschematools.client.paths.userusername.get.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userusername; import java.io.IOException; @@ -30,7 +27,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -58,7 +55,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java index 748d806d396..81a5f385aab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java @@ -6,13 +6,10 @@ import org.openapijsonschematools.client.paths.userusername.put.PathParameters; import org.openapijsonschematools.client.paths.userusername.put.Parameters; import org.openapijsonschematools.client.paths.userusername.put.Responses; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Userusername; @@ -33,7 +30,7 @@ public static Void put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + ) throws IOException, InterruptedException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -67,7 +64,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + default Void put(PutRequest request) throws IOException, InterruptedException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java index 75de97ae0ee..a8d9f3c2972 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.components.parameters.pathusername.Schema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String username() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("username"); } } @@ -143,7 +140,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -151,12 +148,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -164,7 +161,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -176,29 +173,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java index e5020958495..5effba4ddc7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.userusername.delete.responses.Code200Response; import org.openapijsonschematools.client.paths.userusername.delete.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -40,7 +38,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java index ab220b57b21..c456e073d08 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java index cf14e31de9d..084596e13a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.components.parameters.pathusername.Schema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String username() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("username"); } } @@ -143,7 +140,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -151,12 +148,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -164,7 +161,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -176,29 +173,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java index 320fedb631d..7be14427d06 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.paths.userusername.get.responses.Code400Response; import org.openapijsonschematools.client.paths.userusername.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -44,7 +42,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java index e83a0bb7634..3086e739dfb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -52,15 +50,19 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else { - ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } + throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java index 4fcdb4ca075..1612e8c8da1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java index cfa381bd2a1..7533ab39e11 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java index a45316dbab8..96b11df0969 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java @@ -11,6 +11,7 @@ import org.openapijsonschematools.client.components.parameters.pathusername.Schema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -54,11 +55,7 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String username() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("username"); } } @@ -143,7 +140,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -151,12 +148,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -164,7 +161,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -176,29 +173,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java index 5efb70e1d9b..22d0e1f9007 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java @@ -4,7 +4,6 @@ package org.openapijsonschematools.client.paths.userusername.put; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -37,7 +36,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java index 732033d8a06..996c3423963 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.paths.userusername.put.responses.Code400Response; import org.openapijsonschematools.client.paths.userusername.put.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -31,7 +29,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java index 600fd3fe1df..a9207b46b15 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java index c7aea37db95..6226880fa67 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java @@ -4,8 +4,6 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -23,7 +21,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java index 6be6cbffd80..37fb90cd4f2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.Map; @@ -34,14 +33,14 @@ private SerializedRequestBody serializeTextPlain(String contentType, @Nullable O 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 { + protected SerializedRequestBody serialize(String contentType, @Nullable Object body) { 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"); + throw new RuntimeException("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; + public abstract SerializedRequestBody serialize(T requestBody); } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java index 9ec3e3c44a6..bbd744abebc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java @@ -2,8 +2,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.header.Header; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; @@ -20,7 +18,7 @@ public HeadersDeserializer(Map headers, MapSchemaValidator headersToValidate = new HashMap<>(); for (Map.Entry> entry: responseHeaders.map().entrySet()) { String headerName = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java index 640f2a96415..59079f9f1a1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java @@ -7,27 +7,31 @@ import java.util.Optional; import org.checkerframework.checker.nullness.qual.Nullable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.ToNumberPolicy; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.header.Header; public abstract class ResponseDeserializer { public final Map content; public final @Nullable Map headers; + private static final Gson gson = new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create(); 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 abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration); + protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration); protected @Nullable Object deserializeJson(byte[] body) { String bodyStr = new String(body, StandardCharsets.UTF_8); @@ -38,7 +42,7 @@ 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 { + protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) { if (ContentTypeDetector.contentTypeIsJson(contentType)) { @Nullable Object bodyData = deserializeJson(body); return schema.validateAndBox(bodyData, configuration); @@ -46,28 +50,23 @@ protected T deserializeBody(String contentType, byte[] body, JsonSchema s String bodyData = deserializeTextPlain(body); return schema.validateAndBox(bodyData, configuration); } - throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); + throw new RuntimeException("Deserialization for contentType="+contentType+" has not yet been implemented."); } - public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { 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 - ); + throw new RuntimeException("Invalid response returned, Content-Type header is missing and it must be included"); } 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 + if (content != null && !content.containsKey(contentType)) { + throw new RuntimeException( + "Invalid contentType returned. contentType="+contentType+" was returned "+ + "when only "+content.keySet()+" are defined for statusCode="+response.statusCode() ); } byte[] bodyBytes = response.body(); - SealedBodyClass body = getBody(contentType, mediaType, bodyBytes, configuration); + SealedBodyClass body = getBody(contentType, bodyBytes, configuration); HeaderClass headers = getHeaders(response.headers(), configuration); return new DeserializedHttpResponse<>(body, headers); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java index f72be2313af..20b56db17da 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java @@ -2,10 +2,7 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import java.net.http.HttpResponse; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException; + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration); } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index 7990efaa995..0ffcae114bd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -2,6 +2,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -85,7 +86,7 @@ public static AnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -97,7 +98,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -109,7 +110,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,24 +121,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -169,7 +170,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -179,7 +180,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -196,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -204,7 +205,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -213,7 +214,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,11 +241,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -259,41 +260,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -309,7 +310,7 @@ public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java index 12af2ba8196..2cceae9d49f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java @@ -2,6 +2,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -43,7 +44,7 @@ public static BooleanJsonSchema1 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -59,30 +60,30 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index 4853a27dee8..15b5ca67f26 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -2,11 +2,12 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -46,7 +47,7 @@ public static DateJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -65,30 +66,30 @@ public String validate(LocalDate arg, SchemaConfiguration configuration) throws if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof LocalDate) { return validate((LocalDate) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DateJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java index a5b4f50d788..e695f3c2ac9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java @@ -2,11 +2,12 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -46,7 +47,7 @@ public static DateTimeJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -65,30 +66,30 @@ public String validate(ZonedDateTime arg, SchemaConfiguration configuration) thr if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof ZonedDateTime) { return validate((ZonedDateTime) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DateTimeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java index 6651aa44497..f961e94f802 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java @@ -2,6 +2,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -45,7 +46,7 @@ public static DecimalJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,28 +61,28 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DecimalJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java index 9bcb31d2068..56f7894f670 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java @@ -2,6 +2,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -45,7 +46,7 @@ public static DoubleJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -55,7 +56,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -64,28 +65,28 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new DoubleJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java index 101b2ea1f57..65221627b46 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java @@ -2,6 +2,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -45,7 +46,7 @@ public static FloatJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -55,7 +56,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } @@ -64,28 +65,28 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new FloatJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java index 2938d08bf21..836fa1db724 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java @@ -1,12 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -48,7 +49,7 @@ public static Int32JsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -58,7 +59,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } @@ -71,28 +72,28 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int32JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java index c17217a89ab..da3f9d8d5f7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java @@ -1,12 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -50,7 +51,7 @@ public static Int64JsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,11 +61,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } @@ -81,28 +82,28 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Int64JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java index 34b79da8f66..6205c5b4380 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java @@ -1,12 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -50,7 +51,7 @@ public static IntJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,11 +61,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } @@ -81,28 +82,28 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new IntJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index 8135ed020cf..7ebb3106467 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -1,13 +1,14 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -55,7 +56,7 @@ public static ListJsonSchema1 getInstance() { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -65,7 +66,7 @@ public static ListJsonSchema1 getInstance() { return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -81,28 +82,28 @@ public static ListJsonSchema1 getInstance() { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ListJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index 85396cda11a..47e141dac53 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -1,13 +1,14 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -53,7 +54,7 @@ public static MapJsonSchema1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -61,7 +62,7 @@ public static MapJsonSchema1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -70,7 +71,7 @@ public static MapJsonSchema1 getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -85,28 +86,28 @@ public static MapJsonSchema1 getInstance() { if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new MapJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index 7a1a3367d78..de1ed91b0cd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -2,6 +2,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -87,7 +88,7 @@ public static NotAnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -99,7 +100,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -111,7 +112,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -122,24 +123,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -171,7 +172,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -181,7 +182,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -198,7 +199,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -206,7 +207,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -215,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,11 +243,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,41 +262,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -311,7 +312,7 @@ public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java index af32938007e..d028dbf295e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java @@ -2,6 +2,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -44,7 +45,7 @@ public static NullJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -59,29 +60,29 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg == null) { return validate((Void) null, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NullJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java index 57629ac9557..5c33b047d95 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java @@ -1,12 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -49,7 +50,7 @@ public static NumberJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -59,19 +60,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @@ -80,28 +81,28 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new NumberJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java index 7185ac28496..749f5faba63 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java @@ -2,11 +2,12 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -46,7 +47,7 @@ public static StringJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -73,11 +74,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof LocalDate) { @@ -87,20 +88,20 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new StringJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java index 2502602642f..c2087929db7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java @@ -1,12 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -46,7 +47,7 @@ public static UuidJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -65,30 +66,30 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UuidJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java index b7afc854c15..64d9f476798 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java @@ -1,7 +1,5 @@ package org.openapijsonschematools.client.schemas.validation; - import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -13,7 +11,7 @@ public class AdditionalPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java index 4b969c68a20..eb6bcf21d4a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java @@ -1,13 +1,11 @@ package org.openapijsonschematools.client.schemas.validation; - import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; public class AllOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var allOf = data.schema().allOf; if (allOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java index 19d4e0337c9..d466518d3fe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java @@ -10,7 +10,7 @@ public class AnyOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var anyOf = data.schema().anyOf; if (anyOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java index 639d32e889e..cb28fcb9662 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java @@ -5,7 +5,7 @@ import java.math.BigDecimal; public abstract class BigDecimalValidator { - protected BigDecimal getBigDecimal(Number arg) throws ValidationException { + protected BigDecimal getBigDecimal(Number arg) { if (arg instanceof Integer) { return new BigDecimal((Integer) arg); } else if (arg instanceof Long) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java index 7e80fd207c2..cbf6ed9ddbf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java @@ -1,8 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface BooleanEnumValidator { - boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; + boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java index 96c69f5a7a2..7bade32a205 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java @@ -1,9 +1,10 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface BooleanSchemaValidator { - boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException; - T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException; + boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java index 93872adcc2f..6409a23e5ca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java @@ -10,7 +10,7 @@ public class ConstValidator extends BigDecimalValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { if (!data.schema().constValueSet) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java index 41565577d58..fbfd1c9c700 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java @@ -9,7 +9,7 @@ public class ContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { if (!(data.arg() instanceof List)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java index 1f1d1ba5e68..43fe8423969 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java @@ -1,7 +1,5 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; - public interface DefaultValueMethod { - T defaultValue() throws ValidationException; + T defaultValue(); } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java index 2640e2f6d8d..77b21ca801d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java @@ -11,7 +11,7 @@ public class DependentRequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java index f51b5eaf339..e329529fe8a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashSet; import java.util.Map; @@ -11,7 +10,7 @@ public class DependentSchemasValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java index f2b8b1e7d74..aa59920f5ac 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java @@ -1,8 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface DoubleEnumValidator { - double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; + double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java index 18573a77ef7..3f50d9326c4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java @@ -1,13 +1,14 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ElseValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var elseSchema = data.schema().elseSchema; if (elseSchema == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java index 66563d80960..8af756619bd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java @@ -15,7 +15,7 @@ private static boolean enumContainsArg(Set<@Nullable Object> enumValues, @Nullab @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var enumValues = data.schema().enumValues; if (enumValues == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java index e05df98079f..7d05ff65546 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var exclusiveMaximum = data.schema().exclusiveMaximum; if (exclusiveMaximum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java index 0e06f391f62..73eb1e547c3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var exclusiveMinimum = data.schema().exclusiveMinimum; if (exclusiveMinimum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java index 17317003a34..33d4834731d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java @@ -1,8 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface FloatEnumValidator { - float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; + float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java index 35c089a03c7..c1ca45e44f3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java @@ -18,7 +18,7 @@ public class FormatValidator implements KeywordValidator { private final static BigDecimal doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308d); private final static BigDecimal doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308d); - private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) throws ValidationException { + private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) { if (format.startsWith("int")) { // there is a json schema test where 1.0 validates as an integer BigInteger intArg; @@ -85,7 +85,7 @@ private static void validateNumericFormat(Number arg, ValidationMetadata validat } } - private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { + private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) { switch (format) { case "uuid" -> { try { @@ -133,7 +133,7 @@ private static void validateStringFormat(String arg, ValidationMetadata validati @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var format = data.schema().format; if (format == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java index 2a05893a22a..b145ab8007a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java @@ -7,7 +7,7 @@ public class IfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var ifSchema = data.schema().ifSchema; if (ifSchema == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java index cb20c832f9b..491cb228f18 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java @@ -1,8 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface IntegerEnumValidator { - int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; + int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java index 68d62107337..1b03c0b3094 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +9,7 @@ public class ItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var items = data.schema().items; if (items == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index a597533422f..beb7460b86c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -1,8 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.checkerframework.checker.nullness.qual.Nullable; import java.math.BigDecimal; import java.time.LocalDate; @@ -220,9 +221,9 @@ protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { this.keywordToValidator = keywordToValidator; } - public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas); - public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; - public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; + public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; + public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; + public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; private List getContainsPathToSchemas( @Nullable Object arg, @@ -261,7 +262,7 @@ private List getContainsPathToSchemas( private PathToSchemasMap getPatternPropertiesPathToSchemas( @Nullable Object arg, ValidationMetadata validationMetadata - ) throws ValidationException { + ) { if (!(arg instanceof Map mapArg) || patternProperties == null) { return new PathToSchemasMap(); } @@ -269,7 +270,7 @@ private PathToSchemasMap getPatternPropertiesPathToSchemas( for (Map.Entry entry: mapArg.entrySet()) { Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new ValidationException("Invalid non-string type for map key"); + throw new InvalidTypeException("Invalid non-string type for map key"); } List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); propPathToItem.add(key); @@ -305,7 +306,7 @@ private PathToSchemasMap getIfPathToSchemas( try { var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException ignored) {} + } catch (ValidationException | InvalidTypeException ignored) {} return pathToSchemas; } @@ -388,7 +389,7 @@ protected Void castToAllowedTypes(Void arg, List pathToItem, Set castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); List<@Nullable Object> argFixed = new ArrayList<>(); int i =0; @@ -402,13 +403,13 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws ValidationException { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new ValidationException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } Object val = entry.getValue(); List newPathToItem = new ArrayList<>(pathToItem); @@ -419,7 +420,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set pathToItem, Set> pathSet) throws ValidationException { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { @@ -447,7 +448,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set argClass = arg.getClass(); - throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); + throw new InvalidTypeException("Invalid type passed in for input="+arg+" type="+argClass); } } @@ -467,7 +468,7 @@ public String getNewInstance(String arg, List pathToItem, PathToSchemasM return arg; } - protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) throws ValidationException { + protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) { PathToSchemasMap pathToSchemasMap = new PathToSchemasMap(); // todo add check of validationMetadata.validationRanEarlier(this) PathToSchemasMap otherPathToSchemas = validate(jsonSchema, arg, validationMetadata); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index a7752b37595..d0ff52b29c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -1,12 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; - OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException; - BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException; + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java index 6b6bcd88c47..88410ffc5e2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java @@ -1,8 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface LongEnumValidator { - long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; + long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java index 9bd7d432165..984693428e8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java @@ -1,13 +1,14 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; import java.util.Map; public interface MapSchemaValidator { - OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; - OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException; - BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException; + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas); + OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java index 315771b9e0c..9e9b3b92c18 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java @@ -9,7 +9,7 @@ public class MaxContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var maxContains = data.schema().maxContains; if (maxContains == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java index 2749843cbf2..98ed5cb4ff4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java @@ -9,7 +9,7 @@ public class MaxItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var maxItems = data.schema().maxItems; if (maxItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java index f2a77fa91f6..08d91666c5d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java @@ -7,7 +7,7 @@ public class MaxLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var maxLength = data.schema().maxLength; if (maxLength == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java index 57a53e71be5..d117f1688e2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java @@ -9,7 +9,7 @@ public class MaxPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var maxProperties = data.schema().maxProperties; if (maxProperties == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java index df1c7f5c338..702f09686dc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java @@ -7,7 +7,7 @@ public class MaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var maximum = data.schema().maximum; if (maximum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java index 6ea4404dc1f..1827e95cc83 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java @@ -9,7 +9,7 @@ public class MinContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var minContains = data.schema().minContains; if (minContains == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java index 25bae60bda7..d1933ca7750 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java @@ -9,7 +9,7 @@ public class MinItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var minItems = data.schema().minItems; if (minItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java index f4639e8a207..1defdc891e3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java @@ -7,7 +7,7 @@ public class MinLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var minLength = data.schema().minLength; if (minLength == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java index 011ac76dd31..c0b99e7fb7d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java @@ -9,7 +9,7 @@ public class MinPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var minProperties = data.schema().minProperties; if (minProperties == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java index 76065fe50b5..3b539120e42 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java @@ -7,7 +7,7 @@ public class MinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var minimum = data.schema().minimum; if (minimum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java index d8273d04d9c..eebc07a0f10 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java @@ -9,7 +9,7 @@ public class MultipleOfValidator extends BigDecimalValidator implements KeywordV @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var multipleOf = data.schema().multipleOf; if (multipleOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java index 3e6b8e91e7c..b077e2056a1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java @@ -7,7 +7,7 @@ public class NotValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var not = data.schema().not; if (not == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java index bc6bd3663bb..96b52a74b9f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java @@ -1,8 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface NullEnumValidator { - Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; + Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java index c30cde9f9b7..c49fc0150fe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java @@ -1,9 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; +import java.util.List; +import java.util.Set; + public interface NullSchemaValidator { - Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException; - T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException; + Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java index dd3c349ad69..c426b250af8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java @@ -1,9 +1,10 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface NumberSchemaValidator { - Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException; - T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException; + Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java index 7dd5f4128ac..3c4f4b5a085 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java @@ -10,7 +10,7 @@ public class OneOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var oneOf = data.schema().oneOf; if (oneOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java index d7eebd78098..eceeb19e311 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java @@ -7,7 +7,7 @@ public class PatternValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var pattern = data.schema().pattern; if (pattern == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java index 510f3a8760e..237bc250190 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +9,7 @@ public class PrefixItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var prefixItems = data.schema().prefixItems; if (prefixItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java index 8803b661fd6..b8ddd6fcb46 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -13,7 +12,7 @@ public class PropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var properties = data.schema().properties; if (properties == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java index 0169ff5bdba..087cd308b11 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -11,7 +10,7 @@ public class PropertyNamesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var propertyNames = data.schema().propertyNames; if (propertyNames == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java index 2519cbcfd3b..f2e1a8ecde8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; import java.util.HashSet; import java.util.List; @@ -12,7 +12,7 @@ public class RequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var required = data.schema().required; if (required == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java index baf86081fd7..49ca190ae5f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java @@ -1,8 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface StringEnumValidator { - String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; + String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java index e6729893fca..8cbc38335bf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java @@ -1,9 +1,10 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface StringSchemaValidator { - String validate(String arg, SchemaConfiguration configuration) throws ValidationException; - T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException; + String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java index 75c083e2edc..bf599bc812f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java @@ -1,13 +1,14 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ThenValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var then = data.schema().then; if (then == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java index 300d472cfdf..bb4133a770e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; import java.util.List; import java.util.Map; @@ -10,7 +10,7 @@ public class TypeValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var type = data.schema().type; if (type == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java index 407904da444..8903d0b19a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java @@ -1,7 +1,6 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +9,7 @@ public class UnevaluatedItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var unevaluatedItems = data.schema().unevaluatedItems; if (unevaluatedItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java index 8fd34950404..344c0cfab1b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import java.util.ArrayList; import java.util.List; @@ -11,7 +11,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var unevaluatedProperties = data.schema().unevaluatedProperties; if (unevaluatedProperties == null) { return null; @@ -27,7 +27,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { JsonSchema unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties); for(Map.Entry entry: mapArg.entrySet()) { if (!(entry.getKey() instanceof String propName)) { - throw new ValidationException("Map keys must be strings"); + throw new InvalidTypeException("Map keys must be strings"); } List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); propPathToItem.add(propName); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java index 6b40ba79fff..a42a7d60b60 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.checkerframework.checker.nullness.qual.Nullable; import java.util.HashSet; import java.util.List; @@ -11,7 +11,7 @@ public class UniqueItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) throws ValidationException { + ) { var uniqueItems = data.schema().uniqueItems; if (uniqueItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index 8e17449eb27..1c23a427dd0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -2,6 +2,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; @@ -72,7 +73,7 @@ public static UnsetAnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -84,7 +85,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -96,7 +97,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -107,24 +108,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { + public int validate(int arg, SchemaConfiguration configuration) { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { + public long validate(long arg, SchemaConfiguration configuration) { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { + public float validate(float arg, SchemaConfiguration configuration) { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { + public double validate(double arg, SchemaConfiguration configuration) { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,7 +157,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -166,7 +167,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +184,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -191,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -200,7 +201,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -227,11 +228,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -246,41 +247,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { + public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { + public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { + public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -296,7 +297,7 @@ public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaC } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java index 9cf6147b8f1..6b0db70c264 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java @@ -1,6 +1,9 @@ package org.openapijsonschematools.client.securityrequirementobjects; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; +import org.checkerframework.checker.nullness.qual.Nullable; + public interface SecurityRequirementObjectProvider { - SecurityRequirementObject getSecurityRequirementObject(T securityIndex); + SecurityRequirementObject getSecurityRequirementObject(@Nullable T securityIndex) throws UnsetPropertyException; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java index b0aa605a011..6327eea827e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java @@ -2,7 +2,6 @@ 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.servers.server0.Variables; @@ -12,24 +11,17 @@ public class Server0 extends ServerWithVariables { /* petstore server */ - private static Variables.VariablesMap getVariables() { - try { - return Variables.Variables1.getInstance().validate( + + public Server0() { + super( + "http://{server}.swagger.io:{port}/v2", + Variables.Variables1.getInstance().validate( MapUtils.makeMap( new AbstractMap.SimpleEntry<>("port", Variables.Port.getInstance().defaultValue()), new AbstractMap.SimpleEntry<>("server", Variables.Server.getInstance().defaultValue()) ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ); - } catch (ValidationException e) { - throw new RuntimeException(e); - } - } - - public Server0() { - super( - "http://{server}.swagger.io:{port}/v2", - getVariables() + ) ); } public Server0(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java index 555ea894037..12d78391b64 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java @@ -2,7 +2,6 @@ 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.servers.server1.Variables; @@ -12,23 +11,16 @@ public class Server1 extends ServerWithVariables { /* The local server */ - private static Variables.VariablesMap getVariables() { - try { - return Variables.Variables1.getInstance().validate( - MapUtils.makeMap( - new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) - ), - new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ); - } catch (ValidationException e) { - throw new RuntimeException(e); - } - } public Server1() { super( "https://localhost:8080/{version}", - getVariables() + Variables.Variables1.getInstance().validate( + MapUtils.makeMap( + new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) + ), + new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) + ) ); } public Server1(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java index f736485870c..8c93a971aae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java @@ -1,6 +1,8 @@ package org.openapijsonschematools.client.servers; +import org.checkerframework.checker.nullness.qual.Nullable; + public interface ServerProvider { - Server getServer(T serverIndex); + Server getServer(@Nullable T serverIndex); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java index 9a17cee2161..12c3a68ffb0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -113,35 +114,35 @@ public String validate(StringServerEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public ServerBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public ServerBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ServerBoxedString(validate(arg, configuration)); } @Override - public ServerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ServerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringPortEnums implements StringValueMethod { @@ -211,35 +212,35 @@ public String validate(StringPortEnums arg,SchemaConfiguration configuration) th } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public PortBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public PortBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new PortBoxedString(validate(arg, configuration)); } @Override - public PortBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public PortBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -259,7 +260,7 @@ public static VariablesMap of(Map arg, SchemaConfiguration confi public String port() { String value = get("port"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for port"); + throw new InvalidTypeException("Invalid value stored for port"); } return (String) value; } @@ -267,7 +268,7 @@ public String port() { public String server() { String value = get("server"); if (!(value instanceof String)) { - throw new RuntimeException("Invalid value stored for server"); + throw new InvalidTypeException("Invalid value stored for server"); } return (String) value; } @@ -409,7 +410,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -417,12 +418,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -430,7 +431,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -442,29 +443,29 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java index c8f236973c4..1ecc7a5cb8e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java @@ -10,6 +10,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -111,35 +112,35 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() throws ValidationException { + public String defaultValue() { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new ValidationException("Invalid type stored in defaultValue"); + throw new InvalidTypeException("Invalid type stored in defaultValue"); } @Override - public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { + public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new VersionBoxedString(validate(arg, configuration)); } @Override - public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -156,11 +157,7 @@ public static VariablesMap of(Map arg, SchemaConfiguration confi } public String version() { - try { - return getOrThrow("version"); - } catch (UnsetPropertyException e) { - throw new RuntimeException(e); - } + return getOrThrow("version"); } } @@ -251,7 +248,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -259,12 +256,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new RuntimeException("Invalid instantiated value"); + throw new InvalidTypeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -272,7 +269,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -284,29 +281,29 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java index 476dab2c3da..990f21a1148 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java @@ -5,13 +5,10 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.net.http.HttpHeaders; -import java.util.AbstractMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -25,7 +22,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() throws ValidationException, NotImplementedException { + public void testSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -103,7 +100,7 @@ public Void encoding() { return null; } } - AbstractMap.SimpleEntry> content = new AbstractMap.SimpleEntry<>( + Map> content = Map.of( "application/json", new ApplicationJsonMediaType() ); for (ParamTestCase testCase: testCases) { diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java index b1dc30975ab..b0eaf780b2e 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java @@ -5,8 +5,7 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.ListJsonSchema; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -29,7 +28,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() throws ValidationException, NotImplementedException { + public void testSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -106,7 +105,7 @@ public void testSerialization() throws ValidationException, NotImplementedExcept ); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - NotImplementedException.class, + InvalidTypeException.class, () -> boolHeader.serialize(value, "color", false, configuration) ); } @@ -127,7 +126,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserialization() throws ValidationException, NotImplementedException { + public void testDeserialization() { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java index a46f7fbb5f7..a19ea8c1007 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java @@ -2,7 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -33,7 +32,7 @@ protected CookieParametersSerializer() { } @Test - public void testSerialization() throws NotImplementedException { + public void testSerialization() { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java index 2a9acf14219..63f3159bf0a 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java @@ -2,7 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -34,7 +33,7 @@ protected HeaderParametersSerializer() { } @Test - public void testSerialization() throws NotImplementedException { + public void testSerialization() { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java index 3ff2ac5ed88..bef110af08d 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java @@ -2,7 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -33,7 +32,7 @@ protected PathParametersSerializer() { } @Test - public void testSerialization() throws NotImplementedException { + public void testSerialization() { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java index 7cb559fef3c..ed5aae7e580 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java @@ -2,7 +2,6 @@ import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -33,7 +32,7 @@ protected QueryParametersSerializer() { } @Test - public void testSerialization() throws NotImplementedException { + public void testSerialization() { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java index 4d799c14c72..871d4f073f3 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java @@ -3,7 +3,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +26,7 @@ public HeaderParameter(@Nullable Boolean explode) { } @Test - public void testHeaderSerialization() throws NotImplementedException { + public void testHeaderSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -91,7 +91,7 @@ public void testHeaderSerialization() throws NotImplementedException { var boolHeader = new HeaderParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - NotImplementedException.class, + InvalidTypeException.class, () -> boolHeader.serialize(value) ); } @@ -104,7 +104,7 @@ public PathParameter(@Nullable Boolean explode) { } @Test - public void testPathSerialization() throws NotImplementedException { + public void testPathSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -169,7 +169,7 @@ public void testPathSerialization() throws NotImplementedException { var pathParameter = new PathParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - NotImplementedException.class, + InvalidTypeException.class, () -> pathParameter.serialize(value) ); } @@ -182,7 +182,7 @@ public CookieParameter(@Nullable Boolean explode) { } @Test - public void testCookieSerialization() throws NotImplementedException { + public void testCookieSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -247,7 +247,7 @@ public void testCookieSerialization() throws NotImplementedException { var cookieParameter = new CookieParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - NotImplementedException.class, + InvalidTypeException.class, () -> cookieParameter.serialize(value) ); } @@ -260,7 +260,7 @@ public PathMatrixParameter(@Nullable Boolean explode) { } @Test - public void testPathMatrixSerialization() throws NotImplementedException { + public void testPathMatrixSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -331,7 +331,7 @@ public PathLabelParameter(@Nullable Boolean explode) { } @Test - public void testPathLabelSerialization() throws NotImplementedException { + public void testPathLabelSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java index 413b092634f..f4ea29fccb3 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java @@ -3,7 +3,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +26,7 @@ public QueryParameterNoStyle(@Nullable Boolean explode) { } @Test - public void testQueryParameterNoStyleSerialization() throws NotImplementedException { + public void testQueryParameterNoStyleSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -91,7 +91,7 @@ public void testQueryParameterNoStyleSerialization() throws NotImplementedExcept var parameter = new QueryParameterNoStyle(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - NotImplementedException.class, + InvalidTypeException.class, () -> parameter.serialize(value) ); } @@ -104,7 +104,7 @@ public QueryParameterSpaceDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { + public void testQueryParameterSpaceDelimitedSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -151,7 +151,7 @@ public QueryParameterPipeDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { + public void testQueryParameterPipeDelimitedSerialization() { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java index 93a5adb916a..9f0c86ec5c4 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java @@ -3,8 +3,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -49,7 +47,7 @@ public MyRequestBodySerializer() { true); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + public SerializedRequestBody serialize(SealedRequestBody requestBody) { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { @@ -95,7 +93,7 @@ private String getJsonBody(SerializedRequestBody requestBody) { } @Test - public void testSerializeApplicationJson() throws ValidationException, NotImplementedException { + public void testSerializeApplicationJson() { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); String jsonBody; @@ -166,7 +164,7 @@ public void testSerializeApplicationJson() throws ValidationException, NotImplem } @Test - public void testSerializeTextPlain() throws ValidationException, NotImplementedException { + public void testSerializeTextPlain() { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); SerializedRequestBody requestBody = serializer.serialize( diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java index e4656ecbbc3..408f04582a8 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java @@ -8,9 +8,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.NotImplementedException; -import org.openapijsonschematools.client.exceptions.ApiException; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -67,7 +64,11 @@ public MyResponseDeserializer() { } @Override - protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + SealedMediaType mediaType = content.get(contentType); + if (mediaType == null) { + throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); + } if (mediaType instanceof ApplicationjsonMediatype thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonBody(deserializedBody); @@ -151,7 +152,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserializeApplicationJsonNull() throws ValidationException, ApiException, NotImplementedException { + public void testDeserializeApplicationJsonNull() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(null).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -167,7 +168,7 @@ public void testDeserializeApplicationJsonNull() throws ValidationException, Api } @Test - public void testDeserializeApplicationJsonTrue() throws ValidationException, ApiException, NotImplementedException { + public void testDeserializeApplicationJsonTrue() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(true).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -183,7 +184,7 @@ public void testDeserializeApplicationJsonTrue() throws ValidationException, Api } @Test - public void testDeserializeApplicationJsonFalse() throws ValidationException, ApiException, NotImplementedException { + public void testDeserializeApplicationJsonFalse() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(false).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -199,7 +200,7 @@ public void testDeserializeApplicationJsonFalse() throws ValidationException, Ap } @Test - public void testDeserializeApplicationJsonInt() throws ValidationException, ApiException, NotImplementedException { + public void testDeserializeApplicationJsonInt() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(1).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -215,7 +216,7 @@ public void testDeserializeApplicationJsonInt() throws ValidationException, ApiE } @Test - public void testDeserializeApplicationJsonFloat() throws ValidationException, ApiException, NotImplementedException { + public void testDeserializeApplicationJsonFloat() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson(3.14).getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); @@ -231,7 +232,7 @@ public void testDeserializeApplicationJsonFloat() throws ValidationException, Ap } @Test - public void testDeserializeApplicationJsonString() throws ValidationException, ApiException, NotImplementedException { + public void testDeserializeApplicationJsonString() { var deserializer = new MyResponseDeserializer(); byte[] bodyBytes = toJson("a").getBytes(StandardCharsets.UTF_8); BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java index 206c683cd50..9b76ff56c45 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java @@ -5,7 +5,6 @@ import org.junit.Test; 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; @@ -27,13 +26,13 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testValidateNull() throws ValidationException { + public void testValidateNull() { Void validatedValue = schema.validate((Void) null, configuration); assertNull(validatedValue); } @Test - public void testValidateBoolean() throws ValidationException { + public void testValidateBoolean() { boolean trueValue = schema.validate(true, configuration); Assert.assertTrue(trueValue); @@ -42,49 +41,49 @@ public void testValidateBoolean() throws ValidationException { } @Test - public void testValidateInteger() throws ValidationException { + public void testValidateInteger() { int validatedValue = schema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() throws ValidationException { + public void testValidateLong() { long validatedValue = schema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() throws ValidationException { + public void testValidateFloat() { float validatedValue = schema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() throws ValidationException { + public void testValidateDouble() { double validatedValue = schema.validate(70.6458763d, configuration); Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); } @Test - public void testValidateString() throws ValidationException { + public void testValidateString() { String validatedValue = schema.validate("a", configuration); Assert.assertEquals(validatedValue, "a"); } @Test - public void testValidateZonedDateTime() throws ValidationException { + public void testValidateZonedDateTime() { String validatedValue = schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration); Assert.assertEquals(validatedValue, "2017-07-21T17:32:28Z"); } @Test - public void testValidateLocalDate() throws ValidationException { + public void testValidateLocalDate() { String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); Assert.assertEquals(validatedValue, "2017-07-21"); } @Test - public void testValidateMap() throws ValidationException { + public void testValidateMap() { LinkedHashMap inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap validatedValue = schema.validate(inMap, configuration); @@ -94,7 +93,7 @@ public void testValidateMap() throws ValidationException { } @Test - public void testValidateList() throws ValidationException { + public void testValidateList() { ArrayList inList = new ArrayList<>(); inList.add(LocalDate.of(2017, 7, 21)); FrozenList validatedValue = schema.validate(inList, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index 0ca5e56ecd2..42dfcabf0d0 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -5,12 +5,13 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -52,12 +53,12 @@ public FrozenList getNewInstance(List arg, List pathToItem, P itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new RuntimeException("Instantiated type of item is invalid"); + throw new InvalidTypeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -65,7 +66,7 @@ public FrozenList getNewInstance(List arg, List pathToItem, P return new FrozenList<>(items); } - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -76,7 +77,7 @@ public FrozenList validate(List arg, SchemaConfiguration configuratio } @Override - public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayWithItemsSchemaBoxedList(validate(arg, configuration)); } @@ -85,23 +86,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof List listArg) { return new ArrayWithItemsSchemaBoxedList(validate(listArg, configuration)); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -110,7 +111,7 @@ protected ArrayWithOutputClsSchemaList(FrozenList m) { super(m); } - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws ValidationException { + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) { return new ArrayWithOutputClsSchema().validate(arg, configuration); } } @@ -137,12 +138,12 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new RuntimeException("Instantiated type of item is invalid"); + throw new InvalidTypeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -151,7 +152,7 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat return new ArrayWithOutputClsSchemaList(newInstanceItems); } - public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,7 +163,7 @@ public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration co } @Override - public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)); } @@ -171,23 +172,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof List listArg) { return new ArrayWithOutputClsSchemaBoxedList(validate(listArg, configuration)); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -201,7 +202,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateArrayWithItemsSchema() throws ValidationException { + public void testValidateArrayWithItemsSchema() { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); @@ -226,7 +227,7 @@ public void testValidateArrayWithItemsSchema() throws ValidationException { } @Test - public void testValidateArrayWithOutputClsSchema() throws ValidationException { + public void testValidateArrayWithOutputClsSchema() { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java index 7ac24fbeaa2..0b4261a7ef0 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java @@ -4,8 +4,9 @@ import org.junit.Test; 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.JsonSchemaFactory; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -23,13 +24,13 @@ public class BooleanSchemaTest { ); @Test - public void testValidateTrue() throws ValidationException { + public void testValidateTrue() { boolean validatedValue = booleanJsonSchema.validate(true, configuration); Assert.assertTrue(validatedValue); } @Test - public void testValidateFalse() throws ValidationException { + public void testValidateFalse() { boolean validatedValue = booleanJsonSchema.validate(false, configuration); Assert.assertFalse(validatedValue); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java index 17d5f35dcbe..cb4aa60f4a8 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java @@ -5,9 +5,9 @@ import org.junit.Test; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -35,7 +35,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateList() throws ValidationException { + public void testValidateList() { List inList = new ArrayList<>(); inList.add("today"); FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java index 5b03fec8609..85afb15a068 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java @@ -5,9 +5,9 @@ import org.junit.Test; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -37,7 +37,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateMap() throws ValidationException { + public void testValidateMap() { Map inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap<@Nullable Object> validatedValue = mapJsonSchema.validate(inMap, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java index eb1c70ef049..d566f15a69e 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java @@ -4,8 +4,9 @@ import org.junit.Test; 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.JsonSchemaFactory; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -25,7 +26,7 @@ public class NullSchemaTest { @Test @SuppressWarnings("nullness") - public void testValidateNull() throws ValidationException { + public void testValidateNull() { Void validatedValue = nullJsonSchema.validate(null, configuration); Assert.assertNull(validatedValue); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java index fcde27495e3..2ab8d8a8121 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java @@ -4,8 +4,8 @@ import org.junit.Test; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -23,25 +23,25 @@ public class NumberSchemaTest { ); @Test - public void testValidateInteger() throws ValidationException { + public void testValidateInteger() { int validatedValue = numberJsonSchema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() throws ValidationException { + public void testValidateLong() { long validatedValue = numberJsonSchema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() throws ValidationException { + public void testValidateFloat() { float validatedValue = numberJsonSchema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() throws ValidationException { + public void testValidateDouble() { double validatedValue = numberJsonSchema.validate(3.14d, configuration); Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index fad3d574369..02729b0f046 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -5,13 +5,14 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; 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.PropertyEntry; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -61,7 +62,7 @@ public static ObjectWithPropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -69,7 +70,7 @@ public static ObjectWithPropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -78,7 +79,7 @@ public static ObjectWithPropsSchema getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -89,7 +90,7 @@ public static ObjectWithPropsSchema getInstance() { } @Override - public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)); } @@ -98,23 +99,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -145,7 +146,7 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -153,19 +154,19 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(castValue instanceof String)) { - throw new RuntimeException("Invalid type for property value"); + throw new InvalidTypeException("Invalid type for property value"); } properties.put(propertyName, (String) castValue); } return new FrozenMap<>(properties); } - public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -176,24 +177,24 @@ public FrozenMap validate(Map arg, SchemaConfiguration configurati } @Override - public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -201,7 +202,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -234,7 +235,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -242,7 +243,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -251,7 +252,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -262,24 +263,24 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { } @Override - public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -287,7 +288,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -296,7 +297,7 @@ protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { super(m); } - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) { return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); } } @@ -329,7 +330,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new RuntimeException("Invalid non-string key value"); + throw new InvalidTypeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -337,7 +338,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -346,7 +347,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); } - public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -357,24 +358,24 @@ public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration } @Override - public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { return new ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithOutputTypeSchemaBoxedMap(validate(mapArg, configuration)); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -382,7 +383,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -397,7 +398,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateObjectWithPropsSchema() throws ValidationException { + public void testValidateObjectWithPropsSchema() { ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); // map with only property works @@ -428,7 +429,7 @@ public void testValidateObjectWithPropsSchema() throws ValidationException { } @Test - public void testValidateObjectWithAddpropsSchema() throws ValidationException { + public void testValidateObjectWithAddpropsSchema() { ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); // map with only property works @@ -459,7 +460,7 @@ public void testValidateObjectWithAddpropsSchema() throws ValidationException { } @Test - public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException { + public void testValidateObjectWithPropsAndAddpropsSchema() { ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); // map with only property works @@ -498,7 +499,7 @@ public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationExce } @Test - public void testValidateObjectWithOutputTypeSchema() throws ValidationException { + public void testValidateObjectWithOutputTypeSchema() { ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); // map with only property works diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java index d3cba69fb20..c8079ef632a 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java @@ -4,8 +4,9 @@ import org.junit.Test; 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.JsonSchemaFactory; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -27,13 +28,13 @@ public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchem ); @Test - public void testValidateTrue() throws ValidationException { + public void testValidateTrue() { Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); Assert.assertEquals(validatedValue, Boolean.TRUE); } @Test - public void testValidateFalse() throws ValidationException { + public void testValidateFalse() { Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); Assert.assertEquals(validatedValue, Boolean.FALSE); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java index ea3ec6ae8c3..40a01c9983d 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java @@ -5,7 +5,7 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; @@ -46,19 +46,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return arg; } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map) { return arg; } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } @@ -70,7 +70,7 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() throws ValidationException { + public void testCorrectPropertySucceeds() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -105,7 +105,7 @@ public void testCorrectPropertySucceeds() throws ValidationException { } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { + public void testNotApplicableTypeReturnsNull() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java index cb03bcf8f5b..1481f312f6a 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java @@ -34,7 +34,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testIntFormatSucceedsWithFloat() throws ValidationException { + public void testIntFormatSucceedsWithFloat() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -59,7 +59,7 @@ public void testIntFormatFailsWithFloat() { } @Test - public void testIntFormatSucceedsWithInt() throws ValidationException { + public void testIntFormatSucceedsWithInt() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -84,7 +84,7 @@ public void testInt32UnderMinFails() { } @Test - public void testInt32InclusiveMinSucceeds() throws ValidationException { + public void testInt32InclusiveMinSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -97,7 +97,7 @@ public void testInt32InclusiveMinSucceeds() throws ValidationException { } @Test - public void testInt32InclusiveMaxSucceeds() throws ValidationException { + public void testInt32InclusiveMaxSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -135,7 +135,7 @@ public void testInt64UnderMinFails() { } @Test - public void testInt64InclusiveMinSucceeds() throws ValidationException { + public void testInt64InclusiveMinSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -148,7 +148,7 @@ public void testInt64InclusiveMinSucceeds() throws ValidationException { } @Test - public void testInt64InclusiveMaxSucceeds() throws ValidationException { + public void testInt64InclusiveMaxSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -186,7 +186,7 @@ public void testFloatUnderMinFails() { } @Test - public void testFloatInclusiveMinSucceeds() throws ValidationException { + public void testFloatInclusiveMinSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -199,7 +199,7 @@ public void testFloatInclusiveMinSucceeds() throws ValidationException { } @Test - public void testFloatInclusiveMaxSucceeds() throws ValidationException { + public void testFloatInclusiveMaxSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -236,7 +236,7 @@ public void testDoubleUnderMinFails() { } @Test - public void testDoubleInclusiveMinSucceeds() throws ValidationException { + public void testDoubleInclusiveMinSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -249,7 +249,7 @@ public void testDoubleInclusiveMinSucceeds() throws ValidationException { } @Test - public void testDoubleInclusiveMaxSucceeds() throws ValidationException { + public void testDoubleInclusiveMaxSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -286,7 +286,7 @@ public void testInvalidNumberStringFails() { } @Test - public void testValidFloatNumberStringSucceeds() throws ValidationException { + public void testValidFloatNumberStringSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -299,7 +299,7 @@ public void testValidFloatNumberStringSucceeds() throws ValidationException { } @Test - public void testValidIntNumberStringSucceeds() throws ValidationException { + public void testValidIntNumberStringSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -324,7 +324,7 @@ public void testInvalidDateStringFails() { } @Test - public void testValidDateStringSucceeds() throws ValidationException { + public void testValidDateStringSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -349,7 +349,7 @@ public void testInvalidDateTimeStringFails() { } @Test - public void testValidDateTimeStringSucceeds() throws ValidationException { + public void testValidDateTimeStringSucceeds() { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java index 5b70aada50c..e0e4a0c859e 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java @@ -6,6 +6,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; @@ -36,25 +37,25 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List listArg) { return getNewInstance(listArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof List listArg) { return validate(listArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return new ArrayWithItemsSchemaBoxedList(); } } @Test - public void testCorrectItemsSucceeds() throws ValidationException { + public void testCorrectItemsSucceeds() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -88,7 +89,7 @@ public void testCorrectItemsSucceeds() throws ValidationException { } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { + public void testNotApplicableTypeReturnsNull() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java index c1cc4c84e9e..8a14df7edd6 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java @@ -5,6 +5,7 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -39,25 +40,25 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof String) { return arg; } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof String) { return arg; } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return new SomeSchemaBoxedString(); } } @Test - public void testValidateSucceeds() throws ValidationException { + public void testValidateSucceeds() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java index e35b145e721..492f45af0c7 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java @@ -5,8 +5,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.StringJsonSchema; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -35,19 +36,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } @@ -58,7 +59,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() throws ValidationException { + public void testCorrectPropertySucceeds() { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( @@ -91,7 +92,7 @@ public void testCorrectPropertySucceeds() throws ValidationException { } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { + public void testNotApplicableTypeReturnsNull() { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java index 58c160a0499..65ff030d74b 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java @@ -5,6 +5,7 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -31,19 +32,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { + public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { return new ObjectWithRequiredSchemaBoxedMap(); } } @@ -54,7 +55,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() throws ValidationException { + public void testCorrectPropertySucceeds() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -77,7 +78,7 @@ public void testCorrectPropertySucceeds() throws ValidationException { } @Test - public void testNotApplicableTypeReturnsNull() throws ValidationException { + public void testNotApplicableTypeReturnsNull() { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java index c31855af4ff..ebc8bbff1f5 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java @@ -18,7 +18,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testValidateSucceeds() throws ValidationException { + public void testValidateSucceeds() { final TypeValidator validator = new TypeValidator(); ValidationMetadata validationMetadata = new ValidationMetadata( new ArrayList<>(), diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java index c1ffa4cc812..a15605aa665 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java @@ -298,7 +298,8 @@ public JavaClientGenerator() { .includeGlobalFeatures( GlobalFeature.Components, GlobalFeature.Servers, - GlobalFeature.Security + GlobalFeature.Security, + GlobalFeature.Paths ) .includeComponentsFeatures( ComponentsFeature.schemas, From 710c10b9035a1d03f86569b158b9145facaa549d Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 4 Apr 2024 16:24:32 -0700 Subject: [PATCH 49/53] 310 java sample regen --- .../java/.openapi-generator/FILES | 89 +--- .../java/docs/RootServerInfo.md | 23 + .../client/RootServerInfo.java | 60 +-- ...rtiesAllowsASchemaWhichShouldValidate.java | 23 +- ...ditionalpropertiesAreAllowedByDefault.java | 49 +- .../AdditionalpropertiesCanExistByItself.java | 25 +- ...lpropertiesShouldNotLookInApplicators.java | 101 ++-- .../client/components/schemas/Allof.java | 149 +++--- .../schemas/AllofCombinedWithAnyofOneof.java | 193 ++++--- .../components/schemas/AllofSimpleTypes.java | 145 +++--- .../schemas/AllofWithBaseSchema.java | 151 +++--- .../schemas/AllofWithOneEmptySchema.java | 49 +- .../schemas/AllofWithTheFirstEmptySchema.java | 49 +- .../schemas/AllofWithTheLastEmptySchema.java | 49 +- .../schemas/AllofWithTwoEmptySchemas.java | 49 +- .../client/components/schemas/Anyof.java | 97 ++-- .../components/schemas/AnyofComplexTypes.java | 149 +++--- .../schemas/AnyofWithBaseSchema.java | 111 ++-- .../schemas/AnyofWithOneEmptySchema.java | 49 +- .../schemas/ArrayTypeMatchesArrays.java | 17 +- .../client/components/schemas/ByInt.java | 49 +- .../client/components/schemas/ByNumber.java | 49 +- .../components/schemas/BySmallNumber.java | 49 +- .../components/schemas/DateTimeFormat.java | 49 +- .../components/schemas/EmailFormat.java | 49 +- .../schemas/EnumWith0DoesNotMatchFalse.java | 15 +- .../schemas/EnumWith1DoesNotMatchTrue.java | 15 +- .../schemas/EnumWithEscapedCharacters.java | 15 +- .../schemas/EnumWithFalseDoesNotMatch0.java | 15 +- .../schemas/EnumWithTrueDoesNotMatch1.java | 15 +- .../components/schemas/EnumsInProperties.java | 53 +- .../components/schemas/ForbiddenProperty.java | 49 +- .../components/schemas/HostnameFormat.java | 49 +- ...ouldNotRaiseErrorWhenFloatDivisionInf.java | 15 +- .../schemas/InvalidStringValueForDefault.java | 69 ++- .../client/components/schemas/Ipv4Format.java | 49 +- .../client/components/schemas/Ipv6Format.java | 49 +- .../components/schemas/JsonPointerFormat.java | 49 +- .../components/schemas/MaximumValidation.java | 49 +- .../MaximumValidationWithUnsignedInteger.java | 49 +- .../schemas/MaxitemsValidation.java | 49 +- .../schemas/MaxlengthValidation.java | 49 +- .../Maxproperties0MeansTheObjectIsEmpty.java | 49 +- .../schemas/MaxpropertiesValidation.java | 49 +- .../components/schemas/MinimumValidation.java | 49 +- .../MinimumValidationWithSignedInteger.java | 49 +- .../schemas/MinitemsValidation.java | 49 +- .../schemas/MinlengthValidation.java | 49 +- .../schemas/MinpropertiesValidation.java | 49 +- ...NestedAllofToCheckValidationSemantics.java | 97 ++-- ...NestedAnyofToCheckValidationSemantics.java | 97 ++-- .../components/schemas/NestedItems.java | 73 ++- ...NestedOneofToCheckValidationSemantics.java | 97 ++-- .../client/components/schemas/Not.java | 49 +- .../schemas/NotMoreComplexSchema.java | 71 ++- .../schemas/NulCharactersInStrings.java | 15 +- .../schemas/ObjectPropertiesValidation.java | 53 +- .../client/components/schemas/Oneof.java | 97 ++-- .../components/schemas/OneofComplexTypes.java | 149 +++--- .../schemas/OneofWithBaseSchema.java | 111 ++-- .../schemas/OneofWithEmptySchema.java | 49 +- .../components/schemas/OneofWithRequired.java | 141 ++--- .../schemas/PatternIsNotAnchored.java | 49 +- .../components/schemas/PatternValidation.java | 49 +- .../PropertiesWithEscapedCharacters.java | 49 +- .../PropertyNamedRefThatIsNotAReference.java | 49 +- .../schemas/RefInAdditionalproperties.java | 23 +- .../client/components/schemas/RefInAllof.java | 49 +- .../client/components/schemas/RefInAnyof.java | 49 +- .../client/components/schemas/RefInItems.java | 19 +- .../client/components/schemas/RefInNot.java | 49 +- .../client/components/schemas/RefInOneof.java | 49 +- .../components/schemas/RefInProperty.java | 51 +- .../schemas/RequiredDefaultValidation.java | 49 +- .../schemas/RequiredValidation.java | 55 +- .../schemas/RequiredWithEmptyArray.java | 49 +- .../RequiredWithEscapedCharacters.java | 49 +- .../schemas/SimpleEnumValidation.java | 15 +- ...esNotDoAnythingIfThePropertyIsMissing.java | 37 +- .../schemas/UniqueitemsFalseValidation.java | 49 +- .../schemas/UniqueitemsValidation.java | 49 +- .../client/components/schemas/UriFormat.java | 49 +- .../schemas/UriReferenceFormat.java | 49 +- .../components/schemas/UriTemplateFormat.java | 49 +- .../configurations/ApiConfiguration.java | 35 +- .../client/exceptions/BaseException.java | 2 +- .../client/header/ContentHeader.java | 41 +- .../client/header/Header.java | 6 +- .../client/header/Rfc6570Serializer.java | 55 +- .../client/header/SchemaHeader.java | 16 +- .../client/header/StyleSerializer.java | 13 +- .../client/parameter/ContentParameter.java | 22 +- .../client/parameter/CookieSerializer.java | 3 +- .../client/parameter/HeadersSerializer.java | 3 +- .../client/parameter/Parameter.java | 3 +- .../client/parameter/PathSerializer.java | 3 +- .../client/parameter/QuerySerializer.java | 3 +- .../client/parameter/SchemaParameter.java | 5 +- .../requestbody/RequestBodySerializer.java | 7 +- .../client/response/HeadersDeserializer.java | 4 +- .../client/response/ResponseDeserializer.java | 37 +- .../response/ResponsesDeserializer.java | 5 +- .../client/schemas/AnyTypeJsonSchema.java | 49 +- .../client/schemas/BooleanJsonSchema.java | 15 +- .../client/schemas/DateJsonSchema.java | 17 +- .../client/schemas/DateTimeJsonSchema.java | 17 +- .../client/schemas/DecimalJsonSchema.java | 15 +- .../client/schemas/DoubleJsonSchema.java | 17 +- .../client/schemas/FloatJsonSchema.java | 17 +- .../client/schemas/Int32JsonSchema.java | 19 +- .../client/schemas/Int64JsonSchema.java | 21 +- .../client/schemas/IntJsonSchema.java | 21 +- .../client/schemas/ListJsonSchema.java | 19 +- .../client/schemas/MapJsonSchema.java | 21 +- .../client/schemas/NotAnyTypeJsonSchema.java | 49 +- .../client/schemas/NullJsonSchema.java | 15 +- .../client/schemas/NumberJsonSchema.java | 25 +- .../client/schemas/StringJsonSchema.java | 17 +- .../client/schemas/UuidJsonSchema.java | 17 +- .../AdditionalPropertiesValidator.java | 4 +- .../schemas/validation/AllOfValidator.java | 4 +- .../schemas/validation/AnyOfValidator.java | 2 +- .../validation/BigDecimalValidator.java | 2 +- .../validation/BooleanEnumValidator.java | 3 +- .../validation/BooleanSchemaValidator.java | 5 +- .../schemas/validation/ConstValidator.java | 2 +- .../schemas/validation/ContainsValidator.java | 2 +- .../validation/DefaultValueMethod.java | 4 +- .../DependentRequiredValidator.java | 2 +- .../validation/DependentSchemasValidator.java | 3 +- .../validation/DoubleEnumValidator.java | 3 +- .../schemas/validation/ElseValidator.java | 3 +- .../schemas/validation/EnumValidator.java | 2 +- .../validation/ExclusiveMaximumValidator.java | 2 +- .../validation/ExclusiveMinimumValidator.java | 2 +- .../validation/FloatEnumValidator.java | 3 +- .../schemas/validation/FormatValidator.java | 6 +- .../schemas/validation/IfValidator.java | 2 +- .../validation/IntegerEnumValidator.java | 3 +- .../schemas/validation/ItemsValidator.java | 3 +- .../client/schemas/validation/JsonSchema.java | 27 +- .../validation/ListSchemaValidator.java | 7 +- .../schemas/validation/LongEnumValidator.java | 3 +- .../validation/MapSchemaValidator.java | 7 +- .../validation/MaxContainsValidator.java | 2 +- .../schemas/validation/MaxItemsValidator.java | 2 +- .../validation/MaxLengthValidator.java | 2 +- .../validation/MaxPropertiesValidator.java | 2 +- .../schemas/validation/MaximumValidator.java | 2 +- .../validation/MinContainsValidator.java | 2 +- .../schemas/validation/MinItemsValidator.java | 2 +- .../validation/MinLengthValidator.java | 2 +- .../validation/MinPropertiesValidator.java | 2 +- .../schemas/validation/MinimumValidator.java | 2 +- .../validation/MultipleOfValidator.java | 2 +- .../schemas/validation/NotValidator.java | 2 +- .../schemas/validation/NullEnumValidator.java | 3 +- .../validation/NullSchemaValidator.java | 8 +- .../validation/NumberSchemaValidator.java | 5 +- .../schemas/validation/OneOfValidator.java | 2 +- .../schemas/validation/PatternValidator.java | 2 +- .../validation/PrefixItemsValidator.java | 3 +- .../validation/PropertiesValidator.java | 3 +- .../validation/PropertyNamesValidator.java | 3 +- .../schemas/validation/RequiredValidator.java | 4 +- .../validation/StringEnumValidator.java | 3 +- .../validation/StringSchemaValidator.java | 5 +- .../schemas/validation/ThenValidator.java | 3 +- .../schemas/validation/TypeValidator.java | 4 +- .../validation/UnevaluatedItemsValidator.java | 3 +- .../UnevaluatedPropertiesValidator.java | 6 +- .../validation/UniqueItemsValidator.java | 4 +- .../validation/UnsetAnyTypeJsonSchema.java | 49 +- .../client/servers/ServerProvider.java | 4 +- .../client/header/ContentHeaderTest.java | 7 +- .../client/header/SchemaHeaderTest.java | 9 +- .../parameter/CookieSerializerTest.java | 3 +- .../parameter/HeadersSerializerTest.java | 3 +- .../client/parameter/PathSerializerTest.java | 3 +- .../client/parameter/QuerySerializerTest.java | 3 +- .../SchemaNonQueryParameterTest.java | 18 +- .../parameter/SchemaQueryParameterTest.java | 10 +- .../RequestBodySerializerTest.java | 8 +- .../response/ResponseDeserializerTest.java | 21 +- .../client/schemas/AnyTypeSchemaTest.java | 23 +- .../client/schemas/ArrayTypeSchemaTest.java | 45 +- .../client/schemas/BooleanSchemaTest.java | 7 +- .../client/schemas/ListSchemaTest.java | 4 +- .../client/schemas/MapSchemaTest.java | 4 +- .../client/schemas/NullSchemaTest.java | 5 +- .../client/schemas/NumberSchemaTest.java | 10 +- .../client/schemas/ObjectTypeSchemaTest.java | 87 ++-- .../client/schemas/RefBooleanSchemaTest.java | 7 +- .../AdditionalPropertiesValidatorTest.java | 14 +- .../validation/FormatValidatorTest.java | 28 +- .../validation/ItemsValidatorTest.java | 13 +- .../schemas/validation/JsonSchemaTest.java | 11 +- .../validation/PropertiesValidatorTest.java | 15 +- .../validation/RequiredValidatorTest.java | 13 +- .../schemas/validation/TypeValidatorTest.java | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../java/.openapi-generator/FILES | 2 +- .../java/docs/RootServerInfo.md | 23 + .../client/RootServerInfo.java | 60 +-- .../schemas/ASchemaGivenForPrefixitems.java | 49 +- .../AdditionalItemsAreAllowedByDefault.java | 49 +- ...ditionalpropertiesAreAllowedByDefault.java | 49 +- .../AdditionalpropertiesCanExistByItself.java | 25 +- ...nalpropertiesDoesNotLookInApplicators.java | 101 ++-- ...rtiesWithNullValuedInstanceProperties.java | 23 +- .../AdditionalpropertiesWithSchema.java | 23 +- .../client/components/schemas/Allof.java | 149 +++--- .../schemas/AllofCombinedWithAnyofOneof.java | 193 ++++--- .../components/schemas/AllofSimpleTypes.java | 145 +++--- .../schemas/AllofWithBaseSchema.java | 151 +++--- .../schemas/AllofWithOneEmptySchema.java | 49 +- .../schemas/AllofWithTheFirstEmptySchema.java | 49 +- .../schemas/AllofWithTheLastEmptySchema.java | 49 +- .../schemas/AllofWithTwoEmptySchemas.java | 49 +- .../client/components/schemas/Anyof.java | 97 ++-- .../components/schemas/AnyofComplexTypes.java | 149 +++--- .../schemas/AnyofWithBaseSchema.java | 111 ++-- .../schemas/AnyofWithOneEmptySchema.java | 49 +- .../client/components/schemas/ByInt.java | 49 +- .../client/components/schemas/ByNumber.java | 49 +- .../components/schemas/BySmallNumber.java | 49 +- .../schemas/ConstNulCharactersInStrings.java | 49 +- .../schemas/ContainsKeywordValidation.java | 97 ++-- .../ContainsWithNullInstanceElements.java | 49 +- .../client/components/schemas/DateFormat.java | 49 +- .../components/schemas/DateTimeFormat.java | 49 +- ...emasDependenciesWithEscapedCharacters.java | 145 +++--- ...ependentSubschemaIncompatibleWithRoot.java | 69 ++- .../DependentSchemasSingleDependency.java | 101 ++-- .../components/schemas/DurationFormat.java | 49 +- .../components/schemas/EmailFormat.java | 49 +- .../components/schemas/EmptyDependents.java | 49 +- .../schemas/EnumWith0DoesNotMatchFalse.java | 15 +- .../schemas/EnumWith1DoesNotMatchTrue.java | 15 +- .../schemas/EnumWithEscapedCharacters.java | 15 +- .../schemas/EnumWithFalseDoesNotMatch0.java | 15 +- .../schemas/EnumWithTrueDoesNotMatch1.java | 15 +- .../components/schemas/EnumsInProperties.java | 53 +- .../schemas/ExclusivemaximumValidation.java | 49 +- .../schemas/ExclusiveminimumValidation.java | 49 +- .../components/schemas/FloatDivisionInf.java | 15 +- .../components/schemas/ForbiddenProperty.java | 97 ++-- .../components/schemas/HostnameFormat.java | 49 +- .../components/schemas/IdnEmailFormat.java | 49 +- .../components/schemas/IdnHostnameFormat.java | 49 +- .../schemas/IfAndElseWithoutThen.java | 145 +++--- .../schemas/IfAndThenWithoutElse.java | 145 +++--- ...enSerializedKeywordProcessingSequence.java | 193 ++++--- .../schemas/IgnoreElseWithoutIf.java | 97 ++-- .../schemas/IgnoreIfWithoutThenOrElse.java | 97 ++-- .../schemas/IgnoreThenWithoutIf.java | 97 ++-- .../client/components/schemas/Ipv4Format.java | 49 +- .../client/components/schemas/Ipv6Format.java | 49 +- .../client/components/schemas/IriFormat.java | 49 +- .../schemas/IriReferenceFormat.java | 49 +- .../components/schemas/ItemsContains.java | 113 ++-- ...temsDoesNotLookInApplicatorsValidCase.java | 65 ++- .../ItemsWithNullInstanceElements.java | 19 +- .../components/schemas/JsonPointerFormat.java | 49 +- .../MaxcontainsWithoutContainsIsIgnored.java | 49 +- .../components/schemas/MaximumValidation.java | 49 +- .../MaximumValidationWithUnsignedInteger.java | 49 +- .../schemas/MaxitemsValidation.java | 49 +- .../schemas/MaxlengthValidation.java | 49 +- .../Maxproperties0MeansTheObjectIsEmpty.java | 49 +- .../schemas/MaxpropertiesValidation.java | 49 +- .../MincontainsWithoutContainsIsIgnored.java | 49 +- .../components/schemas/MinimumValidation.java | 49 +- .../MinimumValidationWithSignedInteger.java | 49 +- .../schemas/MinitemsValidation.java | 49 +- .../schemas/MinlengthValidation.java | 49 +- .../schemas/MinpropertiesValidation.java | 49 +- .../schemas/MultipleDependentsRequired.java | 49 +- ...ltaneousPatternpropertiesAreValidated.java | 97 ++-- .../MultipleTypesCanBeSpecifiedInAnArray.java | 17 +- ...NestedAllofToCheckValidationSemantics.java | 97 ++-- ...NestedAnyofToCheckValidationSemantics.java | 97 ++-- .../components/schemas/NestedItems.java | 73 ++- ...NestedOneofToCheckValidationSemantics.java | 97 ++-- ...nAsciiPatternWithAdditionalproperties.java | 21 +- .../NonInterferenceAcrossCombinedSchemas.java | 337 ++++++------ .../client/components/schemas/Not.java | 49 +- .../schemas/NotMoreComplexSchema.java | 71 ++- .../components/schemas/NotMultipleTypes.java | 65 ++- .../schemas/NulCharactersInStrings.java | 15 +- .../schemas/ObjectPropertiesValidation.java | 53 +- .../client/components/schemas/Oneof.java | 97 ++-- .../components/schemas/OneofComplexTypes.java | 149 +++--- .../schemas/OneofWithBaseSchema.java | 111 ++-- .../schemas/OneofWithEmptySchema.java | 49 +- .../components/schemas/OneofWithRequired.java | 141 ++--- .../schemas/PatternIsNotAnchored.java | 49 +- .../components/schemas/PatternValidation.java | 49 +- ...tiesValidatesPropertiesMatchingARegex.java | 49 +- ...rtiesWithNullValuedInstanceProperties.java | 49 +- ...dationAdjustsTheStartingIndexForItems.java | 19 +- .../PrefixitemsWithNullInstanceElements.java | 49 +- ...ertiesAdditionalpropertiesInteraction.java | 93 ++-- ...NamesAreJavascriptObjectPropertyNames.java | 101 ++-- .../PropertiesWithEscapedCharacters.java | 49 +- ...rtiesWithNullValuedInstanceProperties.java | 51 +- .../PropertyNamedRefThatIsNotAReference.java | 49 +- .../schemas/PropertynamesValidation.java | 63 ++- .../components/schemas/RegexFormat.java | 49 +- ...tAnchoredByDefaultAndAreCaseSensitive.java | 49 +- .../schemas/RelativeJsonPointerFormat.java | 49 +- .../schemas/RequiredDefaultValidation.java | 49 +- ...NamesAreJavascriptObjectPropertyNames.java | 55 +- .../schemas/RequiredValidation.java | 55 +- .../schemas/RequiredWithEmptyArray.java | 49 +- .../RequiredWithEscapedCharacters.java | 49 +- .../schemas/SimpleEnumValidation.java | 15 +- .../components/schemas/SingleDependency.java | 49 +- .../schemas/SmallMultipleOfLargeInteger.java | 15 +- .../client/components/schemas/TimeFormat.java | 49 +- .../schemas/TypeArrayObjectOrNull.java | 27 +- .../components/schemas/TypeArrayOrObject.java | 25 +- .../schemas/UnevaluateditemsAsSchema.java | 49 +- ...ditemsDependsOnMultipleNestedContains.java | 289 +++++------ .../schemas/UnevaluateditemsWithItems.java | 19 +- ...valuateditemsWithNullInstanceElements.java | 49 +- ...dpropertiesNotAffectedByPropertynames.java | 63 ++- .../schemas/UnevaluatedpropertiesSchema.java | 35 +- ...rtiesWithAdjacentAdditionalproperties.java | 23 +- ...rtiesWithNullValuedInstanceProperties.java | 49 +- .../schemas/UniqueitemsFalseValidation.java | 49 +- .../UniqueitemsFalseWithAnArrayOfItems.java | 49 +- .../schemas/UniqueitemsValidation.java | 49 +- .../UniqueitemsWithAnArrayOfItems.java | 49 +- .../client/components/schemas/UriFormat.java | 49 +- .../schemas/UriReferenceFormat.java | 49 +- .../components/schemas/UriTemplateFormat.java | 49 +- .../client/components/schemas/UuidFormat.java | 49 +- ...alidateAgainstCorrectBranchThenVsElse.java | 193 ++++--- .../configurations/ApiConfiguration.java | 35 +- .../client/exceptions/BaseException.java | 2 +- .../exceptions/NotImplementedException.java | 8 + .../client/header/ContentHeader.java | 41 +- .../client/header/Header.java | 6 +- .../client/header/Rfc6570Serializer.java | 55 +- .../client/header/SchemaHeader.java | 16 +- .../client/header/StyleSerializer.java | 13 +- .../client/parameter/ContentParameter.java | 22 +- .../client/parameter/CookieSerializer.java | 3 +- .../client/parameter/HeadersSerializer.java | 3 +- .../client/parameter/Parameter.java | 3 +- .../client/parameter/PathSerializer.java | 3 +- .../client/parameter/QuerySerializer.java | 3 +- .../client/parameter/SchemaParameter.java | 5 +- .../requestbody/RequestBodySerializer.java | 7 +- .../client/response/HeadersDeserializer.java | 4 +- .../client/response/ResponseDeserializer.java | 37 +- .../response/ResponsesDeserializer.java | 5 +- .../client/schemas/AnyTypeJsonSchema.java | 49 +- .../client/schemas/BooleanJsonSchema.java | 15 +- .../client/schemas/DateJsonSchema.java | 17 +- .../client/schemas/DateTimeJsonSchema.java | 17 +- .../client/schemas/DecimalJsonSchema.java | 15 +- .../client/schemas/DoubleJsonSchema.java | 17 +- .../client/schemas/FloatJsonSchema.java | 17 +- .../client/schemas/Int32JsonSchema.java | 19 +- .../client/schemas/Int64JsonSchema.java | 21 +- .../client/schemas/IntJsonSchema.java | 21 +- .../client/schemas/ListJsonSchema.java | 19 +- .../client/schemas/MapJsonSchema.java | 21 +- .../client/schemas/NotAnyTypeJsonSchema.java | 49 +- .../client/schemas/NullJsonSchema.java | 15 +- .../client/schemas/NumberJsonSchema.java | 25 +- .../client/schemas/StringJsonSchema.java | 17 +- .../client/schemas/UuidJsonSchema.java | 17 +- .../AdditionalPropertiesValidator.java | 4 +- .../schemas/validation/AllOfValidator.java | 4 +- .../schemas/validation/AnyOfValidator.java | 2 +- .../validation/BigDecimalValidator.java | 2 +- .../validation/BooleanEnumValidator.java | 3 +- .../validation/BooleanSchemaValidator.java | 5 +- .../schemas/validation/ConstValidator.java | 2 +- .../schemas/validation/ContainsValidator.java | 2 +- .../validation/DefaultValueMethod.java | 4 +- .../DependentRequiredValidator.java | 2 +- .../validation/DependentSchemasValidator.java | 3 +- .../validation/DoubleEnumValidator.java | 3 +- .../schemas/validation/ElseValidator.java | 3 +- .../schemas/validation/EnumValidator.java | 2 +- .../validation/ExclusiveMaximumValidator.java | 2 +- .../validation/ExclusiveMinimumValidator.java | 2 +- .../validation/FloatEnumValidator.java | 3 +- .../schemas/validation/FormatValidator.java | 6 +- .../schemas/validation/IfValidator.java | 2 +- .../validation/IntegerEnumValidator.java | 3 +- .../schemas/validation/ItemsValidator.java | 3 +- .../client/schemas/validation/JsonSchema.java | 27 +- .../validation/ListSchemaValidator.java | 7 +- .../schemas/validation/LongEnumValidator.java | 3 +- .../validation/MapSchemaValidator.java | 7 +- .../validation/MaxContainsValidator.java | 2 +- .../schemas/validation/MaxItemsValidator.java | 2 +- .../validation/MaxLengthValidator.java | 2 +- .../validation/MaxPropertiesValidator.java | 2 +- .../schemas/validation/MaximumValidator.java | 2 +- .../validation/MinContainsValidator.java | 2 +- .../schemas/validation/MinItemsValidator.java | 2 +- .../validation/MinLengthValidator.java | 2 +- .../validation/MinPropertiesValidator.java | 2 +- .../schemas/validation/MinimumValidator.java | 2 +- .../validation/MultipleOfValidator.java | 2 +- .../schemas/validation/NotValidator.java | 2 +- .../schemas/validation/NullEnumValidator.java | 3 +- .../validation/NullSchemaValidator.java | 8 +- .../validation/NumberSchemaValidator.java | 5 +- .../schemas/validation/OneOfValidator.java | 2 +- .../schemas/validation/PatternValidator.java | 2 +- .../validation/PrefixItemsValidator.java | 3 +- .../validation/PropertiesValidator.java | 3 +- .../validation/PropertyNamesValidator.java | 3 +- .../schemas/validation/RequiredValidator.java | 4 +- .../validation/StringEnumValidator.java | 3 +- .../validation/StringSchemaValidator.java | 5 +- .../schemas/validation/ThenValidator.java | 3 +- .../schemas/validation/TypeValidator.java | 4 +- .../validation/UnevaluatedItemsValidator.java | 3 +- .../UnevaluatedPropertiesValidator.java | 6 +- .../validation/UniqueItemsValidator.java | 4 +- .../validation/UnsetAnyTypeJsonSchema.java | 49 +- .../client/servers/ServerProvider.java | 4 +- .../ASchemaGivenForPrefixitemsTest.java | 13 +- ...dditionalItemsAreAllowedByDefaultTest.java | 3 +- ...onalpropertiesAreAllowedByDefaultTest.java | 3 +- ...itionalpropertiesCanExistByItselfTest.java | 5 +- ...ropertiesDoesNotLookInApplicatorsTest.java | 3 +- ...sWithNullValuedInstancePropertiesTest.java | 3 +- .../AdditionalpropertiesWithSchemaTest.java | 7 +- .../AllofCombinedWithAnyofOneofTest.java | 17 +- .../schemas/AllofSimpleTypesTest.java | 5 +- .../client/components/schemas/AllofTest.java | 9 +- .../schemas/AllofWithBaseSchemaTest.java | 11 +- .../schemas/AllofWithOneEmptySchemaTest.java | 3 +- .../AllofWithTheFirstEmptySchemaTest.java | 5 +- .../AllofWithTheLastEmptySchemaTest.java | 5 +- .../schemas/AllofWithTwoEmptySchemasTest.java | 3 +- .../schemas/AnyofComplexTypesTest.java | 9 +- .../client/components/schemas/AnyofTest.java | 9 +- .../schemas/AnyofWithBaseSchemaTest.java | 7 +- .../schemas/AnyofWithOneEmptySchemaTest.java | 5 +- .../schemas/ArrayTypeMatchesArraysTest.java | 15 +- .../BooleanTypeMatchesBooleansTest.java | 21 +- .../client/components/schemas/ByIntTest.java | 7 +- .../components/schemas/ByNumberTest.java | 7 +- .../components/schemas/BySmallNumberTest.java | 5 +- .../ConstNulCharactersInStringsTest.java | 5 +- .../ContainsKeywordValidationTest.java | 13 +- .../ContainsWithNullInstanceElementsTest.java | 3 +- .../components/schemas/DateFormatTest.java | 15 +- .../schemas/DateTimeFormatTest.java | 15 +- ...DependenciesWithEscapedCharactersTest.java | 9 +- ...dentSubschemaIncompatibleWithRootTest.java | 9 +- .../DependentSchemasSingleDependencyTest.java | 17 +- .../schemas/DurationFormatTest.java | 15 +- .../components/schemas/EmailFormatTest.java | 15 +- .../schemas/EmptyDependentsTest.java | 7 +- .../EnumWith0DoesNotMatchFalseTest.java | 7 +- .../EnumWith1DoesNotMatchTrueTest.java | 7 +- .../EnumWithEscapedCharactersTest.java | 7 +- .../EnumWithFalseDoesNotMatch0Test.java | 7 +- .../EnumWithTrueDoesNotMatch1Test.java | 7 +- .../schemas/EnumsInPropertiesTest.java | 13 +- .../ExclusivemaximumValidationTest.java | 9 +- .../ExclusiveminimumValidationTest.java | 9 +- .../schemas/FloatDivisionInfTest.java | 3 +- .../schemas/ForbiddenPropertyTest.java | 5 +- .../schemas/HostnameFormatTest.java | 15 +- .../schemas/IdnEmailFormatTest.java | 15 +- .../schemas/IdnHostnameFormatTest.java | 15 +- .../schemas/IfAndElseWithoutThenTest.java | 7 +- .../schemas/IfAndThenWithoutElseTest.java | 7 +- ...rializedKeywordProcessingSequenceTest.java | 9 +- .../schemas/IgnoreElseWithoutIfTest.java | 5 +- .../IgnoreIfWithoutThenOrElseTest.java | 5 +- .../schemas/IgnoreThenWithoutIfTest.java | 5 +- .../IntegerTypeMatchesIntegersTest.java | 19 +- .../components/schemas/Ipv4FormatTest.java | 15 +- .../components/schemas/Ipv6FormatTest.java | 15 +- .../components/schemas/IriFormatTest.java | 15 +- .../schemas/IriReferenceFormatTest.java | 15 +- .../components/schemas/ItemsContainsTest.java | 9 +- ...DoesNotLookInApplicatorsValidCaseTest.java | 5 +- .../ItemsWithNullInstanceElementsTest.java | 3 +- .../schemas/JsonPointerFormatTest.java | 15 +- ...xcontainsWithoutContainsIsIgnoredTest.java | 5 +- .../schemas/MaximumValidationTest.java | 9 +- ...imumValidationWithUnsignedIntegerTest.java | 9 +- .../schemas/MaxitemsValidationTest.java | 9 +- .../schemas/MaxlengthValidationTest.java | 11 +- ...xproperties0MeansTheObjectIsEmptyTest.java | 5 +- .../schemas/MaxpropertiesValidationTest.java | 13 +- ...ncontainsWithoutContainsIsIgnoredTest.java | 5 +- .../schemas/MinimumValidationTest.java | 9 +- ...inimumValidationWithSignedIntegerTest.java | 15 +- .../schemas/MinitemsValidationTest.java | 9 +- .../schemas/MinlengthValidationTest.java | 11 +- .../schemas/MinpropertiesValidationTest.java | 13 +- .../MultipleDependentsRequiredTest.java | 13 +- ...eousPatternpropertiesAreValidatedTest.java | 13 +- ...tipleTypesCanBeSpecifiedInAnArrayTest.java | 15 +- ...edAllofToCheckValidationSemanticsTest.java | 5 +- ...edAnyofToCheckValidationSemanticsTest.java | 5 +- .../components/schemas/NestedItemsTest.java | 7 +- ...edOneofToCheckValidationSemanticsTest.java | 5 +- ...iiPatternWithAdditionalpropertiesTest.java | 5 +- ...InterferenceAcrossCombinedSchemasTest.java | 5 +- .../schemas/NotMoreComplexSchemaTest.java | 7 +- .../schemas/NotMultipleTypesTest.java | 7 +- .../client/components/schemas/NotTest.java | 5 +- .../schemas/NulCharactersInStringsTest.java | 5 +- .../NullTypeMatchesOnlyTheNullObjectTest.java | 21 +- .../schemas/NumberTypeMatchesNumbersTest.java | 19 +- .../ObjectPropertiesValidationTest.java | 13 +- .../schemas/ObjectTypeMatchesObjectsTest.java | 15 +- .../schemas/OneofComplexTypesTest.java | 9 +- .../client/components/schemas/OneofTest.java | 9 +- .../schemas/OneofWithBaseSchemaTest.java | 7 +- .../schemas/OneofWithEmptySchemaTest.java | 5 +- .../schemas/OneofWithRequiredTest.java | 9 +- .../schemas/PatternIsNotAnchoredTest.java | 3 +- .../schemas/PatternValidationTest.java | 17 +- ...ValidatesPropertiesMatchingARegexTest.java | 15 +- ...sWithNullValuedInstancePropertiesTest.java | 3 +- ...onAdjustsTheStartingIndexForItemsTest.java | 5 +- ...efixitemsWithNullInstanceElementsTest.java | 3 +- ...esAdditionalpropertiesInteractionTest.java | 17 +- ...sAreJavascriptObjectPropertyNamesTest.java | 15 +- .../PropertiesWithEscapedCharactersTest.java | 5 +- ...sWithNullValuedInstancePropertiesTest.java | 3 +- ...opertyNamedRefThatIsNotAReferenceTest.java | 5 +- .../schemas/PropertynamesValidationTest.java | 13 +- .../components/schemas/RegexFormatTest.java | 15 +- ...horedByDefaultAndAreCaseSensitiveTest.java | 9 +- .../RelativeJsonPointerFormatTest.java | 15 +- .../RequiredDefaultValidationTest.java | 3 +- ...sAreJavascriptObjectPropertyNamesTest.java | 15 +- .../schemas/RequiredValidationTest.java | 11 +- .../schemas/RequiredWithEmptyArrayTest.java | 3 +- .../RequiredWithEscapedCharactersTest.java | 5 +- .../schemas/SimpleEnumValidationTest.java | 5 +- .../schemas/SingleDependencyTest.java | 15 +- .../SmallMultipleOfLargeIntegerTest.java | 3 +- .../schemas/StringTypeMatchesStringsTest.java | 19 +- .../components/schemas/TimeFormatTest.java | 15 +- .../schemas/TypeArrayObjectOrNullTest.java | 11 +- .../schemas/TypeArrayOrObjectTest.java | 11 +- .../schemas/TypeAsArrayWithOneItemTest.java | 5 +- .../schemas/UnevaluateditemsAsSchemaTest.java | 7 +- ...msDependsOnMultipleNestedContainsTest.java | 5 +- .../UnevaluateditemsWithItemsTest.java | 5 +- ...ateditemsWithNullInstanceElementsTest.java | 3 +- ...pertiesNotAffectedByPropertynamesTest.java | 5 +- .../UnevaluatedpropertiesSchemaTest.java | 7 +- ...sWithAdjacentAdditionalpropertiesTest.java | 5 +- ...sWithNullValuedInstancePropertiesTest.java | 3 +- .../UniqueitemsFalseValidationTest.java | 31 +- ...niqueitemsFalseWithAnArrayOfItemsTest.java | 17 +- .../schemas/UniqueitemsValidationTest.java | 53 +- .../UniqueitemsWithAnArrayOfItemsTest.java | 17 +- .../components/schemas/UriFormatTest.java | 15 +- .../schemas/UriReferenceFormatTest.java | 15 +- .../schemas/UriTemplateFormatTest.java | 15 +- .../components/schemas/UuidFormatTest.java | 15 +- ...ateAgainstCorrectBranchThenVsElseTest.java | 9 +- .../client/header/ContentHeaderTest.java | 7 +- .../client/header/SchemaHeaderTest.java | 9 +- .../parameter/CookieSerializerTest.java | 3 +- .../parameter/HeadersSerializerTest.java | 3 +- .../client/parameter/PathSerializerTest.java | 3 +- .../client/parameter/QuerySerializerTest.java | 3 +- .../SchemaNonQueryParameterTest.java | 18 +- .../parameter/SchemaQueryParameterTest.java | 10 +- .../RequestBodySerializerTest.java | 8 +- .../response/ResponseDeserializerTest.java | 21 +- .../client/schemas/AnyTypeSchemaTest.java | 23 +- .../client/schemas/ArrayTypeSchemaTest.java | 45 +- .../client/schemas/BooleanSchemaTest.java | 7 +- .../client/schemas/ListSchemaTest.java | 4 +- .../client/schemas/MapSchemaTest.java | 4 +- .../client/schemas/NullSchemaTest.java | 5 +- .../client/schemas/NumberSchemaTest.java | 10 +- .../client/schemas/ObjectTypeSchemaTest.java | 87 ++-- .../client/schemas/RefBooleanSchemaTest.java | 7 +- .../AdditionalPropertiesValidatorTest.java | 14 +- .../validation/FormatValidatorTest.java | 28 +- .../validation/ItemsValidatorTest.java | 13 +- .../schemas/validation/JsonSchemaTest.java | 11 +- .../validation/PropertiesValidatorTest.java | 15 +- .../validation/RequiredValidatorTest.java | 13 +- .../schemas/validation/TypeValidatorTest.java | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../petstore/java/.openapi-generator/FILES | 10 +- .../petstore/java/docs/RootServerInfo.md | 25 + .../headers/Int32JsonContentTypeHeader.md | 2 +- .../headers/RefContentSchemaHeader.md | 2 +- .../ComponentRefSchemaStringWithValidation.md | 2 +- .../components/requestbodies/RefUserArray.md | 2 +- .../java/docs/paths/anotherfakedummy/Patch.md | 80 ++- .../anotherfakedummy/patch/RequestBody.md | 4 +- .../docs/paths/commonparamsubdir/Delete.md | 78 ++- .../java/docs/paths/commonparamsubdir/Get.md | 78 ++- .../java/docs/paths/commonparamsubdir/Post.md | 78 ++- .../petstore/java/docs/paths/fake/Delete.md | 108 +++- .../petstore/java/docs/paths/fake/Get.md | 72 ++- .../petstore/java/docs/paths/fake/Patch.md | 80 ++- .../petstore/java/docs/paths/fake/Post.md | 81 ++- .../fake/delete/FakeDeleteSecurityInfo.md | 4 +- .../FakeDeleteSecurityRequirementObject0.md | 2 +- .../java/docs/paths/fake/get/RequestBody.md | 10 +- .../java/docs/paths/fake/patch/RequestBody.md | 4 +- .../paths/fake/post/FakePostSecurityInfo.md | 4 +- .../java/docs/paths/fake/post/RequestBody.md | 10 +- .../FakePostSecurityRequirementObject0.md | 2 +- .../Get.md | 68 ++- .../get/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/fakebodywithfileschema/Put.md | 80 ++- .../fakebodywithfileschema/put/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/fakebodywithqueryparams/Put.md | 106 +++- .../put/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/fakecasesensitiveparams/Put.md | 81 ++- .../docs/paths/fakeclassnametest/Patch.md | 91 +++- .../FakeclassnametestPatchSecurityInfo.md | 4 +- .../fakeclassnametest/patch/RequestBody.md | 4 +- ...nametestPatchSecurityRequirementObject0.md | 2 +- .../docs/paths/fakedeletecoffeeid/Delete.md | 81 ++- .../java/docs/paths/fakehealth/Get.md | 66 ++- .../fakeinlineadditionalproperties/Post.md | 78 ++- .../post/RequestBody.md | 10 +- .../docs/paths/fakeinlinecomposition/Post.md | 73 ++- .../fakeinlinecomposition/post/RequestBody.md | 20 +- .../java/docs/paths/fakejsonformdata/Get.md | 66 ++- .../paths/fakejsonformdata/get/RequestBody.md | 10 +- .../java/docs/paths/fakejsonpatch/Patch.md | 66 ++- .../paths/fakejsonpatch/patch/RequestBody.md | 10 +- .../ApplicationjsonpatchjsonSchema.md | 4 +- .../docs/paths/fakejsonwithcharset/Post.md | 68 ++- .../fakejsonwithcharset/post/RequestBody.md | 4 +- .../Post.md | 68 ++- .../post/RequestBody.md | 20 +- .../paths/fakemultipleresponsebodies/Get.md | 72 ++- .../docs/paths/fakemultiplesecurities/Get.md | 82 ++- .../FakemultiplesecuritiesGetSecurityInfo.md | 6 +- ...securitiesGetSecurityRequirementObject1.md | 2 +- ...securitiesGetSecurityRequirementObject2.md | 2 +- .../java/docs/paths/fakeobjinquery/Get.md | 65 ++- .../Post.md | 91 +++- .../post/RequestBody.md | 4 +- .../java/docs/paths/fakepemcontenttype/Get.md | 68 ++- .../fakepemcontenttype/get/RequestBody.md | 4 +- .../Post.md | 88 +++- ...adimagewithrequiredfilePostSecurityInfo.md | 4 +- .../post/RequestBody.md | 10 +- ...uiredfilePostSecurityRequirementObject0.md | 2 +- .../fakequeryparamwithjsoncontenttype/Get.md | 77 ++- .../java/docs/paths/fakeredirection/Get.md | 68 ++- .../java/docs/paths/fakerefobjinquery/Get.md | 65 ++- .../docs/paths/fakerefsarraymodel/Post.md | 68 ++- .../fakerefsarraymodel/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/fakerefsarrayofenums/Post.md | 68 ++- .../fakerefsarrayofenums/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../java/docs/paths/fakerefsboolean/Post.md | 68 ++- .../paths/fakerefsboolean/post/RequestBody.md | 4 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../Post.md | 68 ++- .../post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../java/docs/paths/fakerefsenum/Post.md | 68 ++- .../paths/fakerefsenum/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../java/docs/paths/fakerefsmammal/Post.md | 71 ++- .../paths/fakerefsmammal/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../java/docs/paths/fakerefsnumber/Post.md | 68 ++- .../paths/fakerefsnumber/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../fakerefsobjectmodelwithrefprops/Post.md | 68 ++- .../post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../java/docs/paths/fakerefsstring/Post.md | 68 ++- .../paths/fakerefsstring/post/RequestBody.md | 4 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../paths/fakeresponsewithoutschema/Get.md | 64 ++- .../docs/paths/faketestqueryparamters/Put.md | 102 +++- .../docs/paths/fakeuploaddownloadfile/Post.md | 76 ++- .../post/RequestBody.md | 4 +- .../java/docs/paths/fakeuploadfile/Post.md | 68 ++- .../paths/fakeuploadfile/post/RequestBody.md | 10 +- .../java/docs/paths/fakeuploadfiles/Post.md | 68 ++- .../paths/fakeuploadfiles/post/RequestBody.md | 10 +- .../docs/paths/fakewildcardresponses/Get.md | 85 ++- .../petstore/java/docs/paths/foo/Get.md | 64 ++- .../docs/paths/foo/get/FooGetServerInfo.md | 24 + .../petstore/java/docs/paths/pet/Post.md | 126 ++++- .../petstore/java/docs/paths/pet/Put.md | 122 ++++- .../paths/pet/post/PetPostSecurityInfo.md | 6 +- .../java/docs/paths/pet/post/RequestBody.md | 4 +- .../PetPostSecurityRequirementObject0.md | 2 +- .../PetPostSecurityRequirementObject1.md | 2 +- .../PetPostSecurityRequirementObject2.md | 2 +- .../docs/paths/pet/put/PetPutSecurityInfo.md | 5 +- .../java/docs/paths/pet/put/RequestBody.md | 4 +- .../PetPutSecurityRequirementObject0.md | 2 +- .../PetPutSecurityRequirementObject1.md | 2 +- .../java/docs/paths/petfindbystatus/Get.md | 96 +++- .../PetfindbystatusServerInfo.md | 24 + .../get/PetfindbystatusGetSecurityInfo.md | 6 +- ...ndbystatusGetSecurityRequirementObject0.md | 2 +- ...ndbystatusGetSecurityRequirementObject1.md | 2 +- ...ndbystatusGetSecurityRequirementObject2.md | 2 +- .../java/docs/paths/petfindbytags/Get.md | 94 +++- .../get/PetfindbytagsGetSecurityInfo.md | 5 +- ...findbytagsGetSecurityRequirementObject0.md | 2 +- ...findbytagsGetSecurityRequirementObject1.md | 2 +- .../java/docs/paths/petpetid/Delete.md | 92 +++- .../petstore/java/docs/paths/petpetid/Get.md | 99 +++- .../petstore/java/docs/paths/petpetid/Post.md | 92 +++- .../delete/PetpetidDeleteSecurityInfo.md | 5 +- ...etpetidDeleteSecurityRequirementObject0.md | 2 +- ...etpetidDeleteSecurityRequirementObject1.md | 2 +- .../petpetid/get/PetpetidGetSecurityInfo.md | 4 +- .../PetpetidGetSecurityRequirementObject0.md | 2 +- .../petpetid/post/PetpetidPostSecurityInfo.md | 5 +- .../docs/paths/petpetid/post/RequestBody.md | 10 +- .../PetpetidPostSecurityRequirementObject0.md | 2 +- .../PetpetidPostSecurityRequirementObject1.md | 2 +- .../docs/paths/petpetiduploadimage/Post.md | 88 +++- .../PetpetiduploadimagePostSecurityInfo.md | 4 +- .../petpetiduploadimage/post/RequestBody.md | 10 +- ...loadimagePostSecurityRequirementObject0.md | 2 +- .../petstore/java/docs/paths/solidus/Get.md | 64 ++- .../java/docs/paths/storeinventory/Get.md | 77 ++- .../get/StoreinventoryGetSecurityInfo.md | 4 +- ...einventoryGetSecurityRequirementObject0.md | 2 +- .../java/docs/paths/storeorder/Post.md | 98 +++- .../docs/paths/storeorder/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/storeorderorderid/Delete.md | 80 ++- .../java/docs/paths/storeorderorderid/Get.md | 88 +++- .../petstore/java/docs/paths/user/Post.md | 94 +++- .../java/docs/paths/user/post/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../docs/paths/usercreatewitharray/Post.md | 116 ++++- .../usercreatewitharray/post/RequestBody.md | 4 +- .../docs/paths/usercreatewithlist/Post.md | 116 ++++- .../usercreatewithlist/post/RequestBody.md | 4 +- .../petstore/java/docs/paths/userlogin/Get.md | 90 +++- .../java/docs/paths/userlogout/Get.md | 64 ++- .../java/docs/paths/userusername/Delete.md | 81 ++- .../java/docs/paths/userusername/Get.md | 88 +++- .../java/docs/paths/userusername/Put.md | 109 +++- .../paths/userusername/put/RequestBody.md | 10 +- .../applicationjson/ApplicationjsonSchema.md | 4 +- .../petstore/java/docs/servers/Server0.md | 491 +----------------- .../petstore/java/docs/servers/Server1.md | 360 +------------ .../client/RootServerInfo.java | 87 +--- .../headers/Int32JsonContentTypeHeader.java | 5 +- .../headers/RefContentSchemaHeader.java | 5 +- ...omponentRefSchemaStringWithValidation.java | 5 +- .../components/requestbodies/Client.java | 3 +- .../client/components/requestbodies/Pet.java | 3 +- .../components/requestbodies/UserArray.java | 3 +- .../ApplicationjsonSchema.java | 19 +- .../responses/HeadersWithNoBody.java | 6 +- .../responses/SuccessDescriptionOnly.java | 4 +- .../SuccessInlineContentAndHeader.java | 18 +- .../responses/SuccessWithJsonApiResponse.java | 18 +- .../SuccessfulXmlAndJsonArrayOfPet.java | 12 +- .../HeadersWithNoBodyHeadersSchema.java | 23 +- .../ApplicationjsonSchema.java | 19 +- .../applicationxml/ApplicationxmlSchema.java | 19 +- ...ssInlineContentAndHeaderHeadersSchema.java | 23 +- .../ApplicationjsonSchema.java | 23 +- ...ccessWithJsonApiResponseHeadersSchema.java | 27 +- .../schemas/AbstractStepMessage.java | 35 +- .../schemas/AdditionalPropertiesClass.java | 163 +++--- .../schemas/AdditionalPropertiesSchema.java | 177 ++++--- .../AdditionalPropertiesWithArrayOfEnums.java | 43 +- .../client/components/schemas/Address.java | 23 +- .../client/components/schemas/Animal.java | 43 +- .../client/components/schemas/AnimalFarm.java | 19 +- .../components/schemas/AnyTypeAndFormat.java | 453 ++++++++-------- .../components/schemas/AnyTypeNotString.java | 49 +- .../components/schemas/ApiResponseSchema.java | 27 +- .../client/components/schemas/Apple.java | 55 +- .../client/components/schemas/AppleReq.java | 27 +- .../schemas/ArrayHoldingAnyType.java | 17 +- .../schemas/ArrayOfArrayOfNumberOnly.java | 59 ++- .../components/schemas/ArrayOfEnums.java | 19 +- .../components/schemas/ArrayOfNumberOnly.java | 41 +- .../client/components/schemas/ArrayTest.java | 117 +++-- .../schemas/ArrayWithValidationsInItems.java | 33 +- .../client/components/schemas/Banana.java | 23 +- .../client/components/schemas/BananaReq.java | 27 +- .../client/components/schemas/Bar.java | 19 +- .../client/components/schemas/BasquePig.java | 37 +- .../components/schemas/BooleanEnum.java | 15 +- .../components/schemas/Capitalization.java | 33 +- .../client/components/schemas/Cat.java | 71 ++- .../client/components/schemas/Category.java | 43 +- .../client/components/schemas/ChildCat.java | 71 ++- .../client/components/schemas/ClassModel.java | 49 +- .../client/components/schemas/Client.java | 23 +- .../schemas/ComplexQuadrilateral.java | 85 ++- ...posedAnyOfDifferentTypesNoValidations.java | 65 ++- .../components/schemas/ComposedArray.java | 17 +- .../components/schemas/ComposedBool.java | 15 +- .../components/schemas/ComposedNone.java | 15 +- .../components/schemas/ComposedNumber.java | 15 +- .../components/schemas/ComposedObject.java | 21 +- .../schemas/ComposedOneOfDifferentTypes.java | 99 ++-- .../components/schemas/ComposedString.java | 15 +- .../client/components/schemas/Currency.java | 15 +- .../client/components/schemas/DanishPig.java | 37 +- .../components/schemas/DateTimeTest.java | 19 +- .../schemas/DateTimeWithValidations.java | 15 +- .../schemas/DateWithValidations.java | 15 +- .../client/components/schemas/Dog.java | 71 ++- .../client/components/schemas/Drawing.java | 49 +- .../client/components/schemas/EnumArrays.java | 71 ++- .../client/components/schemas/EnumClass.java | 19 +- .../client/components/schemas/EnumTest.java | 95 ++-- .../schemas/EquilateralTriangle.java | 85 ++- .../client/components/schemas/File.java | 23 +- .../schemas/FileSchemaTestClass.java | 43 +- .../client/components/schemas/Foo.java | 23 +- .../client/components/schemas/FormatTest.java | 193 ++++--- .../client/components/schemas/FromSchema.java | 25 +- .../client/components/schemas/Fruit.java | 51 +- .../client/components/schemas/FruitReq.java | 49 +- .../client/components/schemas/GmFruit.java | 51 +- .../components/schemas/GrandparentAnimal.java | 23 +- .../components/schemas/HasOnlyReadOnly.java | 25 +- .../components/schemas/HealthCheckResult.java | 39 +- .../components/schemas/IntegerEnum.java | 15 +- .../components/schemas/IntegerEnumBig.java | 15 +- .../schemas/IntegerEnumOneValue.java | 15 +- .../schemas/IntegerEnumWithDefaultValue.java | 15 +- .../components/schemas/IntegerMax10.java | 15 +- .../components/schemas/IntegerMin15.java | 15 +- .../components/schemas/IsoscelesTriangle.java | 85 ++- .../client/components/schemas/Items.java | 19 +- .../components/schemas/JSONPatchRequest.java | 65 ++- .../JSONPatchRequestAddReplaceTest.java | 45 +- .../schemas/JSONPatchRequestMoveCopy.java | 51 +- .../schemas/JSONPatchRequestRemove.java | 45 +- .../client/components/schemas/Mammal.java | 49 +- .../client/components/schemas/MapTest.java | 133 +++-- ...ropertiesAndAdditionalPropertiesClass.java | 45 +- .../client/components/schemas/Money.java | 25 +- .../components/schemas/MyObjectDto.java | 23 +- .../client/components/schemas/Name.java | 55 +- .../schemas/NoAdditionalProperties.java | 29 +- .../components/schemas/NullableClass.java | 383 +++++++------- .../components/schemas/NullableShape.java | 49 +- .../components/schemas/NullableString.java | 17 +- .../client/components/schemas/NumberOnly.java | 23 +- .../schemas/NumberWithExclusiveMinMax.java | 15 +- .../schemas/NumberWithValidations.java | 15 +- .../schemas/ObjWithRequiredProps.java | 23 +- .../schemas/ObjWithRequiredPropsBase.java | 23 +- .../ObjectModelWithArgAndArgsProperties.java | 25 +- .../schemas/ObjectModelWithRefProps.java | 27 +- ...hAllOfWithReqTestPropFromUnsetAddProp.java | 77 +-- .../ObjectWithCollidingProperties.java | 25 +- .../schemas/ObjectWithDecimalProperties.java | 27 +- .../ObjectWithDifficultlyNamedProps.java | 21 +- .../ObjectWithInlineCompositionProperty.java | 83 ++- ...ObjectWithInvalidNamedRefedProperties.java | 23 +- .../ObjectWithNonIntersectingValues.java | 27 +- .../schemas/ObjectWithOnlyOptionalProps.java | 27 +- .../schemas/ObjectWithOptionalTestProp.java | 23 +- .../schemas/ObjectWithValidations.java | 21 +- .../client/components/schemas/Order.java | 47 +- .../schemas/PaginatedResultMyObjectDto.java | 45 +- .../client/components/schemas/ParentPet.java | 21 +- .../client/components/schemas/Pet.java | 83 ++- .../client/components/schemas/Pig.java | 49 +- .../client/components/schemas/Player.java | 25 +- .../client/components/schemas/PublicKey.java | 23 +- .../components/schemas/Quadrilateral.java | 49 +- .../schemas/QuadrilateralInterface.java | 67 ++- .../components/schemas/ReadOnlyFirst.java | 25 +- .../schemas/ReqPropsFromExplicitAddProps.java | 29 +- .../schemas/ReqPropsFromTrueAddProps.java | 27 +- .../schemas/ReqPropsFromUnsetAddProps.java | 27 +- .../components/schemas/ReturnSchema.java | 49 +- .../components/schemas/ScaleneTriangle.java | 85 ++- .../components/schemas/Schema200Response.java | 51 +- .../schemas/SelfReferencingArrayModel.java | 19 +- .../schemas/SelfReferencingObjectModel.java | 25 +- .../client/components/schemas/Shape.java | 49 +- .../components/schemas/ShapeOrNull.java | 49 +- .../schemas/SimpleQuadrilateral.java | 85 ++- .../client/components/schemas/SomeObject.java | 49 +- .../components/schemas/SpecialModelname.java | 23 +- .../components/schemas/StringBooleanMap.java | 25 +- .../client/components/schemas/StringEnum.java | 17 +- .../schemas/StringEnumWithDefaultValue.java | 19 +- .../schemas/StringWithValidation.java | 15 +- .../client/components/schemas/Tag.java | 25 +- .../client/components/schemas/Triangle.java | 49 +- .../components/schemas/TriangleInterface.java | 67 ++- .../client/components/schemas/UUIDString.java | 15 +- .../client/components/schemas/User.java | 111 ++-- .../client/components/schemas/Whale.java | 41 +- .../client/components/schemas/Zebra.java | 53 +- .../configurations/ApiConfiguration.java | 170 +++--- .../client/exceptions/BaseException.java | 2 +- .../client/header/ContentHeader.java | 41 +- .../client/header/Header.java | 6 +- .../client/header/Rfc6570Serializer.java | 55 +- .../client/header/SchemaHeader.java | 16 +- .../client/header/StyleSerializer.java | 13 +- .../client/parameter/ContentParameter.java | 22 +- .../client/parameter/CookieSerializer.java | 3 +- .../client/parameter/HeadersSerializer.java | 3 +- .../client/parameter/Parameter.java | 3 +- .../client/parameter/PathSerializer.java | 3 +- .../client/parameter/QuerySerializer.java | 3 +- .../client/parameter/SchemaParameter.java | 5 +- .../client/paths/anotherfakedummy/Patch.java | 9 +- .../anotherfakedummy/patch/Responses.java | 4 +- .../patch/responses/Code200Response.java | 16 +- .../paths/commonparamsubdir/Delete.java | 9 +- .../client/paths/commonparamsubdir/Get.java | 9 +- .../client/paths/commonparamsubdir/Post.java | 9 +- .../delete/HeaderParameters.java | 23 +- .../delete/PathParameters.java | 29 +- .../commonparamsubdir/delete/Responses.java | 4 +- .../delete/parameters/parameter1/Schema1.java | 15 +- .../commonparamsubdir/get/PathParameters.java | 29 +- .../get/QueryParameters.java | 23 +- .../commonparamsubdir/get/Responses.java | 4 +- .../routeparameter0/RouteParamSchema0.java | 15 +- .../post/HeaderParameters.java | 23 +- .../post/PathParameters.java | 29 +- .../commonparamsubdir/post/Responses.java | 4 +- .../client/paths/fake/Delete.java | 9 +- .../client/paths/fake/Get.java | 9 +- .../client/paths/fake/Patch.java | 9 +- .../client/paths/fake/Post.java | 9 +- .../fake/delete/FakeDeleteSecurityInfo.java | 13 +- .../paths/fake/delete/HeaderParameters.java | 25 +- .../paths/fake/delete/QueryParameters.java | 29 +- .../client/paths/fake/delete/Responses.java | 4 +- .../delete/parameters/parameter1/Schema1.java | 15 +- .../delete/parameters/parameter4/Schema4.java | 15 +- .../paths/fake/get/HeaderParameters.java | 25 +- .../paths/fake/get/QueryParameters.java | 29 +- .../client/paths/fake/get/RequestBody.java | 3 +- .../client/paths/fake/get/Responses.java | 4 +- .../get/parameters/parameter0/Schema0.java | 37 +- .../get/parameters/parameter1/Schema1.java | 19 +- .../get/parameters/parameter2/Schema2.java | 37 +- .../get/parameters/parameter3/Schema3.java | 19 +- .../get/parameters/parameter4/Schema4.java | 15 +- .../get/parameters/parameter5/Schema5.java | 15 +- .../ApplicationxwwwformurlencodedSchema.java | 79 ++- .../fake/get/responses/Code404Response.java | 16 +- .../client/paths/fake/patch/Responses.java | 4 +- .../fake/patch/responses/Code200Response.java | 16 +- .../paths/fake/post/FakePostSecurityInfo.java | 13 +- .../client/paths/fake/post/RequestBody.java | 3 +- .../client/paths/fake/post/Responses.java | 4 +- .../ApplicationxwwwformurlencodedSchema.java | 167 +++--- .../fake/post/responses/Code404Response.java | 4 +- .../Get.java | 9 +- .../get/RequestBody.java | 3 +- .../get/Responses.java | 4 +- .../get/responses/Code200Response.java | 16 +- .../paths/fakebodywithfileschema/Put.java | 9 +- .../put/RequestBody.java | 3 +- .../fakebodywithfileschema/put/Responses.java | 4 +- .../paths/fakebodywithqueryparams/Put.java | 9 +- .../put/QueryParameters.java | 29 +- .../put/RequestBody.java | 3 +- .../put/Responses.java | 4 +- .../paths/fakecasesensitiveparams/Put.java | 9 +- .../put/QueryParameters.java | 27 +- .../put/Responses.java | 4 +- .../client/paths/fakeclassnametest/Patch.java | 9 +- .../FakeclassnametestPatchSecurityInfo.java | 13 +- .../fakeclassnametest/patch/Responses.java | 4 +- .../patch/responses/Code200Response.java | 16 +- .../paths/fakedeletecoffeeid/Delete.java | 9 +- .../delete/PathParameters.java | 29 +- .../fakedeletecoffeeid/delete/Responses.java | 4 +- .../delete/responses/CodedefaultResponse.java | 4 +- .../client/paths/fakehealth/Get.java | 9 +- .../paths/fakehealth/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 16 +- .../fakeinlineadditionalproperties/Post.java | 9 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../ApplicationjsonSchema.java | 23 +- .../paths/fakeinlinecomposition/Post.java | 9 +- .../post/QueryParameters.java | 25 +- .../post/RequestBody.java | 3 +- .../fakeinlinecomposition/post/Responses.java | 4 +- .../post/parameters/parameter0/Schema0.java | 63 ++- .../post/parameters/parameter1/Schema1.java | 83 ++- .../ApplicationjsonSchema.java | 63 ++- .../MultipartformdataSchema.java | 83 ++- .../post/responses/Code200Response.java | 12 +- .../ApplicationjsonSchema.java | 63 ++- .../MultipartformdataSchema.java | 83 ++- .../client/paths/fakejsonformdata/Get.java | 9 +- .../fakejsonformdata/get/RequestBody.java | 3 +- .../paths/fakejsonformdata/get/Responses.java | 4 +- .../ApplicationxwwwformurlencodedSchema.java | 25 +- .../client/paths/fakejsonpatch/Patch.java | 9 +- .../fakejsonpatch/patch/RequestBody.java | 3 +- .../paths/fakejsonpatch/patch/Responses.java | 4 +- .../paths/fakejsonwithcharset/Post.java | 9 +- .../fakejsonwithcharset/post/RequestBody.java | 3 +- .../fakejsonwithcharset/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../Post.java | 9 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../ApplicationjsonSchema.java | 23 +- .../MultipartformdataSchema.java | 23 +- .../post/responses/Code200Response.java | 16 +- .../paths/fakemultipleresponsebodies/Get.java | 9 +- .../get/Responses.java | 4 +- .../get/responses/Code200Response.java | 16 +- .../get/responses/Code202Response.java | 16 +- .../paths/fakemultiplesecurities/Get.java | 9 +- ...FakemultiplesecuritiesGetSecurityInfo.java | 26 +- .../fakemultiplesecurities/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 16 +- .../client/paths/fakeobjinquery/Get.java | 9 +- .../fakeobjinquery/get/QueryParameters.java | 23 +- .../paths/fakeobjinquery/get/Responses.java | 4 +- .../get/parameters/parameter0/Schema0.java | 23 +- .../Post.java | 9 +- .../post/CookieParameters.java | 27 +- .../post/HeaderParameters.java | 25 +- .../post/PathParameters.java | 27 +- .../post/QueryParameters.java | 27 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakepemcontenttype/Get.java | 9 +- .../fakepemcontenttype/get/RequestBody.java | 3 +- .../fakepemcontenttype/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 16 +- .../Post.java | 9 +- ...imagewithrequiredfilePostSecurityInfo.java | 13 +- .../post/PathParameters.java | 29 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../MultipartformdataSchema.java | 25 +- .../post/responses/Code200Response.java | 16 +- .../Get.java | 9 +- .../get/QueryParameters.java | 29 +- .../get/Responses.java | 4 +- .../get/parameters/Parameter0.java | 5 +- .../get/responses/Code200Response.java | 16 +- .../client/paths/fakeredirection/Get.java | 9 +- .../paths/fakeredirection/get/Responses.java | 4 +- .../get/responses/Code303Response.java | 4 +- .../get/responses/Code3XXResponse.java | 4 +- .../client/paths/fakerefobjinquery/Get.java | 9 +- .../get/QueryParameters.java | 23 +- .../fakerefobjinquery/get/Responses.java | 4 +- .../client/paths/fakerefsarraymodel/Post.java | 9 +- .../fakerefsarraymodel/post/RequestBody.java | 3 +- .../fakerefsarraymodel/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../paths/fakerefsarrayofenums/Post.java | 9 +- .../post/RequestBody.java | 3 +- .../fakerefsarrayofenums/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakerefsboolean/Post.java | 9 +- .../fakerefsboolean/post/RequestBody.java | 3 +- .../paths/fakerefsboolean/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../Post.java | 9 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakerefsenum/Post.java | 9 +- .../paths/fakerefsenum/post/RequestBody.java | 3 +- .../paths/fakerefsenum/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakerefsmammal/Post.java | 9 +- .../fakerefsmammal/post/RequestBody.java | 3 +- .../paths/fakerefsmammal/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakerefsnumber/Post.java | 9 +- .../fakerefsnumber/post/RequestBody.java | 3 +- .../paths/fakerefsnumber/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../fakerefsobjectmodelwithrefprops/Post.java | 9 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakerefsstring/Post.java | 9 +- .../fakerefsstring/post/RequestBody.java | 3 +- .../paths/fakerefsstring/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../paths/fakeresponsewithoutschema/Get.java | 9 +- .../get/Responses.java | 4 +- .../get/responses/Code200Response.java | 4 +- .../paths/faketestqueryparamters/Put.java | 9 +- .../put/QueryParameters.java | 33 +- .../faketestqueryparamters/put/Responses.java | 4 +- .../put/parameters/parameter0/Schema0.java | 19 +- .../put/parameters/parameter1/Schema1.java | 19 +- .../put/parameters/parameter2/Schema2.java | 19 +- .../put/parameters/parameter3/Schema3.java | 19 +- .../put/parameters/parameter4/Schema4.java | 19 +- .../paths/fakeuploaddownloadfile/Post.java | 9 +- .../post/RequestBody.java | 3 +- .../post/Responses.java | 4 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakeuploadfile/Post.java | 9 +- .../fakeuploadfile/post/RequestBody.java | 3 +- .../paths/fakeuploadfile/post/Responses.java | 4 +- .../MultipartformdataSchema.java | 25 +- .../post/responses/Code200Response.java | 16 +- .../client/paths/fakeuploadfiles/Post.java | 9 +- .../fakeuploadfiles/post/RequestBody.java | 3 +- .../paths/fakeuploadfiles/post/Responses.java | 4 +- .../MultipartformdataSchema.java | 41 +- .../post/responses/Code200Response.java | 16 +- .../paths/fakewildcardresponses/Get.java | 9 +- .../fakewildcardresponses/get/Responses.java | 4 +- .../get/responses/Code1XXResponse.java | 16 +- .../get/responses/Code200Response.java | 16 +- .../get/responses/Code2XXResponse.java | 16 +- .../get/responses/Code3XXResponse.java | 16 +- .../get/responses/Code4XXResponse.java | 16 +- .../get/responses/Code5XXResponse.java | 16 +- .../client/paths/foo/Get.java | 9 +- .../paths/foo/get/FooGetServerInfo.java | 74 +-- .../client/paths/foo/get/Responses.java | 4 +- .../get/responses/CodedefaultResponse.java | 16 +- .../ApplicationjsonSchema.java | 21 +- .../paths/foo/get/servers/FooGetServer1.java | 20 +- .../foo/get/servers/server1/Variables.java | 47 +- .../client/paths/pet/Post.java | 9 +- .../client/paths/pet/Put.java | 9 +- .../paths/pet/post/PetPostSecurityInfo.java | 26 +- .../client/paths/pet/post/Responses.java | 4 +- .../pet/post/responses/Code405Response.java | 4 +- .../paths/pet/put/PetPutSecurityInfo.java | 21 +- .../client/paths/pet/put/Responses.java | 4 +- .../pet/put/responses/Code400Response.java | 4 +- .../pet/put/responses/Code404Response.java | 4 +- .../pet/put/responses/Code405Response.java | 4 +- .../client/paths/petfindbystatus/Get.java | 9 +- .../PetfindbystatusServerInfo.java | 74 +-- .../get/PetfindbystatusGetSecurityInfo.java | 26 +- .../petfindbystatus/get/QueryParameters.java | 29 +- .../paths/petfindbystatus/get/Responses.java | 4 +- .../get/parameters/parameter0/Schema0.java | 37 +- .../get/responses/Code400Response.java | 4 +- .../servers/PetfindbystatusServer1.java | 20 +- .../servers/server1/Variables.java | 47 +- .../client/paths/petfindbytags/Get.java | 9 +- .../get/PetfindbytagsGetSecurityInfo.java | 21 +- .../petfindbytags/get/QueryParameters.java | 29 +- .../paths/petfindbytags/get/Responses.java | 4 +- .../get/parameters/parameter0/Schema0.java | 19 +- .../get/responses/Code400Response.java | 4 +- .../client/paths/petpetid/Delete.java | 9 +- .../client/paths/petpetid/Get.java | 9 +- .../client/paths/petpetid/Post.java | 9 +- .../petpetid/delete/HeaderParameters.java | 23 +- .../paths/petpetid/delete/PathParameters.java | 29 +- .../delete/PetpetidDeleteSecurityInfo.java | 21 +- .../paths/petpetid/delete/Responses.java | 4 +- .../delete/responses/Code400Response.java | 4 +- .../paths/petpetid/get/PathParameters.java | 29 +- .../petpetid/get/PetpetidGetSecurityInfo.java | 13 +- .../client/paths/petpetid/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 12 +- .../get/responses/Code400Response.java | 4 +- .../get/responses/Code404Response.java | 4 +- .../paths/petpetid/post/PathParameters.java | 29 +- .../post/PetpetidPostSecurityInfo.java | 21 +- .../paths/petpetid/post/RequestBody.java | 3 +- .../client/paths/petpetid/post/Responses.java | 4 +- .../ApplicationxwwwformurlencodedSchema.java | 25 +- .../post/responses/Code405Response.java | 4 +- .../paths/petpetiduploadimage/Post.java | 9 +- .../post/PathParameters.java | 29 +- .../PetpetiduploadimagePostSecurityInfo.java | 13 +- .../petpetiduploadimage/post/RequestBody.java | 3 +- .../petpetiduploadimage/post/Responses.java | 4 +- .../MultipartformdataSchema.java | 25 +- .../client/paths/solidus/Get.java | 9 +- .../client/paths/solidus/get/Responses.java | 4 +- .../client/paths/storeinventory/Get.java | 9 +- .../paths/storeinventory/get/Responses.java | 4 +- .../get/StoreinventoryGetSecurityInfo.java | 13 +- .../client/paths/storeorder/Post.java | 9 +- .../paths/storeorder/post/RequestBody.java | 3 +- .../paths/storeorder/post/Responses.java | 4 +- .../post/responses/Code200Response.java | 12 +- .../post/responses/Code400Response.java | 4 +- .../paths/storeorderorderid/Delete.java | 9 +- .../client/paths/storeorderorderid/Get.java | 9 +- .../delete/PathParameters.java | 29 +- .../storeorderorderid/delete/Responses.java | 4 +- .../delete/responses/Code400Response.java | 4 +- .../delete/responses/Code404Response.java | 4 +- .../storeorderorderid/get/PathParameters.java | 29 +- .../storeorderorderid/get/Responses.java | 4 +- .../get/parameters/parameter0/Schema0.java | 15 +- .../get/responses/Code200Response.java | 12 +- .../get/responses/Code400Response.java | 4 +- .../get/responses/Code404Response.java | 4 +- .../client/paths/user/Post.java | 9 +- .../client/paths/user/post/RequestBody.java | 3 +- .../client/paths/user/post/Responses.java | 4 +- .../post/responses/CodedefaultResponse.java | 4 +- .../paths/usercreatewitharray/Post.java | 9 +- .../usercreatewitharray/post/Responses.java | 4 +- .../post/responses/CodedefaultResponse.java | 4 +- .../client/paths/usercreatewithlist/Post.java | 9 +- .../usercreatewithlist/post/Responses.java | 4 +- .../post/responses/CodedefaultResponse.java | 4 +- .../client/paths/userlogin/Get.java | 9 +- .../paths/userlogin/get/QueryParameters.java | 25 +- .../client/paths/userlogin/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 14 +- .../get/responses/Code400Response.java | 4 +- .../Code200ResponseHeadersSchema.java | 25 +- .../code200response/headers/XRateLimit.java | 5 +- .../client/paths/userlogout/Get.java | 9 +- .../paths/userlogout/get/Responses.java | 4 +- .../client/paths/userusername/Delete.java | 9 +- .../client/paths/userusername/Get.java | 9 +- .../client/paths/userusername/Put.java | 9 +- .../userusername/delete/PathParameters.java | 29 +- .../paths/userusername/delete/Responses.java | 4 +- .../delete/responses/Code404Response.java | 4 +- .../userusername/get/PathParameters.java | 29 +- .../paths/userusername/get/Responses.java | 4 +- .../get/responses/Code200Response.java | 12 +- .../get/responses/Code400Response.java | 4 +- .../get/responses/Code404Response.java | 4 +- .../userusername/put/PathParameters.java | 29 +- .../paths/userusername/put/RequestBody.java | 3 +- .../paths/userusername/put/Responses.java | 4 +- .../put/responses/Code400Response.java | 4 +- .../put/responses/Code404Response.java | 4 +- .../requestbody/RequestBodySerializer.java | 7 +- .../client/response/HeadersDeserializer.java | 4 +- .../client/response/ResponseDeserializer.java | 37 +- .../response/ResponsesDeserializer.java | 5 +- .../client/schemas/AnyTypeJsonSchema.java | 49 +- .../client/schemas/BooleanJsonSchema.java | 15 +- .../client/schemas/DateJsonSchema.java | 17 +- .../client/schemas/DateTimeJsonSchema.java | 17 +- .../client/schemas/DecimalJsonSchema.java | 15 +- .../client/schemas/DoubleJsonSchema.java | 17 +- .../client/schemas/FloatJsonSchema.java | 17 +- .../client/schemas/Int32JsonSchema.java | 19 +- .../client/schemas/Int64JsonSchema.java | 21 +- .../client/schemas/IntJsonSchema.java | 21 +- .../client/schemas/ListJsonSchema.java | 19 +- .../client/schemas/MapJsonSchema.java | 21 +- .../client/schemas/NotAnyTypeJsonSchema.java | 49 +- .../client/schemas/NullJsonSchema.java | 15 +- .../client/schemas/NumberJsonSchema.java | 25 +- .../client/schemas/StringJsonSchema.java | 17 +- .../client/schemas/UuidJsonSchema.java | 17 +- .../AdditionalPropertiesValidator.java | 4 +- .../schemas/validation/AllOfValidator.java | 4 +- .../schemas/validation/AnyOfValidator.java | 2 +- .../validation/BigDecimalValidator.java | 2 +- .../validation/BooleanEnumValidator.java | 3 +- .../validation/BooleanSchemaValidator.java | 5 +- .../schemas/validation/ConstValidator.java | 2 +- .../schemas/validation/ContainsValidator.java | 2 +- .../validation/DefaultValueMethod.java | 4 +- .../DependentRequiredValidator.java | 2 +- .../validation/DependentSchemasValidator.java | 3 +- .../validation/DoubleEnumValidator.java | 3 +- .../schemas/validation/ElseValidator.java | 3 +- .../schemas/validation/EnumValidator.java | 2 +- .../validation/ExclusiveMaximumValidator.java | 2 +- .../validation/ExclusiveMinimumValidator.java | 2 +- .../validation/FloatEnumValidator.java | 3 +- .../schemas/validation/FormatValidator.java | 6 +- .../schemas/validation/IfValidator.java | 2 +- .../validation/IntegerEnumValidator.java | 3 +- .../schemas/validation/ItemsValidator.java | 3 +- .../client/schemas/validation/JsonSchema.java | 27 +- .../validation/ListSchemaValidator.java | 7 +- .../schemas/validation/LongEnumValidator.java | 3 +- .../validation/MapSchemaValidator.java | 7 +- .../validation/MaxContainsValidator.java | 2 +- .../schemas/validation/MaxItemsValidator.java | 2 +- .../validation/MaxLengthValidator.java | 2 +- .../validation/MaxPropertiesValidator.java | 2 +- .../schemas/validation/MaximumValidator.java | 2 +- .../validation/MinContainsValidator.java | 2 +- .../schemas/validation/MinItemsValidator.java | 2 +- .../validation/MinLengthValidator.java | 2 +- .../validation/MinPropertiesValidator.java | 2 +- .../schemas/validation/MinimumValidator.java | 2 +- .../validation/MultipleOfValidator.java | 2 +- .../schemas/validation/NotValidator.java | 2 +- .../schemas/validation/NullEnumValidator.java | 3 +- .../validation/NullSchemaValidator.java | 8 +- .../validation/NumberSchemaValidator.java | 5 +- .../schemas/validation/OneOfValidator.java | 2 +- .../schemas/validation/PatternValidator.java | 2 +- .../validation/PrefixItemsValidator.java | 3 +- .../validation/PropertiesValidator.java | 3 +- .../validation/PropertyNamesValidator.java | 3 +- .../schemas/validation/RequiredValidator.java | 4 +- .../validation/StringEnumValidator.java | 3 +- .../validation/StringSchemaValidator.java | 5 +- .../schemas/validation/ThenValidator.java | 3 +- .../schemas/validation/TypeValidator.java | 4 +- .../validation/UnevaluatedItemsValidator.java | 3 +- .../UnevaluatedPropertiesValidator.java | 6 +- .../validation/UniqueItemsValidator.java | 4 +- .../validation/UnsetAnyTypeJsonSchema.java | 49 +- .../SecurityRequirementObjectProvider.java | 5 +- .../client/servers/Server0.java | 20 +- .../client/servers/Server1.java | 20 +- .../client/servers/ServerProvider.java | 4 +- .../client/servers/server0/Variables.java | 63 ++- .../client/servers/server1/Variables.java | 47 +- .../client/header/ContentHeaderTest.java | 7 +- .../client/header/SchemaHeaderTest.java | 9 +- .../parameter/CookieSerializerTest.java | 3 +- .../parameter/HeadersSerializerTest.java | 3 +- .../client/parameter/PathSerializerTest.java | 3 +- .../client/parameter/QuerySerializerTest.java | 3 +- .../SchemaNonQueryParameterTest.java | 18 +- .../parameter/SchemaQueryParameterTest.java | 10 +- .../RequestBodySerializerTest.java | 8 +- .../response/ResponseDeserializerTest.java | 21 +- .../client/schemas/AnyTypeSchemaTest.java | 23 +- .../client/schemas/ArrayTypeSchemaTest.java | 45 +- .../client/schemas/BooleanSchemaTest.java | 7 +- .../client/schemas/ListSchemaTest.java | 4 +- .../client/schemas/MapSchemaTest.java | 4 +- .../client/schemas/NullSchemaTest.java | 5 +- .../client/schemas/NumberSchemaTest.java | 10 +- .../client/schemas/ObjectTypeSchemaTest.java | 87 ++-- .../client/schemas/RefBooleanSchemaTest.java | 7 +- .../AdditionalPropertiesValidatorTest.java | 14 +- .../validation/FormatValidatorTest.java | 28 +- .../validation/ItemsValidatorTest.java | 13 +- .../schemas/validation/JsonSchemaTest.java | 11 +- .../validation/PropertiesValidatorTest.java | 15 +- .../validation/RequiredValidatorTest.java | 13 +- .../schemas/validation/TypeValidatorTest.java | 2 +- .../petstore/python/.openapi-generator/FILES | 4 + .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../application_json_patchjson/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../docs/paths/foo/get/servers/server_0.md | 4 + .../docs/paths/foo/get/servers/server_1.md | 9 + .../pet_find_by_status/servers/server_0.md | 4 + .../pet_find_by_status/servers/server_1.md | 9 + .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- .../content/application_json/schema.md | 2 +- 1621 files changed, 21090 insertions(+), 16938 deletions(-) create mode 100644 samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java create mode 100644 samples/client/petstore/python/docs/paths/foo/get/servers/server_0.md create mode 100644 samples/client/petstore/python/docs/paths/foo/get/servers/server_1.md create mode 100644 samples/client/petstore/python/docs/paths/pet_find_by_status/servers/server_0.md create mode 100644 samples/client/petstore/python/docs/paths/pet_find_by_status/servers/server_1.md diff --git a/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES b/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES index d2ab4d20baf..fb6c2ec5ba4 100644 --- a/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES +++ b/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES @@ -187,7 +187,7 @@ src/main/java/org/openapijsonschematools/client/contenttype/ContentTypeSerialize src/main/java/org/openapijsonschematools/client/exceptions/ApiException.java src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.java -src/main/java/org/openapijsonschematools/client/exceptions/InvalidTypeException.java +src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java src/main/java/org/openapijsonschematools/client/exceptions/UnsetPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/ValidationException.java src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -318,93 +318,6 @@ src/main/java/org/openapijsonschematools/client/servers/Server0.java src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java src/main/java/org/openapijsonschematools/client/servers/ServerWithVariables.java src/main/java/org/openapijsonschematools/client/servers/ServerWithoutVariables.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java src/test/java/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.java src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java diff --git a/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md b/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md index e1624a56d1f..02e74ac57a6 100644 --- a/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md +++ b/samples/client/3_0_3_unit_test/java/docs/RootServerInfo.md @@ -4,13 +4,36 @@ RootServerInfo.java public class RootServerInfo A class that provides a server, and any needed server info classes +- a class that is a 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 | | 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()
Creates an instance using default server variable values | +| RootServerInfo1(@Nullable [Server0](servers/Server0.md) server0)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [Server0](servers/Server0.md) | server0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + ## ServerIndex enum ServerIndex
diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java index d5c2f5cb5fd..7194d05eda1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java @@ -1,73 +1,33 @@ package org.openapijsonschematools.client; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server; import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.AbstractMap; -import java.util.Map; import java.util.Objects; -import java.util.EnumMap; -public class RootServerInfo implements ServerProvider { - final private Servers servers; - final private ServerIndex serverIndex; +public class RootServerInfo { + public static class RootServerInfo1 implements ServerProvider { + public final Server0 server0; - public RootServerInfo() { - this.servers = new Servers(); - this.serverIndex = ServerIndex.SERVER_0; - } - - public RootServerInfo(Servers servers, ServerIndex serverIndex) { - this.servers = servers; - this.serverIndex = serverIndex; - } - - public static class Servers { - private final EnumMap servers; - - public Servers() { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - new Server0() - ) - ) - ); + public RootServerInfo1() { + server0 = new Server0(); } - public Servers( + public RootServerInfo1( @Nullable Server0 server0 ) { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - Objects.requireNonNullElseGet(server0, Server0::new) - ) - ) - ); + this.server0 = Objects.requireNonNullElseGet(server0, Server0::new); } - public Server get(ServerIndex serverIndex) { - if (servers.containsKey(serverIndex)) { - return get(serverIndex); - } - throw new UnsetPropertyException(serverIndex+" is unset"); + @Override + public Server getServer(ServerIndex serverIndex) { + return server0; } } public enum ServerIndex { SERVER_0 } - - public Server getServer(@Nullable ServerIndex serverIndex) { - if (serverIndex == null) { - return servers.get(this.serverIndex); - } - return servers.get(serverIndex); - } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java index b91c994ef9b..abb7b8d36d1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -88,7 +87,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException, throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (boolean) value; } @@ -299,7 +298,7 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(Ma for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -307,7 +306,7 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(Ma Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -317,7 +316,7 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getNewInstance(Ma return new AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(castProperties); } - public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -329,29 +328,29 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index e6517f75b10..e9d0e2c6990 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -309,7 +308,7 @@ public static AdditionalpropertiesAreAllowedByDefault1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -321,7 +320,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -333,7 +332,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -344,24 +343,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -393,7 +392,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -420,7 +419,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(Map arg, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -428,7 +427,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(Map arg, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -438,7 +437,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(Map arg, return new AdditionalpropertiesAreAllowedByDefaultMap(castProperties); } - public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -450,7 +449,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, Schema } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -465,10 +464,10 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, Schema } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -483,34 +482,34 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, Schema } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedNumber(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedString(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedList(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -526,7 +525,7 @@ public AdditionalpropertiesAreAllowedByDefault1Boxed validateAndBox(@Nullable Ob } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index 649e69307db..44a6b34fe91 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -53,7 +52,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new InvalidTypeException("Value may not be null"); + throw new RuntimeException("Value may not be null"); } return (boolean) value; } @@ -133,7 +132,7 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(Map arg, Lis for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -141,12 +140,12 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(Map arg, Lis Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -154,7 +153,7 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(Map arg, Lis return new AdditionalpropertiesCanExistByItselfMap(castProperties); } - public AdditionalpropertiesCanExistByItselfMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesCanExistByItselfMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -166,29 +165,29 @@ public AdditionalpropertiesCanExistByItselfMap validate(Map arg, SchemaCon @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalpropertiesCanExistByItself1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesCanExistByItself1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesCanExistByItself1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalpropertiesCanExistByItself1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesCanExistByItself1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java index 46155636adf..5a1a80b1f09 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -236,7 +235,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +247,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -260,7 +259,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -271,24 +270,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -320,7 +319,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -347,7 +346,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -355,7 +354,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -365,7 +364,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -377,7 +376,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -392,10 +391,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -410,34 +409,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -453,7 +452,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -471,7 +470,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new InvalidTypeException("Value may not be null"); + throw new RuntimeException("Value may not be null"); } return (boolean) value; } @@ -584,7 +583,7 @@ public static AdditionalpropertiesShouldNotLookInApplicators1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -596,7 +595,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -608,7 +607,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -619,24 +618,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -668,7 +667,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -695,7 +694,7 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(Map entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -703,12 +702,12 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(Map, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -716,7 +715,7 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap getNewInstance(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesShouldNotLookInApplicatorsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -728,7 +727,7 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap validate(Map arg, } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -743,10 +742,10 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap validate(Map arg, } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -761,34 +760,34 @@ public AdditionalpropertiesShouldNotLookInApplicatorsMap validate(Map arg, } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean(validate(arg, configuration)); } @Override - public AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber(validate(arg, configuration)); } @Override - public AdditionalpropertiesShouldNotLookInApplicators1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesShouldNotLookInApplicators1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesShouldNotLookInApplicators1BoxedString(validate(arg, configuration)); } @Override - public AdditionalpropertiesShouldNotLookInApplicators1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesShouldNotLookInApplicators1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesShouldNotLookInApplicators1BoxedList(validate(arg, configuration)); } @Override - public AdditionalpropertiesShouldNotLookInApplicators1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesShouldNotLookInApplicators1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesShouldNotLookInApplicators1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalpropertiesShouldNotLookInApplicators1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesShouldNotLookInApplicators1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -804,7 +803,7 @@ public AdditionalpropertiesShouldNotLookInApplicators1Boxed validateAndBox(@Null } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index f2c3bac9dfb..e6ea2375397 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -65,7 +64,7 @@ public static Schema0Map of(Map arg, SchemaC public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -211,7 +210,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,7 +222,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,7 +234,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,24 +245,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -295,7 +294,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -322,7 +321,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +329,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -340,7 +339,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -352,7 +351,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -367,10 +366,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,34 +384,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -428,7 +427,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -458,7 +457,7 @@ public static Schema1Map of(Map arg, SchemaC public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -586,7 +585,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -598,7 +597,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -610,7 +609,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -621,24 +620,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -670,7 +669,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -697,7 +696,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +704,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -715,7 +714,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -727,7 +726,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -742,10 +741,10 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,34 +759,34 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -803,7 +802,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -880,7 +879,7 @@ public static Allof1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -892,7 +891,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -904,7 +903,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -915,24 +914,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -964,7 +963,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -991,7 +990,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +998,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1009,7 +1008,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1021,7 +1020,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1036,10 +1035,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,34 +1053,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Allof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedVoid(validate(arg, configuration)); } @Override - public Allof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedBoolean(validate(arg, configuration)); } @Override - public Allof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedNumber(validate(arg, configuration)); } @Override - public Allof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedString(validate(arg, configuration)); } @Override - public Allof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedList(validate(arg, configuration)); } @Override - public Allof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedMap(validate(arg, configuration)); } @Override - public Allof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1097,7 +1096,7 @@ public Allof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index e17daac12ce..856d9d3abfb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -100,7 +99,7 @@ public static Schema02 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -124,7 +123,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,24 +134,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -211,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -229,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +240,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -256,10 +255,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -274,34 +273,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema02BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedVoid(validate(arg, configuration)); } @Override - public Schema02BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedBoolean(validate(arg, configuration)); } @Override - public Schema02BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedNumber(validate(arg, configuration)); } @Override - public Schema02BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedString(validate(arg, configuration)); } @Override - public Schema02BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedList(validate(arg, configuration)); } @Override - public Schema02BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedMap(validate(arg, configuration)); } @Override - public Schema02Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -317,7 +316,7 @@ public Schema02Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -385,7 +384,7 @@ public static Schema01 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -397,7 +396,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -409,7 +408,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -420,24 +419,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -469,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -504,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -514,7 +513,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -526,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -541,10 +540,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -559,34 +558,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedVoid(validate(arg, configuration)); } @Override - public Schema01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedBoolean(validate(arg, configuration)); } @Override - public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedNumber(validate(arg, configuration)); } @Override - public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedString(validate(arg, configuration)); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedMap(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -602,7 +601,7 @@ public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -670,7 +669,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -682,7 +681,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -694,7 +693,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -705,24 +704,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -754,7 +753,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -781,7 +780,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -789,7 +788,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -799,7 +798,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -811,7 +810,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -826,10 +825,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -844,34 +843,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -887,7 +886,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -969,7 +968,7 @@ public static AllofCombinedWithAnyofOneof1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -981,7 +980,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -993,7 +992,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1004,24 +1003,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1053,7 +1052,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1080,7 +1079,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1088,7 +1087,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1098,7 +1097,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1110,7 +1109,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1125,10 +1124,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1143,34 +1142,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofCombinedWithAnyofOneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedVoid(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedNumber(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedString(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedList(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedMap(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1186,7 +1185,7 @@ public AllofCombinedWithAnyofOneof1Boxed validateAndBox(@Nullable Object arg, Sc } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index 4c9d473a2f9..9ce014d0248 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -99,7 +98,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -111,7 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -134,24 +133,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -210,7 +209,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -255,10 +254,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,34 +272,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -316,7 +315,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -384,7 +383,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -396,7 +395,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -408,7 +407,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,24 +418,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -468,7 +467,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -495,7 +494,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +502,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -513,7 +512,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -540,10 +539,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,34 +557,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -601,7 +600,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -678,7 +677,7 @@ public static AllofSimpleTypes1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -690,7 +689,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -702,7 +701,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -713,24 +712,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -762,7 +761,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -789,7 +788,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -797,7 +796,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -807,7 +806,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -819,7 +818,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -834,10 +833,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -852,34 +851,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofSimpleTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedVoid(validate(arg, configuration)); } @Override - public AllofSimpleTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofSimpleTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedNumber(validate(arg, configuration)); } @Override - public AllofSimpleTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedString(validate(arg, configuration)); } @Override - public AllofSimpleTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedList(validate(arg, configuration)); } @Override - public AllofSimpleTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedMap(validate(arg, configuration)); } @Override - public AllofSimpleTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -895,7 +894,7 @@ public AllofSimpleTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfigu } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index a67e189c9e4..698b971ecc6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +65,7 @@ public static Schema0Map of(Map arg, SchemaC public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -194,7 +193,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,7 +205,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,7 +217,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -229,24 +228,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -278,7 +277,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -305,7 +304,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -313,7 +312,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -323,7 +322,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -335,7 +334,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -350,10 +349,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -368,34 +367,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -411,7 +410,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -441,7 +440,7 @@ public static Schema1Map of(Map arg, SchemaC public Void baz() { @Nullable Object value = get("baz"); if (!(value == null || value instanceof Void)) { - throw new InvalidTypeException("Invalid value stored for baz"); + throw new RuntimeException("Invalid value stored for baz"); } return (Void) value; } @@ -569,7 +568,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -581,7 +580,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -593,7 +592,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -604,24 +603,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -653,7 +652,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -680,7 +679,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -688,7 +687,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -698,7 +697,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -710,7 +709,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -725,10 +724,10 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -743,34 +742,34 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -786,7 +785,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -816,7 +815,7 @@ public static AllofWithBaseSchemaMap of(Map public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -972,7 +971,7 @@ public static AllofWithBaseSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -984,7 +983,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -996,7 +995,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1007,24 +1006,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1056,7 +1055,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1083,7 +1082,7 @@ public AllofWithBaseSchemaMap getNewInstance(Map arg, List pathToI for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1091,7 +1090,7 @@ public AllofWithBaseSchemaMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1101,7 +1100,7 @@ public AllofWithBaseSchemaMap getNewInstance(Map arg, List pathToI return new AllofWithBaseSchemaMap(castProperties); } - public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1113,7 +1112,7 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration config } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1128,10 +1127,10 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration config } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1146,34 +1145,34 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration config } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofWithBaseSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedVoid(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedNumber(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedString(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedList(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedMap(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1189,7 +1188,7 @@ public AllofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index 6ad17067551..5d05360f9f3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -119,7 +118,7 @@ public static AllofWithOneEmptySchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,7 +130,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,7 +142,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -154,24 +153,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -230,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -238,7 +237,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -248,7 +247,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -260,7 +259,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -275,10 +274,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -293,34 +292,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedString(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedList(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedMap(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -336,7 +335,7 @@ public AllofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, Schema } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 77063ed5e5c..58da6606e04 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -132,7 +131,7 @@ public static AllofWithTheFirstEmptySchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,7 +143,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,7 +155,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -167,24 +166,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -243,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -261,7 +260,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -273,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -288,10 +287,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,34 +305,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofWithTheFirstEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedVoid(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedNumber(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedString(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedList(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedMap(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -349,7 +348,7 @@ public AllofWithTheFirstEmptySchema1Boxed validateAndBox(@Nullable Object arg, S } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index 0ea5f48a712..ce1633d2a1f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -132,7 +131,7 @@ public static AllofWithTheLastEmptySchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,7 +143,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,7 +155,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -167,24 +166,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -243,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -261,7 +260,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -273,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -288,10 +287,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,34 +305,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofWithTheLastEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedVoid(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedNumber(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedString(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedList(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedMap(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -349,7 +348,7 @@ public AllofWithTheLastEmptySchema1Boxed validateAndBox(@Nullable Object arg, Sc } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index 6430ce42fd0..cb91cb50c79 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -131,7 +130,7 @@ public static AllofWithTwoEmptySchemas1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,7 +142,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -155,7 +154,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -166,24 +165,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,7 +214,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -250,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -260,7 +259,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -272,7 +271,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -287,10 +286,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -305,34 +304,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofWithTwoEmptySchemas1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedVoid(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedNumber(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedString(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedList(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedMap(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -348,7 +347,7 @@ public AllofWithTwoEmptySchemas1Boxed validateAndBox(@Nullable Object arg, Schem } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index 901e8939216..66159633ae0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; @@ -111,7 +110,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,7 +134,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -146,24 +145,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,7 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -222,7 +221,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -252,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -267,10 +266,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -285,34 +284,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -328,7 +327,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -405,7 +404,7 @@ public static Anyof1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -417,7 +416,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -429,7 +428,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -440,24 +439,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -489,7 +488,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -516,7 +515,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -524,7 +523,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -534,7 +533,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -546,7 +545,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -561,10 +560,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -579,34 +578,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Anyof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedVoid(validate(arg, configuration)); } @Override - public Anyof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedBoolean(validate(arg, configuration)); } @Override - public Anyof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedNumber(validate(arg, configuration)); } @Override - public Anyof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedString(validate(arg, configuration)); } @Override - public Anyof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedList(validate(arg, configuration)); } @Override - public Anyof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedMap(validate(arg, configuration)); } @Override - public Anyof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -622,7 +621,7 @@ public Anyof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index 1057b9bce71..d0c90282afe 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -65,7 +64,7 @@ public static Schema0Map of(Map arg, SchemaC public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -211,7 +210,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,7 +222,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,7 +234,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,24 +245,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -295,7 +294,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -322,7 +321,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +329,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -340,7 +339,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -352,7 +351,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -367,10 +366,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,34 +384,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -428,7 +427,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -458,7 +457,7 @@ public static Schema1Map of(Map arg, SchemaC public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -586,7 +585,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -598,7 +597,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -610,7 +609,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -621,24 +620,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -670,7 +669,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -697,7 +696,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +704,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -715,7 +714,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -727,7 +726,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -742,10 +741,10 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,34 +759,34 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -803,7 +802,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -880,7 +879,7 @@ public static AnyofComplexTypes1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -892,7 +891,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -904,7 +903,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -915,24 +914,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -964,7 +963,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -991,7 +990,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +998,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1009,7 +1008,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1021,7 +1020,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1036,10 +1035,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,34 +1053,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedVoid(validate(arg, configuration)); } @Override - public AnyofComplexTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyofComplexTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedNumber(validate(arg, configuration)); } @Override - public AnyofComplexTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedString(validate(arg, configuration)); } @Override - public AnyofComplexTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedList(validate(arg, configuration)); } @Override - public AnyofComplexTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedMap(validate(arg, configuration)); } @Override - public AnyofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1097,7 +1096,7 @@ public AnyofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index c3885e3556d..59378958342 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -99,7 +98,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -111,7 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -134,24 +133,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -210,7 +209,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -255,10 +254,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,34 +272,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -316,7 +315,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -384,7 +383,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -396,7 +395,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -408,7 +407,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,24 +418,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -468,7 +467,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -495,7 +494,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +502,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -513,7 +512,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -540,10 +539,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,34 +557,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -601,7 +600,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -658,29 +657,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithBaseSchema1BoxedString(validate(arg, configuration)); } @Override - public AnyofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index 8566d7392b2..c8613b132f2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -132,7 +131,7 @@ public static AnyofWithOneEmptySchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,7 +143,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,7 +155,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -167,24 +166,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -243,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -261,7 +260,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -273,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -288,10 +287,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,34 +305,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedString(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedList(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedMap(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -349,7 +348,7 @@ public AnyofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, Schema } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java index 4a31884a01b..55ad72ad773 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -152,7 +151,7 @@ public ArrayTypeMatchesArraysList getNewInstance(List arg, List pathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -174,29 +173,29 @@ public ArrayTypeMatchesArraysList validate(List arg, SchemaConfiguration conf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayTypeMatchesArrays1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayTypeMatchesArrays1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayTypeMatchesArrays1BoxedList(validate(arg, configuration)); } @Override - public ArrayTypeMatchesArrays1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayTypeMatchesArrays1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index ebcbb032fc3..8fe59faa883 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -106,7 +105,7 @@ public static ByInt1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -118,7 +117,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,7 +129,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,24 +140,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -190,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -217,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -235,7 +234,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -247,7 +246,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,10 +261,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,34 +279,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ByInt1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedVoid(validate(arg, configuration)); } @Override - public ByInt1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedBoolean(validate(arg, configuration)); } @Override - public ByInt1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedNumber(validate(arg, configuration)); } @Override - public ByInt1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedString(validate(arg, configuration)); } @Override - public ByInt1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedList(validate(arg, configuration)); } @Override - public ByInt1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedMap(validate(arg, configuration)); } @Override - public ByInt1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -323,7 +322,7 @@ public ByInt1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index 828c756720c..93433de2ebf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -106,7 +105,7 @@ public static ByNumber1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -118,7 +117,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,7 +129,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,24 +140,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -190,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -217,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -235,7 +234,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -247,7 +246,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,10 +261,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,34 +279,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ByNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedVoid(validate(arg, configuration)); } @Override - public ByNumber1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedBoolean(validate(arg, configuration)); } @Override - public ByNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedNumber(validate(arg, configuration)); } @Override - public ByNumber1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedString(validate(arg, configuration)); } @Override - public ByNumber1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedList(validate(arg, configuration)); } @Override - public ByNumber1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedMap(validate(arg, configuration)); } @Override - public ByNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -323,7 +322,7 @@ public ByNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index c91371daa4a..404a15c9aaa 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -106,7 +105,7 @@ public static BySmallNumber1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -118,7 +117,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,7 +129,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,24 +140,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -190,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -217,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -235,7 +234,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -247,7 +246,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,10 +261,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,34 +279,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BySmallNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedVoid(validate(arg, configuration)); } @Override - public BySmallNumber1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedBoolean(validate(arg, configuration)); } @Override - public BySmallNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedNumber(validate(arg, configuration)); } @Override - public BySmallNumber1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedString(validate(arg, configuration)); } @Override - public BySmallNumber1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedList(validate(arg, configuration)); } @Override - public BySmallNumber1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedMap(validate(arg, configuration)); } @Override - public BySmallNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -323,7 +322,7 @@ public BySmallNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurat } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index fd3953683af..a8a45bb6723 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static DateTimeFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateTimeFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedVoid(validate(arg, configuration)); } @Override - public DateTimeFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public DateTimeFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedNumber(validate(arg, configuration)); } @Override - public DateTimeFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedString(validate(arg, configuration)); } @Override - public DateTimeFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedList(validate(arg, configuration)); } @Override - public DateTimeFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedMap(validate(arg, configuration)); } @Override - public DateTimeFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public DateTimeFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfigura } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index 97090800803..8f6d32fe0bc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static EmailFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EmailFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedVoid(validate(arg, configuration)); } @Override - public EmailFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public EmailFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedNumber(validate(arg, configuration)); } @Override - public EmailFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedString(validate(arg, configuration)); } @Override - public EmailFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedList(validate(arg, configuration)); } @Override - public EmailFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedMap(validate(arg, configuration)); } @Override - public EmailFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public EmailFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java index 925c8e678d9..e762044b002 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -168,29 +167,29 @@ public double validate(DoubleEnumWith0DoesNotMatchFalseEnums arg,SchemaConfigura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumWith0DoesNotMatchFalse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWith0DoesNotMatchFalse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EnumWith0DoesNotMatchFalse1BoxedNumber(validate(arg, configuration)); } @Override - public EnumWith0DoesNotMatchFalse1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWith0DoesNotMatchFalse1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java index 3fc1f77d7d0..0924081d382 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -168,29 +167,29 @@ public double validate(DoubleEnumWith1DoesNotMatchTrueEnums arg,SchemaConfigurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumWith1DoesNotMatchTrue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWith1DoesNotMatchTrue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EnumWith1DoesNotMatchTrue1BoxedNumber(validate(arg, configuration)); } @Override - public EnumWith1DoesNotMatchTrue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWith1DoesNotMatchTrue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java index d5dab170d98..5567fdd3228 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -93,29 +92,29 @@ public String validate(StringEnumWithEscapedCharactersEnums arg,SchemaConfigurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EnumWithEscapedCharacters1BoxedString(validate(arg, configuration)); } @Override - public EnumWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java index bfc0223b2f7..afd6b062012 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator; @@ -89,32 +88,32 @@ public boolean validate(BooleanEnumWithFalseDoesNotMatch0Enums arg,SchemaConfigu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumWithFalseDoesNotMatch01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithFalseDoesNotMatch01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new EnumWithFalseDoesNotMatch01BoxedBoolean(validate(arg, configuration)); } @Override - public EnumWithFalseDoesNotMatch01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithFalseDoesNotMatch01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java index 4581de4b395..df89d7cd7ac 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator; @@ -89,32 +88,32 @@ public boolean validate(BooleanEnumWithTrueDoesNotMatch1Enums arg,SchemaConfigur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumWithTrueDoesNotMatch11BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithTrueDoesNotMatch11BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new EnumWithTrueDoesNotMatch11BoxedBoolean(validate(arg, configuration)); } @Override - public EnumWithTrueDoesNotMatch11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithTrueDoesNotMatch11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index 3822c82493e..7b05dad2aab 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -95,29 +94,29 @@ public String validate(StringFooEnums arg,SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FooBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new FooBoxedString(validate(arg, configuration)); } @Override - public FooBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringBarEnums implements StringValueMethod { @@ -184,29 +183,29 @@ public String validate(StringBarEnums arg,SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new BarBoxedString(validate(arg, configuration)); } @Override - public BarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -227,7 +226,7 @@ public static EnumsInPropertiesMap of(Map ar public String bar() { @Nullable Object value = get("bar"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -237,7 +236,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -369,7 +368,7 @@ public EnumsInPropertiesMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -377,7 +376,7 @@ public EnumsInPropertiesMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -387,7 +386,7 @@ public EnumsInPropertiesMap getNewInstance(Map arg, List pathToIte return new EnumsInPropertiesMap(castProperties); } - public EnumsInPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumsInPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -399,29 +398,29 @@ public EnumsInPropertiesMap validate(Map arg, SchemaConfiguration configur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumsInProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumsInProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EnumsInProperties1BoxedMap(validate(arg, configuration)); } @Override - public EnumsInProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumsInProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index 75ee6ca186a..8982d39f0f7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -231,7 +230,7 @@ public static ForbiddenProperty1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,7 +242,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -255,7 +254,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -266,24 +265,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -315,7 +314,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -342,7 +341,7 @@ public ForbiddenPropertyMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -350,7 +349,7 @@ public ForbiddenPropertyMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -360,7 +359,7 @@ public ForbiddenPropertyMap getNewInstance(Map arg, List pathToIte return new ForbiddenPropertyMap(castProperties); } - public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -372,7 +371,7 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -387,10 +386,10 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -405,34 +404,34 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ForbiddenProperty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedVoid(validate(arg, configuration)); } @Override - public ForbiddenProperty1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedBoolean(validate(arg, configuration)); } @Override - public ForbiddenProperty1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedNumber(validate(arg, configuration)); } @Override - public ForbiddenProperty1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedString(validate(arg, configuration)); } @Override - public ForbiddenProperty1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedList(validate(arg, configuration)); } @Override - public ForbiddenProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedMap(validate(arg, configuration)); } @Override - public ForbiddenProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -448,7 +447,7 @@ public ForbiddenProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index da84ef4c6ed..94bf4a17b61 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static HostnameFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HostnameFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedVoid(validate(arg, configuration)); } @Override - public HostnameFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public HostnameFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedNumber(validate(arg, configuration)); } @Override - public HostnameFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedString(validate(arg, configuration)); } @Override - public HostnameFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedList(validate(arg, configuration)); } @Override - public HostnameFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedMap(validate(arg, configuration)); } @Override - public HostnameFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public HostnameFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfigura } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java index e473cb0c78d..e171937eb35 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -90,29 +89,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber(validate(arg, configuration)); } @Override - public InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java index bcb1f0ca8e1..8b3fbbc5256 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -83,35 +82,35 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public BarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new BarBoxedString(validate(arg, configuration)); } @Override - public BarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -132,7 +131,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -253,7 +252,7 @@ public static InvalidStringValueForDefault1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -265,7 +264,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -277,7 +276,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -288,24 +287,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -337,7 +336,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -364,7 +363,7 @@ public InvalidStringValueForDefaultMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -372,7 +371,7 @@ public InvalidStringValueForDefaultMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -382,7 +381,7 @@ public InvalidStringValueForDefaultMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public InvalidStringValueForDefaultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -394,7 +393,7 @@ public InvalidStringValueForDefaultMap validate(Map arg, SchemaConfigurati } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -409,10 +408,10 @@ public InvalidStringValueForDefaultMap validate(Map arg, SchemaConfigurati } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -427,34 +426,34 @@ public InvalidStringValueForDefaultMap validate(Map arg, SchemaConfigurati } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public InvalidStringValueForDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public InvalidStringValueForDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new InvalidStringValueForDefault1BoxedVoid(validate(arg, configuration)); } @Override - public InvalidStringValueForDefault1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public InvalidStringValueForDefault1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new InvalidStringValueForDefault1BoxedBoolean(validate(arg, configuration)); } @Override - public InvalidStringValueForDefault1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public InvalidStringValueForDefault1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new InvalidStringValueForDefault1BoxedNumber(validate(arg, configuration)); } @Override - public InvalidStringValueForDefault1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public InvalidStringValueForDefault1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new InvalidStringValueForDefault1BoxedString(validate(arg, configuration)); } @Override - public InvalidStringValueForDefault1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public InvalidStringValueForDefault1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new InvalidStringValueForDefault1BoxedList(validate(arg, configuration)); } @Override - public InvalidStringValueForDefault1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public InvalidStringValueForDefault1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new InvalidStringValueForDefault1BoxedMap(validate(arg, configuration)); } @Override - public InvalidStringValueForDefault1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public InvalidStringValueForDefault1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -470,7 +469,7 @@ public InvalidStringValueForDefault1Boxed validateAndBox(@Nullable Object arg, S } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index 9db27444b5d..23dac5af28c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static Ipv4Format1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Ipv4Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedVoid(validate(arg, configuration)); } @Override - public Ipv4Format1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedBoolean(validate(arg, configuration)); } @Override - public Ipv4Format1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedNumber(validate(arg, configuration)); } @Override - public Ipv4Format1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedString(validate(arg, configuration)); } @Override - public Ipv4Format1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedList(validate(arg, configuration)); } @Override - public Ipv4Format1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedMap(validate(arg, configuration)); } @Override - public Ipv4Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public Ipv4Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index f52011acf83..01da7d38593 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static Ipv6Format1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Ipv6Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedVoid(validate(arg, configuration)); } @Override - public Ipv6Format1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedBoolean(validate(arg, configuration)); } @Override - public Ipv6Format1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedNumber(validate(arg, configuration)); } @Override - public Ipv6Format1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedString(validate(arg, configuration)); } @Override - public Ipv6Format1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedList(validate(arg, configuration)); } @Override - public Ipv6Format1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedMap(validate(arg, configuration)); } @Override - public Ipv6Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public Ipv6Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index fce4b261f1d..fa8749c26d6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static JsonPointerFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JsonPointerFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedVoid(validate(arg, configuration)); } @Override - public JsonPointerFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public JsonPointerFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedNumber(validate(arg, configuration)); } @Override - public JsonPointerFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedString(validate(arg, configuration)); } @Override - public JsonPointerFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedList(validate(arg, configuration)); } @Override - public JsonPointerFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedMap(validate(arg, configuration)); } @Override - public JsonPointerFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public JsonPointerFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index ff2f9aec232..aa726fc1d7c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MaximumValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MaximumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MaximumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MaximumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MaximumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedString(validate(arg, configuration)); } @Override - public MaximumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedList(validate(arg, configuration)); } @Override - public MaximumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedMap(validate(arg, configuration)); } @Override - public MaximumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MaximumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index 9f2eefdd7cd..8b9f476e860 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MaximumValidationWithUnsignedInteger1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MaximumValidationWithUnsignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedVoid(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedBoolean(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedNumber(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedString(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedList(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedMap(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MaximumValidationWithUnsignedInteger1Boxed validateAndBox(@Nullable Objec } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index dfbadbb5e68..4c4efef907a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MaxitemsValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MaxitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MaxitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MaxitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MaxitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedString(validate(arg, configuration)); } @Override - public MaxitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedList(validate(arg, configuration)); } @Override - public MaxitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedMap(validate(arg, configuration)); } @Override - public MaxitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MaxitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index 02d41b936b7..c93a08ffe0b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MaxlengthValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MaxlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MaxlengthValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MaxlengthValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MaxlengthValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedString(validate(arg, configuration)); } @Override - public MaxlengthValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedList(validate(arg, configuration)); } @Override - public MaxlengthValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedMap(validate(arg, configuration)); } @Override - public MaxlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MaxlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index c71474bd82f..ea6e8963c47 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static Maxproperties0MeansTheObjectIsEmpty1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedString(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedList(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedMap(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public Maxproperties0MeansTheObjectIsEmpty1Boxed validateAndBox(@Nullable Object } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 5386164471a..468b9336092 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MaxpropertiesValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MaxpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedString(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedList(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedMap(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MaxpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, Schema } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index 29325be0f63..eefb6bdaa0b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MinimumValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MinimumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MinimumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MinimumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MinimumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedString(validate(arg, configuration)); } @Override - public MinimumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedList(validate(arg, configuration)); } @Override - public MinimumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedMap(validate(arg, configuration)); } @Override - public MinimumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MinimumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 531298768ff..33543c9daf1 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MinimumValidationWithSignedInteger1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MinimumValidationWithSignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedVoid(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedBoolean(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedNumber(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedString(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedList(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedMap(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MinimumValidationWithSignedInteger1Boxed validateAndBox(@Nullable Object } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index 13a669101d6..b933bb806b4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MinitemsValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MinitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MinitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MinitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MinitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedString(validate(arg, configuration)); } @Override - public MinitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedList(validate(arg, configuration)); } @Override - public MinitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedMap(validate(arg, configuration)); } @Override - public MinitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MinitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index 835bdc24f37..02e7fe8cac3 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MinlengthValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MinlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MinlengthValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MinlengthValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MinlengthValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedString(validate(arg, configuration)); } @Override - public MinlengthValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedList(validate(arg, configuration)); } @Override - public MinlengthValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedMap(validate(arg, configuration)); } @Override - public MinlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MinlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index 1802917d267..a04af48e3f5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MinpropertiesValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MinpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MinpropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MinpropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MinpropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedString(validate(arg, configuration)); } @Override - public MinpropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedList(validate(arg, configuration)); } @Override - public MinpropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedMap(validate(arg, configuration)); } @Override - public MinpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MinpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, Schema } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index b7648383ba2..be402dca36e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -113,7 +112,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -406,7 +405,7 @@ public static NestedAllofToCheckValidationSemantics1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -418,7 +417,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,7 +429,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -441,24 +440,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -490,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -517,7 +516,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -535,7 +534,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -547,7 +546,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -562,10 +561,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,34 +579,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NestedAllofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedString(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedList(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -623,7 +622,7 @@ public NestedAllofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Obje } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index 7709bbbf75c..fdca504a464 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -113,7 +112,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -406,7 +405,7 @@ public static NestedAnyofToCheckValidationSemantics1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -418,7 +417,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,7 +429,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -441,24 +440,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -490,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -517,7 +516,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -535,7 +534,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -547,7 +546,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -562,10 +561,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,34 +579,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedString(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedList(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -623,7 +622,7 @@ public NestedAnyofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Obje } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index 9e6928c1b4c..a85dac715e0 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NumberJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -120,12 +119,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -145,29 +144,29 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Items2BoxedList(validate(arg, configuration)); } @Override - public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -242,12 +241,12 @@ public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList) itemInstance); i += 1; @@ -267,29 +266,29 @@ public ItemsList1 validate(List arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Items1BoxedList(validate(arg, configuration)); } @Override - public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -364,12 +363,12 @@ public ItemsList2 getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList1)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList1) itemInstance); i += 1; @@ -389,29 +388,29 @@ public ItemsList2 validate(List arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedList(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -492,12 +491,12 @@ public NestedItemsList getNewInstance(List arg, List pathToItem, Path itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList2)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList2) itemInstance); i += 1; @@ -517,29 +516,29 @@ public NestedItemsList validate(List arg, SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NestedItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NestedItems1BoxedList(validate(arg, configuration)); } @Override - public NestedItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index e75084fe04d..489c92daf72 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -113,7 +112,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -406,7 +405,7 @@ public static NestedOneofToCheckValidationSemantics1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -418,7 +417,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,7 +429,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -441,24 +440,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -490,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -517,7 +516,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -535,7 +534,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -547,7 +546,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -562,10 +561,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,34 +579,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NestedOneofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedString(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedList(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -623,7 +622,7 @@ public NestedOneofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Obje } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index 98514e1cbff..15045fcbc96 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; @@ -117,7 +116,7 @@ public static Not1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,7 +140,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,24 +151,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -273,10 +272,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -291,34 +290,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Not1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedVoid(validate(arg, configuration)); } @Override - public Not1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedBoolean(validate(arg, configuration)); } @Override - public Not1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedNumber(validate(arg, configuration)); } @Override - public Not1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedString(validate(arg, configuration)); } @Override - public Not1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedList(validate(arg, configuration)); } @Override - public Not1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedMap(validate(arg, configuration)); } @Override - public Not1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -334,7 +333,7 @@ public Not1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index 0e92dc9eac8..6947755b346 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +65,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -151,7 +150,7 @@ public NotMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -159,7 +158,7 @@ public NotMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -169,7 +168,7 @@ public NotMap getNewInstance(Map arg, List pathToItem, PathToSchem return new NotMap(castProperties); } - public NotMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -181,29 +180,29 @@ public NotMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NotBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NotBoxedMap(validate(arg, configuration)); } @Override - public NotBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -278,7 +277,7 @@ public static NotMoreComplexSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -290,7 +289,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -302,7 +301,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,24 +312,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -362,7 +361,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -389,7 +388,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -397,7 +396,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -407,7 +406,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,7 +418,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -434,10 +433,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -452,34 +451,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NotMoreComplexSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedString(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedList(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedMap(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -495,7 +494,7 @@ public NotMoreComplexSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java index cccbac4a8ff..89f32a64c25 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -91,29 +90,29 @@ public String validate(StringNulCharactersInStringsEnums arg,SchemaConfiguration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NulCharactersInStrings1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NulCharactersInStrings1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NulCharactersInStrings1BoxedString(validate(arg, configuration)); } @Override - public NulCharactersInStrings1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NulCharactersInStrings1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index 01f7f868c52..6eda0789786 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -79,7 +78,7 @@ public Number foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (Number) value; } @@ -89,7 +88,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -244,7 +243,7 @@ public static ObjectPropertiesValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -256,7 +255,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -268,7 +267,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -279,24 +278,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -328,7 +327,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -355,7 +354,7 @@ public ObjectPropertiesValidationMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -363,7 +362,7 @@ public ObjectPropertiesValidationMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -373,7 +372,7 @@ public ObjectPropertiesValidationMap getNewInstance(Map arg, List return new ObjectPropertiesValidationMap(castProperties); } - public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -385,7 +384,7 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -400,10 +399,10 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -418,34 +417,34 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectPropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedVoid(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedNumber(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedString(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedList(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedMap(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -461,7 +460,7 @@ public ObjectPropertiesValidation1Boxed validateAndBox(@Nullable Object arg, Sch } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index 86951cf5e63..d649859a696 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; @@ -111,7 +110,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,7 +134,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -146,24 +145,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,7 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -222,7 +221,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -252,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -267,10 +266,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -285,34 +284,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -328,7 +327,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -405,7 +404,7 @@ public static Oneof1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -417,7 +416,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -429,7 +428,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -440,24 +439,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -489,7 +488,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -516,7 +515,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -524,7 +523,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -534,7 +533,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -546,7 +545,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -561,10 +560,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -579,34 +578,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Oneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedVoid(validate(arg, configuration)); } @Override - public Oneof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedBoolean(validate(arg, configuration)); } @Override - public Oneof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedNumber(validate(arg, configuration)); } @Override - public Oneof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedString(validate(arg, configuration)); } @Override - public Oneof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedList(validate(arg, configuration)); } @Override - public Oneof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedMap(validate(arg, configuration)); } @Override - public Oneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -622,7 +621,7 @@ public Oneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index ee1966faee0..c6eab7c1eef 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -65,7 +64,7 @@ public static Schema0Map of(Map arg, SchemaC public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -211,7 +210,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,7 +222,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,7 +234,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,24 +245,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -295,7 +294,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -322,7 +321,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +329,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -340,7 +339,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -352,7 +351,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -367,10 +366,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,34 +384,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -428,7 +427,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -458,7 +457,7 @@ public static Schema1Map of(Map arg, SchemaC public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -586,7 +585,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -598,7 +597,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -610,7 +609,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -621,24 +620,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -670,7 +669,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -697,7 +696,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +704,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -715,7 +714,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -727,7 +726,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -742,10 +741,10 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,34 +759,34 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -803,7 +802,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -880,7 +879,7 @@ public static OneofComplexTypes1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -892,7 +891,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -904,7 +903,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -915,24 +914,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -964,7 +963,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -991,7 +990,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +998,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1009,7 +1008,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1021,7 +1020,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1036,10 +1035,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,34 +1053,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OneofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedVoid(validate(arg, configuration)); } @Override - public OneofComplexTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedBoolean(validate(arg, configuration)); } @Override - public OneofComplexTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedNumber(validate(arg, configuration)); } @Override - public OneofComplexTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedString(validate(arg, configuration)); } @Override - public OneofComplexTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedList(validate(arg, configuration)); } @Override - public OneofComplexTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedMap(validate(arg, configuration)); } @Override - public OneofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1097,7 +1096,7 @@ public OneofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index e9d3f27028e..e5fa1ac5522 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -99,7 +98,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -111,7 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -134,24 +133,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -210,7 +209,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -255,10 +254,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,34 +272,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -316,7 +315,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -384,7 +383,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -396,7 +395,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -408,7 +407,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,24 +418,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -468,7 +467,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -495,7 +494,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +502,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -513,7 +512,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -540,10 +539,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,34 +557,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -601,7 +600,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -658,29 +657,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OneofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithBaseSchema1BoxedString(validate(arg, configuration)); } @Override - public OneofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index 96c4c68034b..4c9debae918 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -132,7 +131,7 @@ public static OneofWithEmptySchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,7 +143,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,7 +155,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -167,24 +166,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -243,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -261,7 +260,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -273,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -288,10 +287,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,34 +305,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OneofWithEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedVoid(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedBoolean(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedNumber(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedString(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedList(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedMap(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -349,7 +348,7 @@ public OneofWithEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index b62dc7bf97e..b1a56e9ea64 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -50,11 +49,19 @@ public static Schema0Map of(Map arg, SchemaC } public @Nullable Object bar() { - return getOrThrow("bar"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object foo() { - return getOrThrow("foo"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -315,7 +322,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -327,7 +334,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -339,7 +346,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -350,24 +357,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -399,7 +406,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -426,7 +433,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -434,7 +441,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -444,7 +451,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -456,7 +463,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -471,10 +478,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -489,34 +496,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -532,7 +539,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -550,11 +557,19 @@ public static Schema1Map of(Map arg, SchemaC } public @Nullable Object baz() { - return getOrThrow("baz"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object foo() { - return getOrThrow("foo"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -815,7 +830,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -827,7 +842,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -839,7 +854,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -850,24 +865,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -899,7 +914,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -926,7 +941,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -934,7 +949,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -944,7 +959,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -956,7 +971,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -971,10 +986,10 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -989,34 +1004,34 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1032,7 +1047,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1079,7 +1094,7 @@ public static OneofWithRequired1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1087,7 +1102,7 @@ public static OneofWithRequired1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1097,7 +1112,7 @@ public static OneofWithRequired1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1109,29 +1124,29 @@ public static OneofWithRequired1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OneofWithRequired1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithRequired1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithRequired1BoxedMap(validate(arg, configuration)); } @Override - public OneofWithRequired1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithRequired1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index 49d4017ae06..e0493ed1d41 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +107,7 @@ public static PatternIsNotAnchored1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +119,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +142,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -192,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -237,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +248,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,10 +263,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,34 +281,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternIsNotAnchored1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedVoid(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedBoolean(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedNumber(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedString(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedList(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedMap(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +324,7 @@ public PatternIsNotAnchored1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index 7e0ffabd596..9027293703c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +107,7 @@ public static PatternValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +119,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +142,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -192,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -237,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +248,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,10 +263,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,34 +281,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedVoid(validate(arg, configuration)); } @Override - public PatternValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public PatternValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedNumber(validate(arg, configuration)); } @Override - public PatternValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedString(validate(arg, configuration)); } @Override - public PatternValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedList(validate(arg, configuration)); } @Override - public PatternValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedMap(validate(arg, configuration)); } @Override - public PatternValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +324,7 @@ public PatternValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index 6e99b7bfe97..78e2eecd84c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -425,7 +424,7 @@ public static PropertiesWithEscapedCharacters1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -437,7 +436,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -449,7 +448,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -460,24 +459,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -509,7 +508,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -536,7 +535,7 @@ public PropertiesWithEscapedCharactersMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -544,7 +543,7 @@ public PropertiesWithEscapedCharactersMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -554,7 +553,7 @@ public PropertiesWithEscapedCharactersMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -566,7 +565,7 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfigur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -581,10 +580,10 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfigur } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -599,34 +598,34 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfigur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PropertiesWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedVoid(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedNumber(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedString(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedList(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedMap(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -642,7 +641,7 @@ public PropertiesWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index 070d7d5977f..ee776b80ce2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -177,7 +176,7 @@ public static PropertyNamedRefThatIsNotAReference1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -212,24 +211,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -261,7 +260,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -288,7 +287,7 @@ public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -296,7 +295,7 @@ public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -306,7 +305,7 @@ public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(Map arg, List return new PropertyNamedRefThatIsNotAReferenceMap(castProperties); } - public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -318,7 +317,7 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -333,10 +332,10 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConf } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -351,34 +350,34 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConf } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedVoid(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedBoolean(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedNumber(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedString(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedList(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedMap(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -394,7 +393,7 @@ public PropertyNamedRefThatIsNotAReference1Boxed validateAndBox(@Nullable Object } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java index efa1e208ac7..36322a4c226 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -172,7 +171,7 @@ public RefInAdditionalpropertiesMap getNewInstance(Map arg, List p for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -180,12 +179,12 @@ public RefInAdditionalpropertiesMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable Object) propertyInstance); } @@ -193,7 +192,7 @@ public RefInAdditionalpropertiesMap getNewInstance(Map arg, List p return new RefInAdditionalpropertiesMap(castProperties); } - public RefInAdditionalpropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAdditionalpropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -205,29 +204,29 @@ public RefInAdditionalpropertiesMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RefInAdditionalproperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAdditionalproperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAdditionalproperties1BoxedMap(validate(arg, configuration)); } @Override - public RefInAdditionalproperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAdditionalproperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java index a826571f87c..4a14a8d4ab9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAllof.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -107,7 +106,7 @@ public static RefInAllof1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -119,7 +118,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,7 +130,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,24 +141,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,7 +190,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +247,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -263,10 +262,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,34 +280,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RefInAllof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAllof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAllof1BoxedVoid(validate(arg, configuration)); } @Override - public RefInAllof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAllof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAllof1BoxedBoolean(validate(arg, configuration)); } @Override - public RefInAllof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAllof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAllof1BoxedNumber(validate(arg, configuration)); } @Override - public RefInAllof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAllof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAllof1BoxedString(validate(arg, configuration)); } @Override - public RefInAllof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAllof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAllof1BoxedList(validate(arg, configuration)); } @Override - public RefInAllof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAllof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAllof1BoxedMap(validate(arg, configuration)); } @Override - public RefInAllof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAllof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -324,7 +323,7 @@ public RefInAllof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java index c77c290df32..43670024c8c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInAnyof.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -107,7 +106,7 @@ public static RefInAnyof1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -119,7 +118,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,7 +130,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,24 +141,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,7 +190,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +247,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -263,10 +262,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,34 +280,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RefInAnyof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAnyof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAnyof1BoxedVoid(validate(arg, configuration)); } @Override - public RefInAnyof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAnyof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAnyof1BoxedBoolean(validate(arg, configuration)); } @Override - public RefInAnyof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAnyof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAnyof1BoxedNumber(validate(arg, configuration)); } @Override - public RefInAnyof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAnyof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAnyof1BoxedString(validate(arg, configuration)); } @Override - public RefInAnyof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAnyof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAnyof1BoxedList(validate(arg, configuration)); } @Override - public RefInAnyof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAnyof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RefInAnyof1BoxedMap(validate(arg, configuration)); } @Override - public RefInAnyof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInAnyof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -324,7 +323,7 @@ public RefInAnyof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java index ca25ea6cd5d..69295c9edac 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInItems.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -140,12 +139,12 @@ public RefInItemsList getNewInstance(List arg, List pathToItem, PathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((@Nullable Object) itemInstance); i += 1; @@ -165,29 +164,29 @@ public RefInItemsList validate(List arg, SchemaConfiguration configuration) t } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RefInItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RefInItems1BoxedList(validate(arg, configuration)); } @Override - public RefInItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java index 069ea431cda..cdd3c31828e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInNot.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static RefInNot1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RefInNot1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInNot1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RefInNot1BoxedVoid(validate(arg, configuration)); } @Override - public RefInNot1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInNot1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RefInNot1BoxedBoolean(validate(arg, configuration)); } @Override - public RefInNot1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInNot1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RefInNot1BoxedNumber(validate(arg, configuration)); } @Override - public RefInNot1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInNot1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RefInNot1BoxedString(validate(arg, configuration)); } @Override - public RefInNot1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInNot1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RefInNot1BoxedList(validate(arg, configuration)); } @Override - public RefInNot1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInNot1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RefInNot1BoxedMap(validate(arg, configuration)); } @Override - public RefInNot1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInNot1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public RefInNot1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java index 16dfea00c74..ca637115104 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInOneof.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -107,7 +106,7 @@ public static RefInOneof1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -119,7 +118,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,7 +130,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,24 +141,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,7 +190,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +247,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -263,10 +262,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,34 +280,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RefInOneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInOneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RefInOneof1BoxedVoid(validate(arg, configuration)); } @Override - public RefInOneof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInOneof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RefInOneof1BoxedBoolean(validate(arg, configuration)); } @Override - public RefInOneof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInOneof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RefInOneof1BoxedNumber(validate(arg, configuration)); } @Override - public RefInOneof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInOneof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RefInOneof1BoxedString(validate(arg, configuration)); } @Override - public RefInOneof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInOneof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RefInOneof1BoxedList(validate(arg, configuration)); } @Override - public RefInOneof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInOneof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RefInOneof1BoxedMap(validate(arg, configuration)); } @Override - public RefInOneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInOneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -324,7 +323,7 @@ public RefInOneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java index d6ed9d63722..b6a3529b6ac 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RefInProperty.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -54,7 +53,7 @@ public static RefInPropertyMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for a"); + throw new RuntimeException("Invalid value stored for a"); } return (@Nullable Object) value; } @@ -223,7 +222,7 @@ public static RefInProperty1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,7 +234,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -247,7 +246,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,24 +257,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -307,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -334,7 +333,7 @@ public RefInPropertyMap getNewInstance(Map arg, List pathToItem, P for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -342,7 +341,7 @@ public RefInPropertyMap getNewInstance(Map arg, List pathToItem, P Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -352,7 +351,7 @@ public RefInPropertyMap getNewInstance(Map arg, List pathToItem, P return new RefInPropertyMap(castProperties); } - public RefInPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -364,7 +363,7 @@ public RefInPropertyMap validate(Map arg, SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -379,10 +378,10 @@ public RefInPropertyMap validate(Map arg, SchemaConfiguration configuratio } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -397,34 +396,34 @@ public RefInPropertyMap validate(Map arg, SchemaConfiguration configuratio } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RefInProperty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInProperty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RefInProperty1BoxedVoid(validate(arg, configuration)); } @Override - public RefInProperty1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInProperty1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RefInProperty1BoxedBoolean(validate(arg, configuration)); } @Override - public RefInProperty1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInProperty1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RefInProperty1BoxedNumber(validate(arg, configuration)); } @Override - public RefInProperty1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInProperty1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RefInProperty1BoxedString(validate(arg, configuration)); } @Override - public RefInProperty1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInProperty1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RefInProperty1BoxedList(validate(arg, configuration)); } @Override - public RefInProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RefInProperty1BoxedMap(validate(arg, configuration)); } @Override - public RefInProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RefInProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -440,7 +439,7 @@ public RefInProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurat } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index 8be0cb10a2a..3d0de2d7315 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -229,7 +228,7 @@ public static RequiredDefaultValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +240,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -253,7 +252,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -264,24 +263,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,7 +312,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -340,7 +339,7 @@ public RequiredDefaultValidationMap getNewInstance(Map arg, List p for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -348,7 +347,7 @@ public RequiredDefaultValidationMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -358,7 +357,7 @@ public RequiredDefaultValidationMap getNewInstance(Map arg, List p return new RequiredDefaultValidationMap(castProperties); } - public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -370,7 +369,7 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -385,10 +384,10 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -403,34 +402,34 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RequiredDefaultValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedVoid(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedNumber(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedString(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedList(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedMap(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -446,7 +445,7 @@ public RequiredDefaultValidation1Boxed validateAndBox(@Nullable Object arg, Sche } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index aeaff53e4dd..d8d395a931a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -75,7 +74,11 @@ public static RequiredValidationMap of(Map a } public @Nullable Object foo() { - return getOrThrow("foo"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object bar() throws UnsetPropertyException { @@ -323,7 +326,7 @@ public static RequiredValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -335,7 +338,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -347,7 +350,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -358,24 +361,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -407,7 +410,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -434,7 +437,7 @@ public RequiredValidationMap getNewInstance(Map arg, List pathToIt for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -442,7 +445,7 @@ public RequiredValidationMap getNewInstance(Map arg, List pathToIt Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -452,7 +455,7 @@ public RequiredValidationMap getNewInstance(Map arg, List pathToIt return new RequiredValidationMap(castProperties); } - public RequiredValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -464,7 +467,7 @@ public RequiredValidationMap validate(Map arg, SchemaConfiguration configu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -479,10 +482,10 @@ public RequiredValidationMap validate(Map arg, SchemaConfiguration configu } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -497,34 +500,34 @@ public RequiredValidationMap validate(Map arg, SchemaConfiguration configu } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RequiredValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedVoid(validate(arg, configuration)); } @Override - public RequiredValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public RequiredValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedNumber(validate(arg, configuration)); } @Override - public RequiredValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedString(validate(arg, configuration)); } @Override - public RequiredValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedList(validate(arg, configuration)); } @Override - public RequiredValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedMap(validate(arg, configuration)); } @Override - public RequiredValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -540,7 +543,7 @@ public RequiredValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index 8f3fb5dbb03..02037113e85 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -229,7 +228,7 @@ public static RequiredWithEmptyArray1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +240,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -253,7 +252,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -264,24 +263,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,7 +312,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -340,7 +339,7 @@ public RequiredWithEmptyArrayMap getNewInstance(Map arg, List path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -348,7 +347,7 @@ public RequiredWithEmptyArrayMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -358,7 +357,7 @@ public RequiredWithEmptyArrayMap getNewInstance(Map arg, List path return new RequiredWithEmptyArrayMap(castProperties); } - public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -370,7 +369,7 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration con } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -385,10 +384,10 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -403,34 +402,34 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RequiredWithEmptyArray1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedVoid(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedBoolean(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedNumber(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedString(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedList(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedMap(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -446,7 +445,7 @@ public RequiredWithEmptyArray1Boxed validateAndBox(@Nullable Object arg, SchemaC } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index 4b8b674d256..05018eb695c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -1725,7 +1724,7 @@ public static RequiredWithEscapedCharacters1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1737,7 +1736,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1749,7 +1748,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1760,24 +1759,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1809,7 +1808,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1836,7 +1835,7 @@ public RequiredWithEscapedCharactersMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1844,7 +1843,7 @@ public RequiredWithEscapedCharactersMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1854,7 +1853,7 @@ public RequiredWithEscapedCharactersMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1866,7 +1865,7 @@ public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfigurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1881,10 +1880,10 @@ public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfigurat } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1899,34 +1898,34 @@ public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfigurat } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RequiredWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedVoid(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedNumber(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedString(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedList(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedMap(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1942,7 +1941,7 @@ public RequiredWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java index 9234455603c..798c779beed 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -178,29 +177,29 @@ public double validate(DoubleSimpleEnumValidationEnums arg,SchemaConfiguration c } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SimpleEnumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleEnumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleEnumValidation1BoxedNumber(validate(arg, configuration)); } @Override - public SimpleEnumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleEnumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java index e730c2690f0..0685c66ccda 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -94,29 +93,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AlphaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AlphaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AlphaBoxedNumber(validate(arg, configuration)); } @Override - public AlphaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AlphaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -137,7 +136,7 @@ public Number alpha() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for alpha"); + throw new RuntimeException("Invalid value stored for alpha"); } return (Number) value; } @@ -246,7 +245,7 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstanc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -254,7 +253,7 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstanc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +263,7 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap getNewInstanc return new TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap(castProperties); } - public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -276,29 +275,29 @@ public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap validate(Map< @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap(validate(arg, configuration)); } @Override - public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index 4399cec94a9..078f29b8bbf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static UniqueitemsFalseValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UniqueitemsFalseValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedVoid(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedNumber(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedString(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedList(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedMap(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public UniqueitemsFalseValidation1Boxed validateAndBox(@Nullable Object arg, Sch } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index 2433913da51..71f3ddc3708 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static UniqueitemsValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UniqueitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedVoid(validate(arg, configuration)); } @Override - public UniqueitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public UniqueitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedNumber(validate(arg, configuration)); } @Override - public UniqueitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedString(validate(arg, configuration)); } @Override - public UniqueitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedList(validate(arg, configuration)); } @Override - public UniqueitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedMap(validate(arg, configuration)); } @Override - public UniqueitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public UniqueitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaCo } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index bc2d00b8518..6b23d7035f4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static UriFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UriFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedVoid(validate(arg, configuration)); } @Override - public UriFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public UriFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedNumber(validate(arg, configuration)); } @Override - public UriFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedString(validate(arg, configuration)); } @Override - public UriFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedList(validate(arg, configuration)); } @Override - public UriFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedMap(validate(arg, configuration)); } @Override - public UriFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public UriFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index bee6021f6cf..dea06a51577 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static UriReferenceFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UriReferenceFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedVoid(validate(arg, configuration)); } @Override - public UriReferenceFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public UriReferenceFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedNumber(validate(arg, configuration)); } @Override - public UriReferenceFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedString(validate(arg, configuration)); } @Override - public UriReferenceFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedList(validate(arg, configuration)); } @Override - public UriReferenceFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedMap(validate(arg, configuration)); } @Override - public UriReferenceFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public UriReferenceFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index 16dead22e86..598b74632e2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static UriTemplateFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UriTemplateFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedVoid(validate(arg, configuration)); } @Override - public UriTemplateFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public UriTemplateFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedNumber(validate(arg, configuration)); } @Override - public UriTemplateFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedString(validate(arg, configuration)); } @Override - public UriTemplateFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedList(validate(arg, configuration)); } @Override - public UriTemplateFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedMap(validate(arg, configuration)); } @Override - public UriTemplateFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public UriTemplateFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index 10f995aadef..90fa50e06e4 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -12,41 +12,62 @@ public class ApiConfiguration { private final ServerInfo serverInfo; + private final ServerIndexInfo serverIndexInfo; private final @Nullable Duration timeout; public ApiConfiguration() { serverInfo = new ServerInfo(); + serverIndexInfo = new ServerIndexInfo(); timeout = null; } - public ApiConfiguration(ServerInfo serverInfo, Duration timeout) { + public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, Duration timeout) { this.serverInfo = serverInfo; + this.serverIndexInfo = serverIndexInfo; this.timeout = timeout; } public static class ServerInfo { - protected final RootServerInfo rootServerInfo; + protected final RootServerInfo.RootServerInfo1 rootServerInfo; public ServerInfo() { - rootServerInfo = new RootServerInfo(); + rootServerInfo = new RootServerInfo.RootServerInfo1(); } public ServerInfo( - @Nullable RootServerInfo rootServerInfo + RootServerInfo. @Nullable RootServerInfo1 rootServerInfo ) { - this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo::new); + this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo.RootServerInfo1::new); + } + } + + public static class ServerIndexInfo { + protected RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex; + public ServerIndexInfo() {} + + public ServerIndexInfo rootServerInfoServerIndex(RootServerInfo.ServerIndex serverIndex) { + this.rootServerInfoServerIndex = serverIndex; + return this; } } public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { - return serverInfo.rootServerInfo.getServer(serverIndex); + var serverProvider = serverInfo.rootServerInfo; + if (serverIndex == null) { + RootServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.rootServerInfoServerIndex; + if (configServerIndex == null) { + throw new RuntimeException("rootServerInfoServerIndex is unset"); + } + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); } public Map> getDefaultHeaders() { return new HashMap<>(); } - public@Nullable Duration getTimeout() { + public @Nullable Duration getTimeout() { return timeout; } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java index 3bea6999da1..268e9373289 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.exceptions; @SuppressWarnings("serial") -public class BaseException extends RuntimeException { +public class BaseException extends Exception { public BaseException(String s) { super(s); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java index 2b09f2f77df..0fc91100784 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -5,18 +5,21 @@ import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.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 Map> content; + public final AbstractMap.SimpleEntry> content; - public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, Map> content) { + public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, AbstractMap.SimpleEntry> content) { super(required, ParameterStyle.SIMPLE, explode, allowReserved); this.content = content; } @@ -28,34 +31,28 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { - for (Map.Entry> entry: content.entrySet()) { - var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; - String contentType = entry.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - var value = ContentTypeSerializer.toJson(castInData); - return toHeaders(name, value); - } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) { + 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) { - for (Map.Entry> entry: content.entrySet()) { - String contentType = entry.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - return entry.getValue().schema().validate(deserializedJson, configuration); - } else { - throw new RuntimeException("Header deserialization of "+contentType+" has not yet been implemented"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } return deserializedJson; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java index ac9f6274b0d..42387a7859b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java @@ -2,11 +2,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.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); - @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration); + 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/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java index 7bac0c8a6be..11707301d30 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java @@ -1,26 +1,22 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.AbstractMap; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; -import static java.util.stream.Collectors.toList; -import static java.util.stream.Collectors.toMap; - public class Rfc6570Serializer { private static final String ENCODING = "UTF-8"; private static final Set namedParameterSeparators = Set.of("&", ";"); - private static String percentEncode(String s) { + private static String percentEncode(String s) throws NotImplementedException { if (s == null) { return ""; } @@ -31,11 +27,11 @@ private static String percentEncode(String s) { .replace("%7E", "~"); // This could be done faster with more hand-crafted code. } catch (UnsupportedEncodingException wow) { - throw new RuntimeException(wow.getMessage(), wow); + throw new NotImplementedException(wow.getMessage()); } } - private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) { + 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= @@ -62,7 +58,7 @@ private static String percentEncode(String s) { // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 return null; } - throw new InvalidTypeException("Unable to generate a rfc6570 item representation of "+item); + throw new NotImplementedException("Unable to generate a rfc6570 item representation of "+item); } private static String rfc6570StrNumberExpansion( @@ -71,7 +67,7 @@ private static String rfc6570StrNumberExpansion( 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; @@ -87,11 +83,15 @@ private static String rfc6570ListExpansion( PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { - var itemValues = inData.stream() - .map(v -> rfc6570ItemValue(v, percentEncode)) - .filter(Objects::nonNull) - .collect(toList()); + ) 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 ""; @@ -116,12 +116,19 @@ private static String rfc6570MapExpansion( PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { - var inDataMap = inData.entrySet().stream() - .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), rfc6570ItemValue(entry.getValue(), percentEncode))) - .filter(entry -> entry.getValue() != null) - .collect(toMap(Map.Entry::getKey, Map.Entry::getValue, (x, y) -> y, LinkedHashMap::new)); - + ) 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 ""; @@ -143,7 +150,7 @@ protected static String rfc6570Expansion( boolean explode, boolean percentEncode, PrefixSeparatorIterator prefixSeparatorIterator - ) { + ) throws NotImplementedException { /* Separator is for separate variables like dict with explode true, not for array item separation @@ -181,6 +188,6 @@ protected static String rfc6570Expansion( ); } // bool, bytes, etc - throw new InvalidTypeException("Unable to generate a rfc6570 representation of "+inData); + throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java index e4fcfd99924..0f929d9c63b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java @@ -3,6 +3,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.parameter.ParameterStyle; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; @@ -30,7 +32,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { + 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); @@ -49,7 +51,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid 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) { + 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<>(); @@ -60,7 +62,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return castList; } - private @Nullable Object getCastInData(JsonSchema schema, List inData) { + private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { if (schema.type == null) { if (inData.size() == 1) { return inData.get(0); @@ -68,7 +70,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return getList(schema, inData); } else if (schema.type.size() == 1) { if (schema.type.equals(BOOLEAN_TYPES)) { - throw new RuntimeException("Boolean serialization is not defined in Rfc6570, there is no agreed upon way to sent a boolean, send a string enum instead"); + 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) { @@ -76,16 +78,16 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid } else if (schema.type.equals(LIST_TYPES)) { return getList(schema, inData); } else if (schema.type.equals(MAP_TYPES)) { - throw new RuntimeException("Header map deserialization has not yet been implemented"); + 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 RuntimeException("Header deserialization for schemas with multiple types has not yet been implemented"); + 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) { + 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); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java index d18be288684..f5fa5a0a75b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; public class StyleSerializer extends Rfc6570Serializer { public static String serializeSimple( @@ -8,7 +9,7 @@ public static String serializeSimple( String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); return rfc6570Expansion( name, @@ -24,7 +25,7 @@ public static String serializeForm( String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { // todo check that the prefix and suffix matches this one PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); return rfc6570Expansion( @@ -40,7 +41,7 @@ public static String serializeMatrix( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); return rfc6570Expansion( name, @@ -55,7 +56,7 @@ public static String serializeLabel( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); return rfc6570Expansion( name, @@ -70,7 +71,7 @@ public static String serializeSpaceDelimited( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); return rfc6570Expansion( name, @@ -85,7 +86,7 @@ public static String serializePipeDelimited( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); return rfc6570Expansion( name, diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java index 79a3e781051..d5e00cc2fa9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java @@ -3,30 +3,28 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import java.util.Map; import java.util.AbstractMap; public class ContentParameter extends ParameterBase implements Parameter { - public final Map> content; + public final AbstractMap.SimpleEntry> content; - public ContentParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, Map> 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) { - for (Map.Entry> entry: content.entrySet()) { - String contentType = entry.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - var value = ContentTypeSerializer.toJson(inData); - return new AbstractMap.SimpleEntry<>(name, value); - } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java index b04b2ca1754..dcd3b6faf6b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.Map; @@ -13,7 +14,7 @@ protected CookieSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData) { + public String serialize(Map inData) throws NotImplementedException { String result = ""; Map sortedData = new TreeMap<>(inData); for (Map.Entry entry: sortedData.entrySet()) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java index b4a23229944..1969f2c0b21 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.LinkedHashMap; @@ -14,7 +15,7 @@ protected HeadersSerializer(Map parameters) { this.parameters = parameters; } - public Map> serialize(Map inData) { + public Map> serialize(Map inData) throws NotImplementedException { Map> results = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java index 9fe0745417c..adf3896d557 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java @@ -1,9 +1,10 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData); + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java index 5864f89c901..78015037211 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.Map; @@ -12,7 +13,7 @@ protected PathSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData, String pathWithPlaceholders) { + public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException { String result = pathWithPlaceholders; for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java index 91ea0b041bb..880151ed144 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.HashMap; @@ -14,7 +15,7 @@ protected QuerySerializer(Map parameters) { this.parameters = parameters; } - public Map getQueryMap(Map inData) { + public Map getQueryMap(Map inData) throws NotImplementedException { Map results = new HashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java index 8acfdafcc8a..eef0b6bc371 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java @@ -2,6 +2,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.header.StyleSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import java.util.AbstractMap; @@ -26,7 +27,7 @@ private ParameterStyle getStyle() { } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { ParameterStyle usedStyle = getStyle(); boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; String value; @@ -52,7 +53,7 @@ public AbstractMap.SimpleEntry serialize(@Nullable Object inData } else { // usedStyle == ParameterStyle.DEEP_OBJECT // query - throw new RuntimeException("Style deep object serialization has not yet been implemented."); + throw new NotImplementedException("Style deep object serialization has not yet been implemented."); } return new AbstractMap.SimpleEntry<>(name, value); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java index 37fb90cd4f2..6be6cbffd80 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java @@ -5,6 +5,7 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.Map; @@ -33,14 +34,14 @@ private SerializedRequestBody serializeTextPlain(String contentType, @Nullable O 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) { + 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 RuntimeException("Serialization has not yet been implemented for contentType="+contentType+". If you need it please file a PR"); + 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); + public abstract SerializedRequestBody serialize(T requestBody) throws NotImplementedException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java index bbd744abebc..9ec3e3c44a6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java @@ -2,6 +2,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.header.Header; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; @@ -18,7 +20,7 @@ public HeadersDeserializer(Map headers, MapSchemaValidator headersToValidate = new HashMap<>(); for (Map.Entry> entry: responseHeaders.map().entrySet()) { String headerName = entry.getKey(); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java index 59079f9f1a1..640f2a96415 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java @@ -7,31 +7,27 @@ import java.util.Optional; import org.checkerframework.checker.nullness.qual.Nullable; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.ToNumberPolicy; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.header.Header; public abstract class ResponseDeserializer { public final Map content; public final @Nullable Map headers; - private static final Gson gson = new GsonBuilder() - .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .create(); public ResponseDeserializer(Map content) { this.content = content; this.headers = null; } - protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration); - protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration); + 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); @@ -42,7 +38,7 @@ protected String deserializeTextPlain(byte[] body) { return new String(body, StandardCharsets.UTF_8); } - protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) { + 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); @@ -50,23 +46,28 @@ protected T deserializeBody(String contentType, byte[] body, JsonSchema s String bodyData = deserializeTextPlain(body); return schema.validateAndBox(bodyData, configuration); } - throw new RuntimeException("Deserialization for contentType="+contentType+" has not yet been implemented."); + throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); } - public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { - throw new RuntimeException("Invalid response returned, Content-Type header is missing and it must be included"); + throw new ApiException( + "Invalid response returned, Content-Type header is missing and it must be included", + response + ); } String contentType = contentTypeInfo.get(); - if (content != null && !content.containsKey(contentType)) { - throw new RuntimeException( - "Invalid contentType returned. contentType="+contentType+" was returned "+ - "when only "+content.keySet()+" are defined for statusCode="+response.statusCode() + @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, bodyBytes, configuration); + SealedBodyClass body = getBody(contentType, mediaType, bodyBytes, configuration); HeaderClass headers = getHeaders(response.headers(), configuration); return new DeserializedHttpResponse<>(body, headers); } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java index 20b56db17da..f72be2313af 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java @@ -2,7 +2,10 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import java.net.http.HttpResponse; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration); + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index 0ffcae114bd..7990efaa995 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -86,7 +85,7 @@ public static AnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,7 +97,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -110,7 +109,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,24 +120,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -170,7 +169,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -180,7 +179,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -205,7 +204,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -214,7 +213,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,11 +240,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -260,41 +259,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -310,7 +309,7 @@ public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java index 2cceae9d49f..12af2ba8196 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -44,7 +43,7 @@ public static BooleanJsonSchema1 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,30 +59,30 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index 15b5ca67f26..4853a27dee8 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static DateJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -66,30 +65,30 @@ public String validate(LocalDate arg, SchemaConfiguration configuration) throws if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof LocalDate) { return validate((LocalDate) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java index e695f3c2ac9..a5b4f50d788 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static DateTimeJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -66,30 +65,30 @@ public String validate(ZonedDateTime arg, SchemaConfiguration configuration) thr if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof ZonedDateTime) { return validate((ZonedDateTime) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java index f961e94f802..6651aa44497 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static DecimalJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,28 +60,28 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DecimalJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java index 56f7894f670..9bcb31d2068 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static DoubleJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -56,7 +55,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -65,28 +64,28 @@ public double validate(double arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java index 65221627b46..101b2ea1f57 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static FloatJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -56,7 +55,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @@ -65,28 +64,28 @@ public float validate(float arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FloatJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java index 836fa1db724..2938d08bf21 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -49,7 +48,7 @@ public static Int32JsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -59,7 +58,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } @@ -72,28 +71,28 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int32JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java index da3f9d8d5f7..c17217a89ab 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -51,7 +50,7 @@ public static Int64JsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,11 +60,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } @@ -82,28 +81,28 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int64JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java index 6205c5b4380..34b79da8f66 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -51,7 +50,7 @@ public static IntJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,11 +60,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } @@ -82,28 +81,28 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index 7ebb3106467..8135ed020cf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -56,7 +55,7 @@ public static ListJsonSchema1 getInstance() { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -66,7 +65,7 @@ public static ListJsonSchema1 getInstance() { return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -82,28 +81,28 @@ public static ListJsonSchema1 getInstance() { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ListJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index 47e141dac53..85396cda11a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -54,7 +53,7 @@ public static MapJsonSchema1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -62,7 +61,7 @@ public static MapJsonSchema1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -71,7 +70,7 @@ public static MapJsonSchema1 getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,28 +85,28 @@ public static MapJsonSchema1 getInstance() { if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index de1ed91b0cd..7a1a3367d78 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -88,7 +87,7 @@ public static NotAnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -100,7 +99,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,24 +122,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,7 +171,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -182,7 +181,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -199,7 +198,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -207,7 +206,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,11 +242,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,41 +261,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -312,7 +311,7 @@ public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java index d028dbf295e..af32938007e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -45,7 +44,7 @@ public static NullJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,29 +59,29 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NullJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java index 5c33b047d95..57629ac9557 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -50,7 +49,7 @@ public static NumberJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,19 +59,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -81,28 +80,28 @@ public double validate(double arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java index 749f5faba63..7185ac28496 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static StringJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -74,11 +73,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof LocalDate) { @@ -88,20 +87,20 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java index c2087929db7..2502602642f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static UuidJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -66,30 +65,30 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UuidJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java index 64d9f476798..b7afc854c15 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java @@ -1,5 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -11,7 +13,7 @@ public class AdditionalPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java index eb6bcf21d4a..4b969c68a20 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java @@ -1,11 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; public class AllOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var allOf = data.schema().allOf; if (allOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java index d466518d3fe..19d4e0337c9 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java @@ -10,7 +10,7 @@ public class AnyOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var anyOf = data.schema().anyOf; if (anyOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java index cb28fcb9662..639d32e889e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java @@ -5,7 +5,7 @@ import java.math.BigDecimal; public abstract class BigDecimalValidator { - protected BigDecimal getBigDecimal(Number arg) { + protected BigDecimal getBigDecimal(Number arg) throws ValidationException { if (arg instanceof Integer) { return new BigDecimal((Integer) arg); } else if (arg instanceof Long) { diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java index cbf6ed9ddbf..7e80fd207c2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface BooleanEnumValidator { - boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java index 7bade32a205..96c69f5a7a2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface BooleanSchemaValidator { - boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java index 6409a23e5ca..93872adcc2f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java @@ -10,7 +10,7 @@ public class ConstValidator extends BigDecimalValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!data.schema().constValueSet) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java index fbfd1c9c700..41565577d58 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java @@ -9,7 +9,7 @@ public class ContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof List)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java index 43fe8423969..1f1d1ba5e68 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java @@ -1,5 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; +import org.openapijsonschematools.client.exceptions.ValidationException; + public interface DefaultValueMethod { - T defaultValue(); + T defaultValue() throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java index 77b21ca801d..2640e2f6d8d 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java @@ -11,7 +11,7 @@ public class DependentRequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java index e329529fe8a..f51b5eaf339 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashSet; import java.util.Map; @@ -10,7 +11,7 @@ public class DependentSchemasValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java index aa59920f5ac..f2b8b1e7d74 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface DoubleEnumValidator { - double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java index 3f50d9326c4..18573a77ef7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ElseValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var elseSchema = data.schema().elseSchema; if (elseSchema == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java index 8af756619bd..66563d80960 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java @@ -15,7 +15,7 @@ private static boolean enumContainsArg(Set<@Nullable Object> enumValues, @Nullab @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var enumValues = data.schema().enumValues; if (enumValues == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java index 7d05ff65546..e05df98079f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMaximum = data.schema().exclusiveMaximum; if (exclusiveMaximum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java index 73eb1e547c3..0e06f391f62 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMinimum = data.schema().exclusiveMinimum; if (exclusiveMinimum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java index 33d4834731d..17317003a34 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface FloatEnumValidator { - float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java index c1ca45e44f3..35c089a03c7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java @@ -18,7 +18,7 @@ public class FormatValidator implements KeywordValidator { private final static BigDecimal doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308d); private final static BigDecimal doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308d); - private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) { + private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) throws ValidationException { if (format.startsWith("int")) { // there is a json schema test where 1.0 validates as an integer BigInteger intArg; @@ -85,7 +85,7 @@ private static void validateNumericFormat(Number arg, ValidationMetadata validat } } - private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) { + private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { switch (format) { case "uuid" -> { try { @@ -133,7 +133,7 @@ private static void validateStringFormat(String arg, ValidationMetadata validati @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var format = data.schema().format; if (format == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java index b145ab8007a..2a05893a22a 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java @@ -7,7 +7,7 @@ public class IfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var ifSchema = data.schema().ifSchema; if (ifSchema == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java index 491cb228f18..cb20c832f9b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface IntegerEnumValidator { - int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java index 1b03c0b3094..68d62107337 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class ItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var items = data.schema().items; if (items == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index beb7460b86c..a597533422f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; +import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.checkerframework.checker.nullness.qual.Nullable; import java.math.BigDecimal; import java.time.LocalDate; @@ -221,9 +220,9 @@ protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { this.keywordToValidator = keywordToValidator; } - public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; - public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; - public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; + public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas); + public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; + public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; private List getContainsPathToSchemas( @Nullable Object arg, @@ -262,7 +261,7 @@ private List getContainsPathToSchemas( private PathToSchemasMap getPatternPropertiesPathToSchemas( @Nullable Object arg, ValidationMetadata validationMetadata - ) { + ) throws ValidationException { if (!(arg instanceof Map mapArg) || patternProperties == null) { return new PathToSchemasMap(); } @@ -270,7 +269,7 @@ private PathToSchemasMap getPatternPropertiesPathToSchemas( for (Map.Entry entry: mapArg.entrySet()) { Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new InvalidTypeException("Invalid non-string type for map key"); + throw new ValidationException("Invalid non-string type for map key"); } List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); propPathToItem.add(key); @@ -306,7 +305,7 @@ private PathToSchemasMap getIfPathToSchemas( try { var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException | InvalidTypeException ignored) {} + } catch (ValidationException ignored) {} return pathToSchemas; } @@ -389,7 +388,7 @@ protected Void castToAllowedTypes(Void arg, List pathToItem, Set castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { pathSet.add(pathToItem); List<@Nullable Object> argFixed = new ArrayList<>(); int i =0; @@ -403,13 +402,13 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws ValidationException { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new ValidationException("Invalid non-string key value"); } Object val = entry.getValue(); List newPathToItem = new ArrayList<>(pathToItem); @@ -420,7 +419,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set pathToItem, Set> pathSet) { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws ValidationException { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { @@ -448,7 +447,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set argClass = arg.getClass(); - throw new InvalidTypeException("Invalid type passed in for input="+arg+" type="+argClass); + throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); } } @@ -468,7 +467,7 @@ public String getNewInstance(String arg, List pathToItem, PathToSchemasM return arg; } - protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) { + protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) throws ValidationException { PathToSchemasMap pathToSchemasMap = new PathToSchemasMap(); // todo add check of validationMetadata.validationRanEarlier(this) PathToSchemasMap otherPathToSchemas = validate(jsonSchema, arg, validationMetadata); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index d0ff52b29c8..a7752b37595 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas); - OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; + OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException; + BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java index 88410ffc5e2..6b6bcd88c47 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface LongEnumValidator { - long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java index 984693428e8..9bd7d432165 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; import java.util.Map; public interface MapSchemaValidator { - OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas); - OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; + OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException; + BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java index 9e9b3b92c18..315771b9e0c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java @@ -9,7 +9,7 @@ public class MaxContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxContains = data.schema().maxContains; if (maxContains == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java index 98ed5cb4ff4..2749843cbf2 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java @@ -9,7 +9,7 @@ public class MaxItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxItems = data.schema().maxItems; if (maxItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java index 08d91666c5d..f2a77fa91f6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java @@ -7,7 +7,7 @@ public class MaxLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxLength = data.schema().maxLength; if (maxLength == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java index d117f1688e2..57a53e71be5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java @@ -9,7 +9,7 @@ public class MaxPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxProperties = data.schema().maxProperties; if (maxProperties == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java index 702f09686dc..df1c7f5c338 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java @@ -7,7 +7,7 @@ public class MaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maximum = data.schema().maximum; if (maximum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java index 1827e95cc83..6ea4404dc1f 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java @@ -9,7 +9,7 @@ public class MinContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minContains = data.schema().minContains; if (minContains == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java index d1933ca7750..25bae60bda7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java @@ -9,7 +9,7 @@ public class MinItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minItems = data.schema().minItems; if (minItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java index 1defdc891e3..f4639e8a207 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java @@ -7,7 +7,7 @@ public class MinLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minLength = data.schema().minLength; if (minLength == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java index c0b99e7fb7d..011ac76dd31 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java @@ -9,7 +9,7 @@ public class MinPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minProperties = data.schema().minProperties; if (minProperties == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java index 3b539120e42..76065fe50b5 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java @@ -7,7 +7,7 @@ public class MinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minimum = data.schema().minimum; if (minimum == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java index eebc07a0f10..d8273d04d9c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java @@ -9,7 +9,7 @@ public class MultipleOfValidator extends BigDecimalValidator implements KeywordV @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var multipleOf = data.schema().multipleOf; if (multipleOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java index b077e2056a1..3e6b8e91e7c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java @@ -7,7 +7,7 @@ public class NotValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var not = data.schema().not; if (not == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java index 96b52a74b9f..bc6bd3663bb 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface NullEnumValidator { - Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java index c49fc0150fe..c30cde9f9b7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java @@ -1,13 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; -import java.util.List; -import java.util.Set; - public interface NullSchemaValidator { - Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java index c426b250af8..dd3c349ad69 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface NumberSchemaValidator { - Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java index 3c4f4b5a085..7dd5f4128ac 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java @@ -10,7 +10,7 @@ public class OneOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var oneOf = data.schema().oneOf; if (oneOf == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java index eceeb19e311..d7eebd78098 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java @@ -7,7 +7,7 @@ public class PatternValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var pattern = data.schema().pattern; if (pattern == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java index 237bc250190..510f3a8760e 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class PrefixItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var prefixItems = data.schema().prefixItems; if (prefixItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java index b8ddd6fcb46..8803b661fd6 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -12,7 +13,7 @@ public class PropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var properties = data.schema().properties; if (properties == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java index 087cd308b11..0169ff5bdba 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +11,7 @@ public class PropertyNamesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var propertyNames = data.schema().propertyNames; if (propertyNames == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java index f2e1a8ecde8..2519cbcfd3b 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -12,7 +12,7 @@ public class RequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var required = data.schema().required; if (required == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java index 49ca190ae5f..baf86081fd7 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface StringEnumValidator { - String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java index 8cbc38335bf..e6729893fca 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface StringSchemaValidator { - String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + String validate(String arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java index bf599bc812f..75c083e2edc 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ThenValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var then = data.schema().then; if (then == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java index bb4133a770e..300d472cfdf 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; import java.util.Map; @@ -10,7 +10,7 @@ public class TypeValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var type = data.schema().type; if (type == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java index 8903d0b19a7..407904da444 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class UnevaluatedItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedItems = data.schema().unevaluatedItems; if (unevaluatedItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java index 344c0cfab1b..8fd34950404 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -11,7 +11,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedProperties = data.schema().unevaluatedProperties; if (unevaluatedProperties == null) { return null; @@ -27,7 +27,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { JsonSchema unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties); for(Map.Entry entry: mapArg.entrySet()) { if (!(entry.getKey() instanceof String propName)) { - throw new InvalidTypeException("Map keys must be strings"); + throw new ValidationException("Map keys must be strings"); } List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); propPathToItem.add(propName); diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java index a42a7d60b60..6b40ba79fff 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -11,7 +11,7 @@ public class UniqueItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var uniqueItems = data.schema().uniqueItems; if (uniqueItems == null) { return null; diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index 1c23a427dd0..8e17449eb27 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; @@ -73,7 +72,7 @@ public static UnsetAnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -85,7 +84,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -97,7 +96,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -108,24 +107,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -157,7 +156,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -167,7 +166,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -192,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,11 +227,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -247,41 +246,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -297,7 +296,7 @@ public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaC } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java index 8c93a971aae..f736485870c 100644 --- a/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java +++ b/samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java @@ -1,8 +1,6 @@ package org.openapijsonschematools.client.servers; -import org.checkerframework.checker.nullness.qual.Nullable; - public interface ServerProvider { - Server getServer(@Nullable T serverIndex); + Server getServer(T serverIndex); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java index 990f21a1148..476dab2c3da 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java @@ -5,10 +5,13 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.net.http.HttpHeaders; +import java.util.AbstractMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -22,7 +25,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -100,7 +103,7 @@ public Void encoding() { return null; } } - Map> content = Map.of( + AbstractMap.SimpleEntry> content = new AbstractMap.SimpleEntry<>( "application/json", new ApplicationJsonMediaType() ); for (ParamTestCase testCase: testCases) { diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java index b0eaf780b2e..b1dc30975ab 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java @@ -5,7 +5,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.ListJsonSchema; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -28,7 +29,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -105,7 +106,7 @@ public void testSerialization() { ); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value, "color", false, configuration) ); } @@ -126,7 +127,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserialization() { + public void testDeserialization() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java index a19ea8c1007..a46f7fbb5f7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +33,7 @@ protected CookieParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java index 63f3159bf0a..2a9acf14219 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -33,7 +34,7 @@ protected HeaderParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java index bef110af08d..3ff2ac5ed88 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +33,7 @@ protected PathParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java index ed5aae7e580..7cb559fef3c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +33,7 @@ protected QueryParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java index 871d4f073f3..4d799c14c72 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java @@ -3,7 +3,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +26,7 @@ public HeaderParameter(@Nullable Boolean explode) { } @Test - public void testHeaderSerialization() { + public void testHeaderSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -91,7 +91,7 @@ public void testHeaderSerialization() { var boolHeader = new HeaderParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value) ); } @@ -104,7 +104,7 @@ public PathParameter(@Nullable Boolean explode) { } @Test - public void testPathSerialization() { + public void testPathSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -169,7 +169,7 @@ public void testPathSerialization() { var pathParameter = new PathParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> pathParameter.serialize(value) ); } @@ -182,7 +182,7 @@ public CookieParameter(@Nullable Boolean explode) { } @Test - public void testCookieSerialization() { + public void testCookieSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -247,7 +247,7 @@ public void testCookieSerialization() { var cookieParameter = new CookieParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> cookieParameter.serialize(value) ); } @@ -260,7 +260,7 @@ public PathMatrixParameter(@Nullable Boolean explode) { } @Test - public void testPathMatrixSerialization() { + public void testPathMatrixSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -331,7 +331,7 @@ public PathLabelParameter(@Nullable Boolean explode) { } @Test - public void testPathLabelSerialization() { + public void testPathLabelSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java index f4ea29fccb3..413b092634f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java @@ -3,7 +3,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +26,7 @@ public QueryParameterNoStyle(@Nullable Boolean explode) { } @Test - public void testQueryParameterNoStyleSerialization() { + public void testQueryParameterNoStyleSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -91,7 +91,7 @@ public void testQueryParameterNoStyleSerialization() { var parameter = new QueryParameterNoStyle(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> parameter.serialize(value) ); } @@ -104,7 +104,7 @@ public QueryParameterSpaceDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterSpaceDelimitedSerialization() { + public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -151,7 +151,7 @@ public QueryParameterPipeDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterPipeDelimitedSerialization() { + public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java index 9f0c86ec5c4..93a5adb916a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -47,7 +49,7 @@ public MyRequestBodySerializer() { true); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { @@ -93,7 +95,7 @@ private String getJsonBody(SerializedRequestBody requestBody) { } @Test - public void testSerializeApplicationJson() { + public void testSerializeApplicationJson() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); String jsonBody; @@ -164,7 +166,7 @@ public void testSerializeApplicationJson() { } @Test - public void testSerializeTextPlain() { + public void testSerializeTextPlain() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); SerializedRequestBody requestBody = serializer.serialize( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java index 408f04582a8..e4656ecbbc3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java @@ -8,6 +8,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -64,11 +67,7 @@ public MyResponseDeserializer() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + 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); @@ -152,7 +151,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserializeApplicationJsonNull() { + 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"); @@ -168,7 +167,7 @@ public void testDeserializeApplicationJsonNull() { } @Test - public void testDeserializeApplicationJsonTrue() { + 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"); @@ -184,7 +183,7 @@ public void testDeserializeApplicationJsonTrue() { } @Test - public void testDeserializeApplicationJsonFalse() { + 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"); @@ -200,7 +199,7 @@ public void testDeserializeApplicationJsonFalse() { } @Test - public void testDeserializeApplicationJsonInt() { + 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"); @@ -216,7 +215,7 @@ public void testDeserializeApplicationJsonInt() { } @Test - public void testDeserializeApplicationJsonFloat() { + 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"); @@ -232,7 +231,7 @@ public void testDeserializeApplicationJsonFloat() { } @Test - public void testDeserializeApplicationJsonString() { + 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"); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java index 9b76ff56c45..206c683cd50 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java @@ -5,6 +5,7 @@ import org.junit.Test; 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; @@ -26,13 +27,13 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testValidateNull() { + public void testValidateNull() throws ValidationException { Void validatedValue = schema.validate((Void) null, configuration); assertNull(validatedValue); } @Test - public void testValidateBoolean() { + public void testValidateBoolean() throws ValidationException { boolean trueValue = schema.validate(true, configuration); Assert.assertTrue(trueValue); @@ -41,49 +42,49 @@ public void testValidateBoolean() { } @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException { int validatedValue = schema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException { long validatedValue = schema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException { float validatedValue = schema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException { double validatedValue = schema.validate(70.6458763d, configuration); Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); } @Test - public void testValidateString() { + public void testValidateString() throws ValidationException { String validatedValue = schema.validate("a", configuration); Assert.assertEquals(validatedValue, "a"); } @Test - public void testValidateZonedDateTime() { + public void testValidateZonedDateTime() throws ValidationException { String validatedValue = schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration); Assert.assertEquals(validatedValue, "2017-07-21T17:32:28Z"); } @Test - public void testValidateLocalDate() { + public void testValidateLocalDate() throws ValidationException { String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); Assert.assertEquals(validatedValue, "2017-07-21"); } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException { LinkedHashMap inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap validatedValue = schema.validate(inMap, configuration); @@ -93,7 +94,7 @@ public void testValidateMap() { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException { ArrayList inList = new ArrayList<>(); inList.add(LocalDate.of(2017, 7, 21)); FrozenList validatedValue = schema.validate(inList, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index 42dfcabf0d0..0ca5e56ecd2 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -5,13 +5,12 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -53,12 +52,12 @@ public FrozenList getNewInstance(List arg, List pathToItem, P itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -66,7 +65,7 @@ public FrozenList getNewInstance(List arg, List pathToItem, P return new FrozenList<>(items); } - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -77,7 +76,7 @@ public FrozenList validate(List arg, SchemaConfiguration configuratio } @Override - public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithItemsSchemaBoxedList(validate(arg, configuration)); } @@ -86,23 +85,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return new ArrayWithItemsSchemaBoxedList(validate(listArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -111,7 +110,7 @@ protected ArrayWithOutputClsSchemaList(FrozenList m) { super(m); } - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) { + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithOutputClsSchema().validate(arg, configuration); } } @@ -138,12 +137,12 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -152,7 +151,7 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat return new ArrayWithOutputClsSchemaList(newInstanceItems); } - public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,7 +162,7 @@ public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration co } @Override - public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)); } @@ -172,23 +171,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return new ArrayWithOutputClsSchemaBoxedList(validate(listArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -202,7 +201,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateArrayWithItemsSchema() { + public void testValidateArrayWithItemsSchema() throws ValidationException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); @@ -227,7 +226,7 @@ public void testValidateArrayWithItemsSchema() { } @Test - public void testValidateArrayWithOutputClsSchema() { + public void testValidateArrayWithOutputClsSchema() throws ValidationException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java index 0b4261a7ef0..7ac24fbeaa2 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java @@ -4,9 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; 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; @@ -24,13 +23,13 @@ public class BooleanSchemaTest { ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException { boolean validatedValue = booleanJsonSchema.validate(true, configuration); Assert.assertTrue(validatedValue); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException { boolean validatedValue = booleanJsonSchema.validate(false, configuration); Assert.assertFalse(validatedValue); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java index cb4aa60f4a8..17d5f35dcbe 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java @@ -5,9 +5,9 @@ import org.junit.Test; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -35,7 +35,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException { List inList = new ArrayList<>(); inList.add("today"); FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java index 85afb15a068..5b03fec8609 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java @@ -5,9 +5,9 @@ import org.junit.Test; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -37,7 +37,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException { Map inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap<@Nullable Object> validatedValue = mapJsonSchema.validate(inMap, configuration); diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java index d566f15a69e..eb1c70ef049 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java @@ -4,9 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; 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; @@ -26,7 +25,7 @@ public class NullSchemaTest { @Test @SuppressWarnings("nullness") - public void testValidateNull() { + public void testValidateNull() throws ValidationException { Void validatedValue = nullJsonSchema.validate(null, configuration); Assert.assertNull(validatedValue); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java index 2ab8d8a8121..fcde27495e3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java @@ -4,8 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; 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; @@ -23,25 +23,25 @@ public class NumberSchemaTest { ); @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException { int validatedValue = numberJsonSchema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException { long validatedValue = numberJsonSchema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException { float validatedValue = numberJsonSchema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException { double validatedValue = numberJsonSchema.validate(3.14d, configuration); Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index 02729b0f046..fad3d574369 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -5,14 +5,13 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.PropertyEntry; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -62,7 +61,7 @@ public static ObjectWithPropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -70,7 +69,7 @@ public static ObjectWithPropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -79,7 +78,7 @@ public static ObjectWithPropsSchema getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,7 +89,7 @@ public static ObjectWithPropsSchema getInstance() { } @Override - public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)); } @@ -99,23 +98,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -146,7 +145,7 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -154,19 +153,19 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(castValue instanceof String)) { - throw new InvalidTypeException("Invalid type for property value"); + throw new RuntimeException("Invalid type for property value"); } properties.put(propertyName, (String) castValue); } return new FrozenMap<>(properties); } - public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,24 +176,24 @@ public FrozenMap validate(Map arg, SchemaConfiguration configurati } @Override - public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -202,7 +201,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -235,7 +234,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -243,7 +242,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -252,7 +251,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -263,24 +262,24 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { } @Override - public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -288,7 +287,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -297,7 +296,7 @@ protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { super(m); } - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) { + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); } } @@ -330,7 +329,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -338,7 +337,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -347,7 +346,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); } - public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -358,24 +357,24 @@ public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration } @Override - public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithOutputTypeSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -383,7 +382,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -398,7 +397,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateObjectWithPropsSchema() { + public void testValidateObjectWithPropsSchema() throws ValidationException { ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); // map with only property works @@ -429,7 +428,7 @@ public void testValidateObjectWithPropsSchema() { } @Test - public void testValidateObjectWithAddpropsSchema() { + public void testValidateObjectWithAddpropsSchema() throws ValidationException { ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); // map with only property works @@ -460,7 +459,7 @@ public void testValidateObjectWithAddpropsSchema() { } @Test - public void testValidateObjectWithPropsAndAddpropsSchema() { + public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException { ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); // map with only property works @@ -499,7 +498,7 @@ public void testValidateObjectWithPropsAndAddpropsSchema() { } @Test - public void testValidateObjectWithOutputTypeSchema() { + public void testValidateObjectWithOutputTypeSchema() throws ValidationException { ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); // map with only property works diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java index c8079ef632a..d3cba69fb20 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java @@ -4,9 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; 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; @@ -28,13 +27,13 @@ public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchem ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException { Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); Assert.assertEquals(validatedValue, Boolean.TRUE); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException { Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); Assert.assertEquals(validatedValue, Boolean.FALSE); } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java index 40a01c9983d..ea3ec6ae8c3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java @@ -5,7 +5,7 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; @@ -46,19 +46,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } @@ -70,7 +70,7 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -105,7 +105,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java index 1481f312f6a..cb03bcf8f5b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java @@ -34,7 +34,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testIntFormatSucceedsWithFloat() { + public void testIntFormatSucceedsWithFloat() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -59,7 +59,7 @@ public void testIntFormatFailsWithFloat() { } @Test - public void testIntFormatSucceedsWithInt() { + public void testIntFormatSucceedsWithInt() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -84,7 +84,7 @@ public void testInt32UnderMinFails() { } @Test - public void testInt32InclusiveMinSucceeds() { + public void testInt32InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -97,7 +97,7 @@ public void testInt32InclusiveMinSucceeds() { } @Test - public void testInt32InclusiveMaxSucceeds() { + public void testInt32InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -135,7 +135,7 @@ public void testInt64UnderMinFails() { } @Test - public void testInt64InclusiveMinSucceeds() { + public void testInt64InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -148,7 +148,7 @@ public void testInt64InclusiveMinSucceeds() { } @Test - public void testInt64InclusiveMaxSucceeds() { + public void testInt64InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -186,7 +186,7 @@ public void testFloatUnderMinFails() { } @Test - public void testFloatInclusiveMinSucceeds() { + public void testFloatInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -199,7 +199,7 @@ public void testFloatInclusiveMinSucceeds() { } @Test - public void testFloatInclusiveMaxSucceeds() { + public void testFloatInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -236,7 +236,7 @@ public void testDoubleUnderMinFails() { } @Test - public void testDoubleInclusiveMinSucceeds() { + public void testDoubleInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -249,7 +249,7 @@ public void testDoubleInclusiveMinSucceeds() { } @Test - public void testDoubleInclusiveMaxSucceeds() { + public void testDoubleInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -286,7 +286,7 @@ public void testInvalidNumberStringFails() { } @Test - public void testValidFloatNumberStringSucceeds() { + public void testValidFloatNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -299,7 +299,7 @@ public void testValidFloatNumberStringSucceeds() { } @Test - public void testValidIntNumberStringSucceeds() { + public void testValidIntNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -324,7 +324,7 @@ public void testInvalidDateStringFails() { } @Test - public void testValidDateStringSucceeds() { + public void testValidDateStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -349,7 +349,7 @@ public void testInvalidDateTimeStringFails() { } @Test - public void testValidDateTimeStringSucceeds() { + public void testValidDateTimeStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java index e0e4a0c859e..5b70aada50c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java @@ -6,7 +6,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; @@ -37,25 +36,25 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List listArg) { return getNewInstance(listArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return validate(listArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithItemsSchemaBoxedList(); } } @Test - public void testCorrectItemsSucceeds() { + public void testCorrectItemsSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -89,7 +88,7 @@ public void testCorrectItemsSucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java index 8a14df7edd6..c1cc4c84e9e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -40,25 +39,25 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof String) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new SomeSchemaBoxedString(); } } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java index 492f45af0c7..e35b145e721 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java @@ -5,9 +5,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.StringJsonSchema; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -36,19 +35,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } @@ -59,7 +58,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( @@ -92,7 +91,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java index 65ff030d74b..58c160a0499 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -32,19 +31,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithRequiredSchemaBoxedMap(); } } @@ -55,7 +54,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -78,7 +77,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java index ebc8bbff1f5..c31855af4ff 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java @@ -18,7 +18,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { final TypeValidator validator = new TypeValidator(); ValidationMetadata validationMetadata = new ValidationMetadata( new ArrayList<>(), diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/request_body/content/application_json/schema.md index 8c6b8553d40..c280e8d302e 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**additionalproperties_allows_a_schema_which_should_validate.AdditionalpropertiesAllowsASchemaWhichShouldValidate**](../../../../../../../components/schema/additionalproperties_allows_a_schema_which_should_validate.md) | [additionalproperties_allows_a_schema_which_should_validate.AdditionalpropertiesAllowsASchemaWhichShouldValidateDictInput](../../../../../../../components/schema/additionalproperties_allows_a_schema_which_should_validate.md#additionalpropertiesallowsaschemawhichshouldvalidatedictinput), [additionalproperties_allows_a_schema_which_should_validate.AdditionalpropertiesAllowsASchemaWhichShouldValidateDict](../../../../../../../components/schema/additionalproperties_allows_a_schema_which_should_validate.md#additionalpropertiesallowsaschemawhichshouldvalidatedict) | [additionalproperties_allows_a_schema_which_should_validate.AdditionalpropertiesAllowsASchemaWhichShouldValidateDict](../../../../../../../components/schema/additionalproperties_allows_a_schema_which_should_validate.md#additionalpropertiesallowsaschemawhichshouldvalidatedict) +[**additionalproperties_allows_a_schema_which_should_validate.AdditionalpropertiesAllowsASchemaWhichShouldValidate**](../../../../../../components/schema/additionalproperties_allows_a_schema_which_should_validate.md) | [additionalproperties_allows_a_schema_which_should_validate.AdditionalpropertiesAllowsASchemaWhichShouldValidateDictInput](../../../../../../components/schema/additionalproperties_allows_a_schema_which_should_validate.md#additionalpropertiesallowsaschemawhichshouldvalidatedictinput), [additionalproperties_allows_a_schema_which_should_validate.AdditionalpropertiesAllowsASchemaWhichShouldValidateDict](../../../../../../components/schema/additionalproperties_allows_a_schema_which_should_validate.md#additionalpropertiesallowsaschemawhichshouldvalidatedict) | [additionalproperties_allows_a_schema_which_should_validate.AdditionalpropertiesAllowsASchemaWhichShouldValidateDict](../../../../../../components/schema/additionalproperties_allows_a_schema_which_should_validate.md#additionalpropertiesallowsaschemawhichshouldvalidatedict) diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md index 97404c9ba73..0f7b2db5fec 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefault**](../../../../../../../components/schema/additionalproperties_are_allowed_by_default.md) | [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDictInput](../../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdictinput), [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDict](../../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDict](../../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefault**](../../../../../../components/schema/additionalproperties_are_allowed_by_default.md) | [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDictInput](../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdictinput), [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDict](../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDict](../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/request_body/content/application_json/schema.md index cd7300a1e34..55937f52694 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItself**](../../../../../../../components/schema/additionalproperties_can_exist_by_itself.md) | [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDictInput](../../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdictinput), [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDict](../../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdict) | [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDict](../../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdict) +[**additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItself**](../../../../../../components/schema/additionalproperties_can_exist_by_itself.md) | [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDictInput](../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdictinput), [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDict](../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdict) | [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDict](../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdict) diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/request_body/content/application_json/schema.md index ac548c5f87d..9a1d3a8f1ae 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**additionalproperties_should_not_look_in_applicators.AdditionalpropertiesShouldNotLookInApplicators**](../../../../../../../components/schema/additionalproperties_should_not_look_in_applicators.md) | [additionalproperties_should_not_look_in_applicators.AdditionalpropertiesShouldNotLookInApplicatorsDictInput](../../../../../../../components/schema/additionalproperties_should_not_look_in_applicators.md#additionalpropertiesshouldnotlookinapplicatorsdictinput), [additionalproperties_should_not_look_in_applicators.AdditionalpropertiesShouldNotLookInApplicatorsDict](../../../../../../../components/schema/additionalproperties_should_not_look_in_applicators.md#additionalpropertiesshouldnotlookinapplicatorsdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [additionalproperties_should_not_look_in_applicators.AdditionalpropertiesShouldNotLookInApplicatorsDict](../../../../../../../components/schema/additionalproperties_should_not_look_in_applicators.md#additionalpropertiesshouldnotlookinapplicatorsdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**additionalproperties_should_not_look_in_applicators.AdditionalpropertiesShouldNotLookInApplicators**](../../../../../../components/schema/additionalproperties_should_not_look_in_applicators.md) | [additionalproperties_should_not_look_in_applicators.AdditionalpropertiesShouldNotLookInApplicatorsDictInput](../../../../../../components/schema/additionalproperties_should_not_look_in_applicators.md#additionalpropertiesshouldnotlookinapplicatorsdictinput), [additionalproperties_should_not_look_in_applicators.AdditionalpropertiesShouldNotLookInApplicatorsDict](../../../../../../components/schema/additionalproperties_should_not_look_in_applicators.md#additionalpropertiesshouldnotlookinapplicatorsdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [additionalproperties_should_not_look_in_applicators.AdditionalpropertiesShouldNotLookInApplicatorsDict](../../../../../../components/schema/additionalproperties_should_not_look_in_applicators.md#additionalpropertiesshouldnotlookinapplicatorsdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/request_body/content/application_json/schema.md index 607ab49d6ea..825301dd434 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_combined_with_anyof_oneof.AllofCombinedWithAnyofOneof**](../../../../../../../components/schema/allof_combined_with_anyof_oneof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_combined_with_anyof_oneof.AllofCombinedWithAnyofOneof**](../../../../../../components/schema/allof_combined_with_anyof_oneof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_request_body/post/request_body/content/application_json/schema.md index 498deea5fc1..ebf813f2858 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof.Allof**](../../../../../../../components/schema/allof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof.Allof**](../../../../../../components/schema/allof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_simple_types_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_simple_types_request_body/post/request_body/content/application_json/schema.md index c32f4daa8e2..e9502883f2b 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_simple_types_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_simple_types_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_simple_types.AllofSimpleTypes**](../../../../../../../components/schema/allof_simple_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_simple_types.AllofSimpleTypes**](../../../../../../components/schema/allof_simple_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_base_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_base_schema_request_body/post/request_body/content/application_json/schema.md index 6d88dbd19bf..0fa274f9d6c 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_base_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_base_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_with_base_schema.AllofWithBaseSchema**](../../../../../../../components/schema/allof_with_base_schema.md) | [allof_with_base_schema.AllofWithBaseSchemaDictInput](../../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadictinput), [allof_with_base_schema.AllofWithBaseSchemaDict](../../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [allof_with_base_schema.AllofWithBaseSchemaDict](../../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_with_base_schema.AllofWithBaseSchema**](../../../../../../components/schema/allof_with_base_schema.md) | [allof_with_base_schema.AllofWithBaseSchemaDictInput](../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadictinput), [allof_with_base_schema.AllofWithBaseSchemaDict](../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [allof_with_base_schema.AllofWithBaseSchemaDict](../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md index e682450cf0a..f95721bd3a4 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_with_one_empty_schema.AllofWithOneEmptySchema**](../../../../../../../components/schema/allof_with_one_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_with_one_empty_schema.AllofWithOneEmptySchema**](../../../../../../components/schema/allof_with_one_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/request_body/content/application_json/schema.md index 3b259024bb0..81fdaf4249e 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_with_the_first_empty_schema.AllofWithTheFirstEmptySchema**](../../../../../../../components/schema/allof_with_the_first_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_with_the_first_empty_schema.AllofWithTheFirstEmptySchema**](../../../../../../components/schema/allof_with_the_first_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/request_body/content/application_json/schema.md index 3fc81b0a707..f219a60b303 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_with_the_last_empty_schema.AllofWithTheLastEmptySchema**](../../../../../../../components/schema/allof_with_the_last_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_with_the_last_empty_schema.AllofWithTheLastEmptySchema**](../../../../../../components/schema/allof_with_the_last_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/request_body/content/application_json/schema.md index 99c259b26b3..3a63262604e 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_with_two_empty_schemas.AllofWithTwoEmptySchemas**](../../../../../../../components/schema/allof_with_two_empty_schemas.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_with_two_empty_schemas.AllofWithTwoEmptySchemas**](../../../../../../components/schema/allof_with_two_empty_schemas.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_complex_types_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_complex_types_request_body/post/request_body/content/application_json/schema.md index 7d9c824d9f2..ed387aeb5d3 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_complex_types_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_complex_types_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**anyof_complex_types.AnyofComplexTypes**](../../../../../../../components/schema/anyof_complex_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**anyof_complex_types.AnyofComplexTypes**](../../../../../../components/schema/anyof_complex_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_request_body/post/request_body/content/application_json/schema.md index 80347c140a4..282ecd4b538 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**anyof.Anyof**](../../../../../../../components/schema/anyof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**anyof.Anyof**](../../../../../../components/schema/anyof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_with_base_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_with_base_schema_request_body/post/request_body/content/application_json/schema.md index a26409301b4..aa0705d8920 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_with_base_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_with_base_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**anyof_with_base_schema.AnyofWithBaseSchema**](../../../../../../../components/schema/anyof_with_base_schema.md) | str | str +[**anyof_with_base_schema.AnyofWithBaseSchema**](../../../../../../components/schema/anyof_with_base_schema.md) | str | str diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md index bd5d5cb2ab0..6ebf65466f4 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**anyof_with_one_empty_schema.AnyofWithOneEmptySchema**](../../../../../../../components/schema/anyof_with_one_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**anyof_with_one_empty_schema.AnyofWithOneEmptySchema**](../../../../../../components/schema/anyof_with_one_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_array_type_matches_arrays_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_array_type_matches_arrays_request_body/post/request_body/content/application_json/schema.md index eede790e3a7..df4c4f65334 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_array_type_matches_arrays_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_array_type_matches_arrays_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**array_type_matches_arrays.ArrayTypeMatchesArrays**](../../../../../../../components/schema/array_type_matches_arrays.md) | [array_type_matches_arrays.ArrayTypeMatchesArraysTupleInput](../../../../../../../components/schema/array_type_matches_arrays.md#arraytypematchesarraystupleinput), [array_type_matches_arrays.ArrayTypeMatchesArraysTuple](../../../../../../../components/schema/array_type_matches_arrays.md#arraytypematchesarraystuple) | [array_type_matches_arrays.ArrayTypeMatchesArraysTuple](../../../../../../../components/schema/array_type_matches_arrays.md#arraytypematchesarraystuple) +[**array_type_matches_arrays.ArrayTypeMatchesArrays**](../../../../../../components/schema/array_type_matches_arrays.md) | [array_type_matches_arrays.ArrayTypeMatchesArraysTupleInput](../../../../../../components/schema/array_type_matches_arrays.md#arraytypematchesarraystupleinput), [array_type_matches_arrays.ArrayTypeMatchesArraysTuple](../../../../../../components/schema/array_type_matches_arrays.md#arraytypematchesarraystuple) | [array_type_matches_arrays.ArrayTypeMatchesArraysTuple](../../../../../../components/schema/array_type_matches_arrays.md#arraytypematchesarraystuple) diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_boolean_type_matches_booleans_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_boolean_type_matches_booleans_request_body/post/request_body/content/application_json/schema.md index 8aff1ed419a..03da442f0e7 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_boolean_type_matches_booleans_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_boolean_type_matches_booleans_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**boolean_type_matches_booleans.BooleanTypeMatchesBooleans**](../../../../../../../components/schema/boolean_type_matches_booleans.md) | bool | bool +[**boolean_type_matches_booleans.BooleanTypeMatchesBooleans**](../../../../../../components/schema/boolean_type_matches_booleans.md) | bool | bool diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_int_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_int_request_body/post/request_body/content/application_json/schema.md index 1681067de6d..c9873b7f562 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_int_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_int_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**by_int.ByInt**](../../../../../../../components/schema/by_int.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**by_int.ByInt**](../../../../../../components/schema/by_int.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_number_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_number_request_body/post/request_body/content/application_json/schema.md index 0b0a0d5b245..399c0e1d502 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_number_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_number_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**by_number.ByNumber**](../../../../../../../components/schema/by_number.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**by_number.ByNumber**](../../../../../../components/schema/by_number.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_small_number_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_small_number_request_body/post/request_body/content/application_json/schema.md index 03fbf135421..62d91ff0d70 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_small_number_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_by_small_number_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**by_small_number.BySmallNumber**](../../../../../../../components/schema/by_small_number.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**by_small_number.BySmallNumber**](../../../../../../components/schema/by_small_number.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_date_time_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_date_time_format_request_body/post/request_body/content/application_json/schema.md index ab8468fcad5..bcdb01bd43f 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_date_time_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_date_time_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**date_time_format.DateTimeFormat**](../../../../../../../components/schema/date_time_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**date_time_format.DateTimeFormat**](../../../../../../components/schema/date_time_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_email_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_email_format_request_body/post/request_body/content/application_json/schema.md index be684b0256b..92191b36009 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_email_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_email_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**email_format.EmailFormat**](../../../../../../../components/schema/email_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**email_format.EmailFormat**](../../../../../../components/schema/email_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/request_body/content/application_json/schema.md index d6830b123f1..7683e1af034 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enum_with0_does_not_match_false.EnumWith0DoesNotMatchFalse**](../../../../../../../components/schema/enum_with0_does_not_match_false.md) | float, int | float, int +[**enum_with0_does_not_match_false.EnumWith0DoesNotMatchFalse**](../../../../../../components/schema/enum_with0_does_not_match_false.md) | float, int | float, int diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/request_body/content/application_json/schema.md index 75f4e0d2e07..0b57ccf0370 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enum_with1_does_not_match_true.EnumWith1DoesNotMatchTrue**](../../../../../../../components/schema/enum_with1_does_not_match_true.md) | float, int | float, int +[**enum_with1_does_not_match_true.EnumWith1DoesNotMatchTrue**](../../../../../../components/schema/enum_with1_does_not_match_true.md) | float, int | float, int diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md index 3fca70a2f0e..0f41616592b 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enum_with_escaped_characters.EnumWithEscapedCharacters**](../../../../../../../components/schema/enum_with_escaped_characters.md) | typing.Literal["foo\nbar", "foo\rbar"] | typing.Literal["foo\nbar", "foo\rbar"] +[**enum_with_escaped_characters.EnumWithEscapedCharacters**](../../../../../../components/schema/enum_with_escaped_characters.md) | typing.Literal["foo\nbar", "foo\rbar"] | typing.Literal["foo\nbar", "foo\rbar"] diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/request_body/content/application_json/schema.md index e20c7195016..e3966c79ebd 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enum_with_false_does_not_match0.EnumWithFalseDoesNotMatch0**](../../../../../../../components/schema/enum_with_false_does_not_match0.md) | typing.Literal[False] | typing.Literal[False] +[**enum_with_false_does_not_match0.EnumWithFalseDoesNotMatch0**](../../../../../../components/schema/enum_with_false_does_not_match0.md) | typing.Literal[False] | typing.Literal[False] diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/request_body/content/application_json/schema.md index 0937211d4ad..b28244c1a4a 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enum_with_true_does_not_match1.EnumWithTrueDoesNotMatch1**](../../../../../../../components/schema/enum_with_true_does_not_match1.md) | typing.Literal[True] | typing.Literal[True] +[**enum_with_true_does_not_match1.EnumWithTrueDoesNotMatch1**](../../../../../../components/schema/enum_with_true_does_not_match1.md) | typing.Literal[True] | typing.Literal[True] diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enums_in_properties_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enums_in_properties_request_body/post/request_body/content/application_json/schema.md index 8b49e07cd7d..f9bddd0f5d1 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enums_in_properties_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_enums_in_properties_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enums_in_properties.EnumsInProperties**](../../../../../../../components/schema/enums_in_properties.md) | [enums_in_properties.EnumsInPropertiesDictInput](../../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdictinput), [enums_in_properties.EnumsInPropertiesDict](../../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdict) | [enums_in_properties.EnumsInPropertiesDict](../../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdict) +[**enums_in_properties.EnumsInProperties**](../../../../../../components/schema/enums_in_properties.md) | [enums_in_properties.EnumsInPropertiesDictInput](../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdictinput), [enums_in_properties.EnumsInPropertiesDict](../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdict) | [enums_in_properties.EnumsInPropertiesDict](../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdict) diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_forbidden_property_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_forbidden_property_request_body/post/request_body/content/application_json/schema.md index e52bf6d359b..4f2c8c8163a 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_forbidden_property_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_forbidden_property_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**forbidden_property.ForbiddenProperty**](../../../../../../../components/schema/forbidden_property.md) | [forbidden_property.ForbiddenPropertyDictInput](../../../../../../../components/schema/forbidden_property.md#forbiddenpropertydictinput), [forbidden_property.ForbiddenPropertyDict](../../../../../../../components/schema/forbidden_property.md#forbiddenpropertydict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [forbidden_property.ForbiddenPropertyDict](../../../../../../../components/schema/forbidden_property.md#forbiddenpropertydict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**forbidden_property.ForbiddenProperty**](../../../../../../components/schema/forbidden_property.md) | [forbidden_property.ForbiddenPropertyDictInput](../../../../../../components/schema/forbidden_property.md#forbiddenpropertydictinput), [forbidden_property.ForbiddenPropertyDict](../../../../../../components/schema/forbidden_property.md#forbiddenpropertydict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [forbidden_property.ForbiddenPropertyDict](../../../../../../components/schema/forbidden_property.md#forbiddenpropertydict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_hostname_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_hostname_format_request_body/post/request_body/content/application_json/schema.md index 97751eaa479..81aeeca291a 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_hostname_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_hostname_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**hostname_format.HostnameFormat**](../../../../../../../components/schema/hostname_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**hostname_format.HostnameFormat**](../../../../../../components/schema/hostname_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_integer_type_matches_integers_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_integer_type_matches_integers_request_body/post/request_body/content/application_json/schema.md index 8fc687e22aa..d95c5731074 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_integer_type_matches_integers_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_integer_type_matches_integers_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**integer_type_matches_integers.IntegerTypeMatchesIntegers**](../../../../../../../components/schema/integer_type_matches_integers.md) | int | int +[**integer_type_matches_integers.IntegerTypeMatchesIntegers**](../../../../../../components/schema/integer_type_matches_integers.md) | int | int diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/request_body/content/application_json/schema.md index 3a0a919bdff..bb78505a3ad 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**invalid_instance_should_not_raise_error_when_float_division_inf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf**](../../../../../../../components/schema/invalid_instance_should_not_raise_error_when_float_division_inf.md) | int | int +[**invalid_instance_should_not_raise_error_when_float_division_inf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf**](../../../../../../components/schema/invalid_instance_should_not_raise_error_when_float_division_inf.md) | int | int diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_invalid_string_value_for_default_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_invalid_string_value_for_default_request_body/post/request_body/content/application_json/schema.md index 26bbc33d45d..414c859b37a 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_invalid_string_value_for_default_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_invalid_string_value_for_default_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**invalid_string_value_for_default.InvalidStringValueForDefault**](../../../../../../../components/schema/invalid_string_value_for_default.md) | [invalid_string_value_for_default.InvalidStringValueForDefaultDictInput](../../../../../../../components/schema/invalid_string_value_for_default.md#invalidstringvaluefordefaultdictinput), [invalid_string_value_for_default.InvalidStringValueForDefaultDict](../../../../../../../components/schema/invalid_string_value_for_default.md#invalidstringvaluefordefaultdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [invalid_string_value_for_default.InvalidStringValueForDefaultDict](../../../../../../../components/schema/invalid_string_value_for_default.md#invalidstringvaluefordefaultdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**invalid_string_value_for_default.InvalidStringValueForDefault**](../../../../../../components/schema/invalid_string_value_for_default.md) | [invalid_string_value_for_default.InvalidStringValueForDefaultDictInput](../../../../../../components/schema/invalid_string_value_for_default.md#invalidstringvaluefordefaultdictinput), [invalid_string_value_for_default.InvalidStringValueForDefaultDict](../../../../../../components/schema/invalid_string_value_for_default.md#invalidstringvaluefordefaultdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [invalid_string_value_for_default.InvalidStringValueForDefaultDict](../../../../../../components/schema/invalid_string_value_for_default.md#invalidstringvaluefordefaultdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ipv4_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ipv4_format_request_body/post/request_body/content/application_json/schema.md index ea9f60b18e6..55dec23ff96 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ipv4_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ipv4_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ipv4_format.Ipv4Format**](../../../../../../../components/schema/ipv4_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**ipv4_format.Ipv4Format**](../../../../../../components/schema/ipv4_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ipv6_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ipv6_format_request_body/post/request_body/content/application_json/schema.md index 2e132b2a004..deff46f057e 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ipv6_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ipv6_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ipv6_format.Ipv6Format**](../../../../../../../components/schema/ipv6_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**ipv6_format.Ipv6Format**](../../../../../../components/schema/ipv6_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_json_pointer_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_json_pointer_format_request_body/post/request_body/content/application_json/schema.md index 0f54838f683..9ff2d3548c4 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_json_pointer_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_json_pointer_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**json_pointer_format.JsonPointerFormat**](../../../../../../../components/schema/json_pointer_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**json_pointer_format.JsonPointerFormat**](../../../../../../components/schema/json_pointer_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maximum_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maximum_validation_request_body/post/request_body/content/application_json/schema.md index 589da0516fe..5553ca1e9b7 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maximum_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maximum_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maximum_validation.MaximumValidation**](../../../../../../../components/schema/maximum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maximum_validation.MaximumValidation**](../../../../../../components/schema/maximum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/request_body/content/application_json/schema.md index 6840ed42a5b..ca71a9fb799 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maximum_validation_with_unsigned_integer.MaximumValidationWithUnsignedInteger**](../../../../../../../components/schema/maximum_validation_with_unsigned_integer.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maximum_validation_with_unsigned_integer.MaximumValidationWithUnsignedInteger**](../../../../../../components/schema/maximum_validation_with_unsigned_integer.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxitems_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxitems_validation_request_body/post/request_body/content/application_json/schema.md index 4cfe56e232c..f50abb3b526 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxitems_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxitems_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maxitems_validation.MaxitemsValidation**](../../../../../../../components/schema/maxitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maxitems_validation.MaxitemsValidation**](../../../../../../components/schema/maxitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxlength_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxlength_validation_request_body/post/request_body/content/application_json/schema.md index 7a43b90bf85..a2e68829ab2 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxlength_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxlength_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maxlength_validation.MaxlengthValidation**](../../../../../../../components/schema/maxlength_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maxlength_validation.MaxlengthValidation**](../../../../../../components/schema/maxlength_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/request_body/content/application_json/schema.md index d3f77385483..4e3d86e546c 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maxproperties0_means_the_object_is_empty.Maxproperties0MeansTheObjectIsEmpty**](../../../../../../../components/schema/maxproperties0_means_the_object_is_empty.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maxproperties0_means_the_object_is_empty.Maxproperties0MeansTheObjectIsEmpty**](../../../../../../components/schema/maxproperties0_means_the_object_is_empty.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxproperties_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxproperties_validation_request_body/post/request_body/content/application_json/schema.md index cb40b7cf6d2..00d746957d6 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxproperties_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_maxproperties_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maxproperties_validation.MaxpropertiesValidation**](../../../../../../../components/schema/maxproperties_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maxproperties_validation.MaxpropertiesValidation**](../../../../../../components/schema/maxproperties_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minimum_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minimum_validation_request_body/post/request_body/content/application_json/schema.md index 44819265c26..26eeccd5eaf 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minimum_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minimum_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**minimum_validation.MinimumValidation**](../../../../../../../components/schema/minimum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**minimum_validation.MinimumValidation**](../../../../../../components/schema/minimum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/request_body/content/application_json/schema.md index 19f3ed9032c..5e92f980c9b 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**minimum_validation_with_signed_integer.MinimumValidationWithSignedInteger**](../../../../../../../components/schema/minimum_validation_with_signed_integer.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**minimum_validation_with_signed_integer.MinimumValidationWithSignedInteger**](../../../../../../components/schema/minimum_validation_with_signed_integer.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minitems_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minitems_validation_request_body/post/request_body/content/application_json/schema.md index e646114aaee..65869f18e46 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minitems_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minitems_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**minitems_validation.MinitemsValidation**](../../../../../../../components/schema/minitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**minitems_validation.MinitemsValidation**](../../../../../../components/schema/minitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minlength_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minlength_validation_request_body/post/request_body/content/application_json/schema.md index ba84d5dedd6..01738b2137d 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minlength_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minlength_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**minlength_validation.MinlengthValidation**](../../../../../../../components/schema/minlength_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**minlength_validation.MinlengthValidation**](../../../../../../components/schema/minlength_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minproperties_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minproperties_validation_request_body/post/request_body/content/application_json/schema.md index a9f0c2203cf..5124086459f 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minproperties_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_minproperties_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**minproperties_validation.MinpropertiesValidation**](../../../../../../../components/schema/minproperties_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**minproperties_validation.MinpropertiesValidation**](../../../../../../components/schema/minproperties_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md index 43660eb78d5..58e17f98b32 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**nested_allof_to_check_validation_semantics.NestedAllofToCheckValidationSemantics**](../../../../../../../components/schema/nested_allof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**nested_allof_to_check_validation_semantics.NestedAllofToCheckValidationSemantics**](../../../../../../components/schema/nested_allof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md index 94442176b5f..926d363545c 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**nested_anyof_to_check_validation_semantics.NestedAnyofToCheckValidationSemantics**](../../../../../../../components/schema/nested_anyof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**nested_anyof_to_check_validation_semantics.NestedAnyofToCheckValidationSemantics**](../../../../../../components/schema/nested_anyof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_items_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_items_request_body/post/request_body/content/application_json/schema.md index 6841c1b39b8..c0e56dc998e 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_items_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_items_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**nested_items.NestedItems**](../../../../../../../components/schema/nested_items.md) | [nested_items.NestedItemsTupleInput](../../../../../../../components/schema/nested_items.md#nesteditemstupleinput), [nested_items.NestedItemsTuple](../../../../../../../components/schema/nested_items.md#nesteditemstuple) | [nested_items.NestedItemsTuple](../../../../../../../components/schema/nested_items.md#nesteditemstuple) +[**nested_items.NestedItems**](../../../../../../components/schema/nested_items.md) | [nested_items.NestedItemsTupleInput](../../../../../../components/schema/nested_items.md#nesteditemstupleinput), [nested_items.NestedItemsTuple](../../../../../../components/schema/nested_items.md#nesteditemstuple) | [nested_items.NestedItemsTuple](../../../../../../components/schema/nested_items.md#nesteditemstuple) diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md index fc67bb2d367..8a4161dd9cc 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**nested_oneof_to_check_validation_semantics.NestedOneofToCheckValidationSemantics**](../../../../../../../components/schema/nested_oneof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**nested_oneof_to_check_validation_semantics.NestedOneofToCheckValidationSemantics**](../../../../../../components/schema/nested_oneof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_not_more_complex_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_not_more_complex_schema_request_body/post/request_body/content/application_json/schema.md index 0d8ca42e87e..b706eeacd54 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_not_more_complex_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_not_more_complex_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**not_more_complex_schema.NotMoreComplexSchema**](../../../../../../../components/schema/not_more_complex_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**not_more_complex_schema.NotMoreComplexSchema**](../../../../../../components/schema/not_more_complex_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_not_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_not_request_body/post/request_body/content/application_json/schema.md index e821bba20a4..6d44ea35a50 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_not_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_not_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**_not._Not**](../../../../../../../components/schema/_not.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**_not._Not**](../../../../../../components/schema/_not.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md index 9c604f3157d..a087048fe56 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**nul_characters_in_strings.NulCharactersInStrings**](../../../../../../../components/schema/nul_characters_in_strings.md) | typing.Literal["hello\x00there"] | typing.Literal["hello\x00there"] +[**nul_characters_in_strings.NulCharactersInStrings**](../../../../../../components/schema/nul_characters_in_strings.md) | typing.Literal["hello\x00there"] | typing.Literal["hello\x00there"] diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/request_body/content/application_json/schema.md index 1fc27f732eb..fff53776afc 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**null_type_matches_only_the_null_object.NullTypeMatchesOnlyTheNullObject**](../../../../../../../components/schema/null_type_matches_only_the_null_object.md) | None | None +[**null_type_matches_only_the_null_object.NullTypeMatchesOnlyTheNullObject**](../../../../../../components/schema/null_type_matches_only_the_null_object.md) | None | None diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_number_type_matches_numbers_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_number_type_matches_numbers_request_body/post/request_body/content/application_json/schema.md index 2f5989e5b48..8def3a1e455 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_number_type_matches_numbers_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_number_type_matches_numbers_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**number_type_matches_numbers.NumberTypeMatchesNumbers**](../../../../../../../components/schema/number_type_matches_numbers.md) | float, int | float, int +[**number_type_matches_numbers.NumberTypeMatchesNumbers**](../../../../../../components/schema/number_type_matches_numbers.md) | float, int | float, int diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_object_properties_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_object_properties_validation_request_body/post/request_body/content/application_json/schema.md index 36dc6fe6eaa..f729ef18de8 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_object_properties_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_object_properties_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**object_properties_validation.ObjectPropertiesValidation**](../../../../../../../components/schema/object_properties_validation.md) | [object_properties_validation.ObjectPropertiesValidationDictInput](../../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdictinput), [object_properties_validation.ObjectPropertiesValidationDict](../../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [object_properties_validation.ObjectPropertiesValidationDict](../../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**object_properties_validation.ObjectPropertiesValidation**](../../../../../../components/schema/object_properties_validation.md) | [object_properties_validation.ObjectPropertiesValidationDictInput](../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdictinput), [object_properties_validation.ObjectPropertiesValidationDict](../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [object_properties_validation.ObjectPropertiesValidationDict](../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_object_type_matches_objects_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_object_type_matches_objects_request_body/post/request_body/content/application_json/schema.md index 26ba7dda7c8..6aeab4b8e0c 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_object_type_matches_objects_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_object_type_matches_objects_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**object_type_matches_objects.ObjectTypeMatchesObjects**](../../../../../../../components/schema/object_type_matches_objects.md) | dict, schemas.immutabledict | schemas.immutabledict +[**object_type_matches_objects.ObjectTypeMatchesObjects**](../../../../../../components/schema/object_type_matches_objects.md) | dict, schemas.immutabledict | schemas.immutabledict diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_complex_types_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_complex_types_request_body/post/request_body/content/application_json/schema.md index 26490cc0ac4..9ca7554a157 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_complex_types_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_complex_types_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**oneof_complex_types.OneofComplexTypes**](../../../../../../../components/schema/oneof_complex_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**oneof_complex_types.OneofComplexTypes**](../../../../../../components/schema/oneof_complex_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_request_body/post/request_body/content/application_json/schema.md index a92da1bd06b..08849af368e 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**oneof.Oneof**](../../../../../../../components/schema/oneof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**oneof.Oneof**](../../../../../../components/schema/oneof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_base_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_base_schema_request_body/post/request_body/content/application_json/schema.md index b07790bb0ef..5458e22b02e 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_base_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_base_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**oneof_with_base_schema.OneofWithBaseSchema**](../../../../../../../components/schema/oneof_with_base_schema.md) | str | str +[**oneof_with_base_schema.OneofWithBaseSchema**](../../../../../../components/schema/oneof_with_base_schema.md) | str | str diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_empty_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_empty_schema_request_body/post/request_body/content/application_json/schema.md index b1152ac0d3c..4f96d5bffdf 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_empty_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_empty_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**oneof_with_empty_schema.OneofWithEmptySchema**](../../../../../../../components/schema/oneof_with_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**oneof_with_empty_schema.OneofWithEmptySchema**](../../../../../../components/schema/oneof_with_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_required_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_required_request_body/post/request_body/content/application_json/schema.md index 79210ca3a29..1d0a4d03c12 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_required_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_oneof_with_required_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**oneof_with_required.OneofWithRequired**](../../../../../../../components/schema/oneof_with_required.md) | dict, schemas.immutabledict | schemas.immutabledict +[**oneof_with_required.OneofWithRequired**](../../../../../../components/schema/oneof_with_required.md) | dict, schemas.immutabledict | schemas.immutabledict diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_pattern_is_not_anchored_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_pattern_is_not_anchored_request_body/post/request_body/content/application_json/schema.md index f8318e101e2..3bddf50968b 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_pattern_is_not_anchored_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_pattern_is_not_anchored_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**pattern_is_not_anchored.PatternIsNotAnchored**](../../../../../../../components/schema/pattern_is_not_anchored.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**pattern_is_not_anchored.PatternIsNotAnchored**](../../../../../../components/schema/pattern_is_not_anchored.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_pattern_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_pattern_validation_request_body/post/request_body/content/application_json/schema.md index 10f43cc2aea..6e47e238a70 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_pattern_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_pattern_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**pattern_validation.PatternValidation**](../../../../../../../components/schema/pattern_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**pattern_validation.PatternValidation**](../../../../../../components/schema/pattern_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_properties_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_properties_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md index dd10364bae7..446fae7f7e8 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_properties_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_properties_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**properties_with_escaped_characters.PropertiesWithEscapedCharacters**](../../../../../../../components/schema/properties_with_escaped_characters.md) | [properties_with_escaped_characters.PropertiesWithEscapedCharactersDictInput](../../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdictinput), [properties_with_escaped_characters.PropertiesWithEscapedCharactersDict](../../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [properties_with_escaped_characters.PropertiesWithEscapedCharactersDict](../../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**properties_with_escaped_characters.PropertiesWithEscapedCharacters**](../../../../../../components/schema/properties_with_escaped_characters.md) | [properties_with_escaped_characters.PropertiesWithEscapedCharactersDictInput](../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdictinput), [properties_with_escaped_characters.PropertiesWithEscapedCharactersDict](../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [properties_with_escaped_characters.PropertiesWithEscapedCharactersDict](../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/request_body/content/application_json/schema.md index b5470f55cf7..ca6d9685fdc 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReference**](../../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md) | [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDictInput](../../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedictinput), [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDict](../../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDict](../../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReference**](../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md) | [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDictInput](../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedictinput), [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDict](../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDict](../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_additionalproperties_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_additionalproperties_request_body/post/request_body/content/application_json/schema.md index f440ec638a2..80ce186392c 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_additionalproperties_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_additionalproperties_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ref_in_additionalproperties.RefInAdditionalproperties**](../../../../../../../components/schema/ref_in_additionalproperties.md) | [ref_in_additionalproperties.RefInAdditionalpropertiesDictInput](../../../../../../../components/schema/ref_in_additionalproperties.md#refinadditionalpropertiesdictinput), [ref_in_additionalproperties.RefInAdditionalpropertiesDict](../../../../../../../components/schema/ref_in_additionalproperties.md#refinadditionalpropertiesdict) | [ref_in_additionalproperties.RefInAdditionalpropertiesDict](../../../../../../../components/schema/ref_in_additionalproperties.md#refinadditionalpropertiesdict) +[**ref_in_additionalproperties.RefInAdditionalproperties**](../../../../../../components/schema/ref_in_additionalproperties.md) | [ref_in_additionalproperties.RefInAdditionalpropertiesDictInput](../../../../../../components/schema/ref_in_additionalproperties.md#refinadditionalpropertiesdictinput), [ref_in_additionalproperties.RefInAdditionalpropertiesDict](../../../../../../components/schema/ref_in_additionalproperties.md#refinadditionalpropertiesdict) | [ref_in_additionalproperties.RefInAdditionalpropertiesDict](../../../../../../components/schema/ref_in_additionalproperties.md#refinadditionalpropertiesdict) diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_allof_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_allof_request_body/post/request_body/content/application_json/schema.md index 328e16b818c..9057ed6afc9 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_allof_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_allof_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ref_in_allof.RefInAllof**](../../../../../../../components/schema/ref_in_allof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**ref_in_allof.RefInAllof**](../../../../../../components/schema/ref_in_allof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_anyof_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_anyof_request_body/post/request_body/content/application_json/schema.md index cfca4951828..4c951aab855 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_anyof_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_anyof_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ref_in_anyof.RefInAnyof**](../../../../../../../components/schema/ref_in_anyof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**ref_in_anyof.RefInAnyof**](../../../../../../components/schema/ref_in_anyof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_items_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_items_request_body/post/request_body/content/application_json/schema.md index c70801c667c..17d6adde956 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_items_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_items_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ref_in_items.RefInItems**](../../../../../../../components/schema/ref_in_items.md) | [ref_in_items.RefInItemsTupleInput](../../../../../../../components/schema/ref_in_items.md#refinitemstupleinput), [ref_in_items.RefInItemsTuple](../../../../../../../components/schema/ref_in_items.md#refinitemstuple) | [ref_in_items.RefInItemsTuple](../../../../../../../components/schema/ref_in_items.md#refinitemstuple) +[**ref_in_items.RefInItems**](../../../../../../components/schema/ref_in_items.md) | [ref_in_items.RefInItemsTupleInput](../../../../../../components/schema/ref_in_items.md#refinitemstupleinput), [ref_in_items.RefInItemsTuple](../../../../../../components/schema/ref_in_items.md#refinitemstuple) | [ref_in_items.RefInItemsTuple](../../../../../../components/schema/ref_in_items.md#refinitemstuple) diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_not_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_not_request_body/post/request_body/content/application_json/schema.md index 1e3b6242522..2006b42b3cc 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_not_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_not_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ref_in_not.RefInNot**](../../../../../../../components/schema/ref_in_not.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**ref_in_not.RefInNot**](../../../../../../components/schema/ref_in_not.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_oneof_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_oneof_request_body/post/request_body/content/application_json/schema.md index ab3ed7784e1..5fea9c5b8a2 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_oneof_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_oneof_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ref_in_oneof.RefInOneof**](../../../../../../../components/schema/ref_in_oneof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**ref_in_oneof.RefInOneof**](../../../../../../components/schema/ref_in_oneof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_property_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_property_request_body/post/request_body/content/application_json/schema.md index 9a24f791d67..4d9713959ae 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_property_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_ref_in_property_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ref_in_property.RefInProperty**](../../../../../../../components/schema/ref_in_property.md) | [ref_in_property.RefInPropertyDictInput](../../../../../../../components/schema/ref_in_property.md#refinpropertydictinput), [ref_in_property.RefInPropertyDict](../../../../../../../components/schema/ref_in_property.md#refinpropertydict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [ref_in_property.RefInPropertyDict](../../../../../../../components/schema/ref_in_property.md#refinpropertydict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**ref_in_property.RefInProperty**](../../../../../../components/schema/ref_in_property.md) | [ref_in_property.RefInPropertyDictInput](../../../../../../components/schema/ref_in_property.md#refinpropertydictinput), [ref_in_property.RefInPropertyDict](../../../../../../components/schema/ref_in_property.md#refinpropertydict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [ref_in_property.RefInPropertyDict](../../../../../../components/schema/ref_in_property.md#refinpropertydict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_default_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_default_validation_request_body/post/request_body/content/application_json/schema.md index a083a020b96..657fe1dde2a 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_default_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_default_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**required_default_validation.RequiredDefaultValidation**](../../../../../../../components/schema/required_default_validation.md) | [required_default_validation.RequiredDefaultValidationDictInput](../../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdictinput), [required_default_validation.RequiredDefaultValidationDict](../../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_default_validation.RequiredDefaultValidationDict](../../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**required_default_validation.RequiredDefaultValidation**](../../../../../../components/schema/required_default_validation.md) | [required_default_validation.RequiredDefaultValidationDictInput](../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdictinput), [required_default_validation.RequiredDefaultValidationDict](../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_default_validation.RequiredDefaultValidationDict](../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_validation_request_body/post/request_body/content/application_json/schema.md index 63157b3c68b..f12feaf8e9b 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**required_validation.RequiredValidation**](../../../../../../../components/schema/required_validation.md) | [required_validation.RequiredValidationDictInput](../../../../../../../components/schema/required_validation.md#requiredvalidationdictinput), [required_validation.RequiredValidationDict](../../../../../../../components/schema/required_validation.md#requiredvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_validation.RequiredValidationDict](../../../../../../../components/schema/required_validation.md#requiredvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**required_validation.RequiredValidation**](../../../../../../components/schema/required_validation.md) | [required_validation.RequiredValidationDictInput](../../../../../../components/schema/required_validation.md#requiredvalidationdictinput), [required_validation.RequiredValidationDict](../../../../../../components/schema/required_validation.md#requiredvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_validation.RequiredValidationDict](../../../../../../components/schema/required_validation.md#requiredvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_with_empty_array_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_with_empty_array_request_body/post/request_body/content/application_json/schema.md index 3095bb4d873..c713c1dd7f1 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_with_empty_array_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_with_empty_array_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**required_with_empty_array.RequiredWithEmptyArray**](../../../../../../../components/schema/required_with_empty_array.md) | [required_with_empty_array.RequiredWithEmptyArrayDictInput](../../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydictinput), [required_with_empty_array.RequiredWithEmptyArrayDict](../../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_with_empty_array.RequiredWithEmptyArrayDict](../../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**required_with_empty_array.RequiredWithEmptyArray**](../../../../../../components/schema/required_with_empty_array.md) | [required_with_empty_array.RequiredWithEmptyArrayDictInput](../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydictinput), [required_with_empty_array.RequiredWithEmptyArrayDict](../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_with_empty_array.RequiredWithEmptyArrayDict](../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md index 3b23ca63c80..019d986b9c8 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_required_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**required_with_escaped_characters.RequiredWithEscapedCharacters**](../../../../../../../components/schema/required_with_escaped_characters.md) | [required_with_escaped_characters.RequiredWithEscapedCharactersDictInput](../../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdictinput), [required_with_escaped_characters.RequiredWithEscapedCharactersDict](../../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_with_escaped_characters.RequiredWithEscapedCharactersDict](../../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**required_with_escaped_characters.RequiredWithEscapedCharacters**](../../../../../../components/schema/required_with_escaped_characters.md) | [required_with_escaped_characters.RequiredWithEscapedCharactersDictInput](../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdictinput), [required_with_escaped_characters.RequiredWithEscapedCharactersDict](../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_with_escaped_characters.RequiredWithEscapedCharactersDict](../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_simple_enum_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_simple_enum_validation_request_body/post/request_body/content/application_json/schema.md index fb0c5cf72da..446bb03d4df 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_simple_enum_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_simple_enum_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**simple_enum_validation.SimpleEnumValidation**](../../../../../../../components/schema/simple_enum_validation.md) | float, int | float, int +[**simple_enum_validation.SimpleEnumValidation**](../../../../../../components/schema/simple_enum_validation.md) | float, int | float, int diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_string_type_matches_strings_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_string_type_matches_strings_request_body/post/request_body/content/application_json/schema.md index 4727d0e2530..4f0786bbb23 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_string_type_matches_strings_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_string_type_matches_strings_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**string_type_matches_strings.StringTypeMatchesStrings**](../../../../../../../components/schema/string_type_matches_strings.md) | str | str +[**string_type_matches_strings.StringTypeMatchesStrings**](../../../../../../components/schema/string_type_matches_strings.md) | str | str diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/request_body/content/application_json/schema.md index 2238dc216e8..a39afc01a0e 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**the_default_keyword_does_not_do_anything_if_the_property_is_missing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing**](../../../../../../../components/schema/the_default_keyword_does_not_do_anything_if_the_property_is_missing.md) | [the_default_keyword_does_not_do_anything_if_the_property_is_missing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingDictInput](../../../../../../../components/schema/the_default_keyword_does_not_do_anything_if_the_property_is_missing.md#thedefaultkeyworddoesnotdoanythingifthepropertyismissingdictinput), [the_default_keyword_does_not_do_anything_if_the_property_is_missing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingDict](../../../../../../../components/schema/the_default_keyword_does_not_do_anything_if_the_property_is_missing.md#thedefaultkeyworddoesnotdoanythingifthepropertyismissingdict) | [the_default_keyword_does_not_do_anything_if_the_property_is_missing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingDict](../../../../../../../components/schema/the_default_keyword_does_not_do_anything_if_the_property_is_missing.md#thedefaultkeyworddoesnotdoanythingifthepropertyismissingdict) +[**the_default_keyword_does_not_do_anything_if_the_property_is_missing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing**](../../../../../../components/schema/the_default_keyword_does_not_do_anything_if_the_property_is_missing.md) | [the_default_keyword_does_not_do_anything_if_the_property_is_missing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingDictInput](../../../../../../components/schema/the_default_keyword_does_not_do_anything_if_the_property_is_missing.md#thedefaultkeyworddoesnotdoanythingifthepropertyismissingdictinput), [the_default_keyword_does_not_do_anything_if_the_property_is_missing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingDict](../../../../../../components/schema/the_default_keyword_does_not_do_anything_if_the_property_is_missing.md#thedefaultkeyworddoesnotdoanythingifthepropertyismissingdict) | [the_default_keyword_does_not_do_anything_if_the_property_is_missing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingDict](../../../../../../components/schema/the_default_keyword_does_not_do_anything_if_the_property_is_missing.md#thedefaultkeyworddoesnotdoanythingifthepropertyismissingdict) diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uniqueitems_false_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uniqueitems_false_validation_request_body/post/request_body/content/application_json/schema.md index 089a82bddaa..1a8750cb498 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uniqueitems_false_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uniqueitems_false_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uniqueitems_false_validation.UniqueitemsFalseValidation**](../../../../../../../components/schema/uniqueitems_false_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**uniqueitems_false_validation.UniqueitemsFalseValidation**](../../../../../../components/schema/uniqueitems_false_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uniqueitems_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uniqueitems_validation_request_body/post/request_body/content/application_json/schema.md index 94124666ff4..8da3484db7a 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uniqueitems_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uniqueitems_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uniqueitems_validation.UniqueitemsValidation**](../../../../../../../components/schema/uniqueitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**uniqueitems_validation.UniqueitemsValidation**](../../../../../../components/schema/uniqueitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_format_request_body/post/request_body/content/application_json/schema.md index 0686a094ae1..0c73d64a61a 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uri_format.UriFormat**](../../../../../../../components/schema/uri_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**uri_format.UriFormat**](../../../../../../components/schema/uri_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_reference_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_reference_format_request_body/post/request_body/content/application_json/schema.md index 0d4cf1c286f..43e89f3a455 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_reference_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_reference_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uri_reference_format.UriReferenceFormat**](../../../../../../../components/schema/uri_reference_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**uri_reference_format.UriReferenceFormat**](../../../../../../components/schema/uri_reference_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_template_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_template_format_request_body/post/request_body/content/application_json/schema.md index 2f3e0e8e378..338273a27f4 100644 --- a/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_template_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_0_3_unit_test/python/docs/paths/request_body_post_uri_template_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uri_template_format.UriTemplateFormat**](../../../../../../../components/schema/uri_template_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**uri_template_format.UriTemplateFormat**](../../../../../../components/schema/uri_template_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES b/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES index b5033613876..e12819c11ee 100644 --- a/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES +++ b/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES @@ -299,7 +299,7 @@ src/main/java/org/openapijsonschematools/client/contenttype/ContentTypeSerialize src/main/java/org/openapijsonschematools/client/exceptions/ApiException.java src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.java -src/main/java/org/openapijsonschematools/client/exceptions/InvalidTypeException.java +src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java src/main/java/org/openapijsonschematools/client/exceptions/UnsetPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/ValidationException.java src/main/java/org/openapijsonschematools/client/header/ContentHeader.java diff --git a/samples/client/3_1_0_unit_test/java/docs/RootServerInfo.md b/samples/client/3_1_0_unit_test/java/docs/RootServerInfo.md index e1624a56d1f..02e74ac57a6 100644 --- a/samples/client/3_1_0_unit_test/java/docs/RootServerInfo.md +++ b/samples/client/3_1_0_unit_test/java/docs/RootServerInfo.md @@ -4,13 +4,36 @@ RootServerInfo.java public class RootServerInfo A class that provides a server, and any needed server info classes +- a class that is a 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 | | 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()
Creates an instance using default server variable values | +| RootServerInfo1(@Nullable [Server0](servers/Server0.md) server0)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [Server0](servers/Server0.md) | server0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + ## ServerIndex enum ServerIndex
diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java index d5c2f5cb5fd..7194d05eda1 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java @@ -1,73 +1,33 @@ package org.openapijsonschematools.client; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server; import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.AbstractMap; -import java.util.Map; import java.util.Objects; -import java.util.EnumMap; -public class RootServerInfo implements ServerProvider { - final private Servers servers; - final private ServerIndex serverIndex; +public class RootServerInfo { + public static class RootServerInfo1 implements ServerProvider { + public final Server0 server0; - public RootServerInfo() { - this.servers = new Servers(); - this.serverIndex = ServerIndex.SERVER_0; - } - - public RootServerInfo(Servers servers, ServerIndex serverIndex) { - this.servers = servers; - this.serverIndex = serverIndex; - } - - public static class Servers { - private final EnumMap servers; - - public Servers() { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - new Server0() - ) - ) - ); + public RootServerInfo1() { + server0 = new Server0(); } - public Servers( + public RootServerInfo1( @Nullable Server0 server0 ) { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - Objects.requireNonNullElseGet(server0, Server0::new) - ) - ) - ); + this.server0 = Objects.requireNonNullElseGet(server0, Server0::new); } - public Server get(ServerIndex serverIndex) { - if (servers.containsKey(serverIndex)) { - return get(serverIndex); - } - throw new UnsetPropertyException(serverIndex+" is unset"); + @Override + public Server getServer(ServerIndex serverIndex) { + return server0; } } public enum ServerIndex { SERVER_0 } - - public Server getServer(@Nullable ServerIndex serverIndex) { - if (serverIndex == null) { - return servers.get(this.serverIndex); - } - return servers.get(serverIndex); - } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.java index 16b1fdbff62..5b9fcad174a 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; @@ -204,7 +203,7 @@ public static ASchemaGivenForPrefixitems1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,7 +227,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -239,24 +238,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -288,7 +287,7 @@ public ASchemaGivenForPrefixitemsList getNewInstance(List arg, List p itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -315,7 +314,7 @@ public ASchemaGivenForPrefixitemsList validate(List arg, SchemaConfiguration for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -323,7 +322,7 @@ public ASchemaGivenForPrefixitemsList validate(List arg, SchemaConfiguration Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -333,7 +332,7 @@ public ASchemaGivenForPrefixitemsList validate(List arg, SchemaConfiguration return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -345,7 +344,7 @@ public ASchemaGivenForPrefixitemsList validate(List arg, SchemaConfiguration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -360,10 +359,10 @@ public ASchemaGivenForPrefixitemsList validate(List arg, SchemaConfiguration } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -378,34 +377,34 @@ public ASchemaGivenForPrefixitemsList validate(List arg, SchemaConfiguration } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ASchemaGivenForPrefixitems1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ASchemaGivenForPrefixitems1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ASchemaGivenForPrefixitems1BoxedVoid(validate(arg, configuration)); } @Override - public ASchemaGivenForPrefixitems1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ASchemaGivenForPrefixitems1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ASchemaGivenForPrefixitems1BoxedBoolean(validate(arg, configuration)); } @Override - public ASchemaGivenForPrefixitems1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ASchemaGivenForPrefixitems1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ASchemaGivenForPrefixitems1BoxedNumber(validate(arg, configuration)); } @Override - public ASchemaGivenForPrefixitems1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ASchemaGivenForPrefixitems1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ASchemaGivenForPrefixitems1BoxedString(validate(arg, configuration)); } @Override - public ASchemaGivenForPrefixitems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ASchemaGivenForPrefixitems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ASchemaGivenForPrefixitems1BoxedList(validate(arg, configuration)); } @Override - public ASchemaGivenForPrefixitems1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ASchemaGivenForPrefixitems1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ASchemaGivenForPrefixitems1BoxedMap(validate(arg, configuration)); } @Override - public ASchemaGivenForPrefixitems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ASchemaGivenForPrefixitems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -421,7 +420,7 @@ public ASchemaGivenForPrefixitems1Boxed validateAndBox(@Nullable Object arg, Sch } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.java index f9c32af6fec..c0218e81492 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; @@ -191,7 +190,7 @@ public static AdditionalItemsAreAllowedByDefault1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +202,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,7 +214,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -226,24 +225,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -275,7 +274,7 @@ public AdditionalItemsAreAllowedByDefaultList getNewInstance(List arg, List, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -302,7 +301,7 @@ public AdditionalItemsAreAllowedByDefaultList validate(List arg, SchemaConfig for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -310,7 +309,7 @@ public AdditionalItemsAreAllowedByDefaultList validate(List arg, SchemaConfig Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -320,7 +319,7 @@ public AdditionalItemsAreAllowedByDefaultList validate(List arg, SchemaConfig return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -332,7 +331,7 @@ public AdditionalItemsAreAllowedByDefaultList validate(List arg, SchemaConfig } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -347,10 +346,10 @@ public AdditionalItemsAreAllowedByDefaultList validate(List arg, SchemaConfig } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -365,34 +364,34 @@ public AdditionalItemsAreAllowedByDefaultList validate(List arg, SchemaConfig } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalItemsAreAllowedByDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalItemsAreAllowedByDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalItemsAreAllowedByDefault1BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalItemsAreAllowedByDefault1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalItemsAreAllowedByDefault1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalItemsAreAllowedByDefault1BoxedBoolean(validate(arg, configuration)); } @Override - public AdditionalItemsAreAllowedByDefault1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalItemsAreAllowedByDefault1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalItemsAreAllowedByDefault1BoxedNumber(validate(arg, configuration)); } @Override - public AdditionalItemsAreAllowedByDefault1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalItemsAreAllowedByDefault1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalItemsAreAllowedByDefault1BoxedString(validate(arg, configuration)); } @Override - public AdditionalItemsAreAllowedByDefault1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalItemsAreAllowedByDefault1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalItemsAreAllowedByDefault1BoxedList(validate(arg, configuration)); } @Override - public AdditionalItemsAreAllowedByDefault1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalItemsAreAllowedByDefault1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalItemsAreAllowedByDefault1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalItemsAreAllowedByDefault1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalItemsAreAllowedByDefault1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -408,7 +407,7 @@ public AdditionalItemsAreAllowedByDefault1Boxed validateAndBox(@Nullable Object } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java index e6517f75b10..e9d0e2c6990 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -309,7 +308,7 @@ public static AdditionalpropertiesAreAllowedByDefault1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -321,7 +320,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -333,7 +332,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -344,24 +343,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -393,7 +392,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -420,7 +419,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(Map arg, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -428,7 +427,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(Map arg, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -438,7 +437,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap getNewInstance(Map arg, return new AdditionalpropertiesAreAllowedByDefaultMap(castProperties); } - public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -450,7 +449,7 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, Schema } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -465,10 +464,10 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, Schema } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -483,34 +482,34 @@ public AdditionalpropertiesAreAllowedByDefaultMap validate(Map arg, Schema } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedNumber(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedString(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedList(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesAreAllowedByDefault1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalpropertiesAreAllowedByDefault1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesAreAllowedByDefault1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -526,7 +525,7 @@ public AdditionalpropertiesAreAllowedByDefault1Boxed validateAndBox(@Nullable Ob } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java index 649e69307db..44a6b34fe91 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -53,7 +52,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new InvalidTypeException("Value may not be null"); + throw new RuntimeException("Value may not be null"); } return (boolean) value; } @@ -133,7 +132,7 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(Map arg, Lis for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -141,12 +140,12 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(Map arg, Lis Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -154,7 +153,7 @@ public AdditionalpropertiesCanExistByItselfMap getNewInstance(Map arg, Lis return new AdditionalpropertiesCanExistByItselfMap(castProperties); } - public AdditionalpropertiesCanExistByItselfMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesCanExistByItselfMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -166,29 +165,29 @@ public AdditionalpropertiesCanExistByItselfMap validate(Map arg, SchemaCon @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalpropertiesCanExistByItself1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesCanExistByItself1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesCanExistByItself1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalpropertiesCanExistByItself1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesCanExistByItself1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.java index 94d89c88eab..6a539c2b37a 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -236,7 +235,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +247,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -260,7 +259,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -271,24 +270,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -320,7 +319,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -347,7 +346,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -355,7 +354,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -365,7 +364,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -377,7 +376,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -392,10 +391,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -410,34 +409,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -453,7 +452,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -471,7 +470,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new InvalidTypeException("Value may not be null"); + throw new RuntimeException("Value may not be null"); } return (boolean) value; } @@ -584,7 +583,7 @@ public static AdditionalpropertiesDoesNotLookInApplicators1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -596,7 +595,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -608,7 +607,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -619,24 +618,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -668,7 +667,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -695,7 +694,7 @@ public AdditionalpropertiesDoesNotLookInApplicatorsMap getNewInstance(Map for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -703,12 +702,12 @@ public AdditionalpropertiesDoesNotLookInApplicatorsMap getNewInstance(Map Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -716,7 +715,7 @@ public AdditionalpropertiesDoesNotLookInApplicatorsMap getNewInstance(Map return new AdditionalpropertiesDoesNotLookInApplicatorsMap(castProperties); } - public AdditionalpropertiesDoesNotLookInApplicatorsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesDoesNotLookInApplicatorsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -728,7 +727,7 @@ public AdditionalpropertiesDoesNotLookInApplicatorsMap validate(Map arg, S } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -743,10 +742,10 @@ public AdditionalpropertiesDoesNotLookInApplicatorsMap validate(Map arg, S } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -761,34 +760,34 @@ public AdditionalpropertiesDoesNotLookInApplicatorsMap validate(Map arg, S } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean(validate(arg, configuration)); } @Override - public AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber(validate(arg, configuration)); } @Override - public AdditionalpropertiesDoesNotLookInApplicators1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesDoesNotLookInApplicators1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesDoesNotLookInApplicators1BoxedString(validate(arg, configuration)); } @Override - public AdditionalpropertiesDoesNotLookInApplicators1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesDoesNotLookInApplicators1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesDoesNotLookInApplicators1BoxedList(validate(arg, configuration)); } @Override - public AdditionalpropertiesDoesNotLookInApplicators1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesDoesNotLookInApplicators1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesDoesNotLookInApplicators1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalpropertiesDoesNotLookInApplicators1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesDoesNotLookInApplicators1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -804,7 +803,7 @@ public AdditionalpropertiesDoesNotLookInApplicators1Boxed validateAndBox(@Nullab } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.java index bec67224249..e87afc994e0 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -128,7 +127,7 @@ public AdditionalpropertiesWithNullValuedInstancePropertiesMap getNewInstance(Ma for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -136,12 +135,12 @@ public AdditionalpropertiesWithNullValuedInstancePropertiesMap getNewInstance(Ma Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance == null || propertyInstance instanceof Void)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Void) propertyInstance); } @@ -149,7 +148,7 @@ public AdditionalpropertiesWithNullValuedInstancePropertiesMap getNewInstance(Ma return new AdditionalpropertiesWithNullValuedInstancePropertiesMap(castProperties); } - public AdditionalpropertiesWithNullValuedInstancePropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesWithNullValuedInstancePropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -161,29 +160,29 @@ public AdditionalpropertiesWithNullValuedInstancePropertiesMap validate(Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalpropertiesWithNullValuedInstanceProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesWithNullValuedInstanceProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.java index 8a657893b71..4443caea1de 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -88,7 +87,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException, throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (boolean) value; } @@ -299,7 +298,7 @@ public AdditionalpropertiesWithSchemaMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -307,7 +306,7 @@ public AdditionalpropertiesWithSchemaMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -317,7 +316,7 @@ public AdditionalpropertiesWithSchemaMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesWithSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -329,29 +328,29 @@ public AdditionalpropertiesWithSchemaMap validate(Map arg, SchemaConfigura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalpropertiesWithSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesWithSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalpropertiesWithSchema1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalpropertiesWithSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalpropertiesWithSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java index f2c3bac9dfb..e6ea2375397 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -65,7 +64,7 @@ public static Schema0Map of(Map arg, SchemaC public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -211,7 +210,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,7 +222,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,7 +234,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,24 +245,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -295,7 +294,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -322,7 +321,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +329,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -340,7 +339,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -352,7 +351,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -367,10 +366,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,34 +384,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -428,7 +427,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -458,7 +457,7 @@ public static Schema1Map of(Map arg, SchemaC public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -586,7 +585,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -598,7 +597,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -610,7 +609,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -621,24 +620,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -670,7 +669,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -697,7 +696,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +704,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -715,7 +714,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -727,7 +726,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -742,10 +741,10 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,34 +759,34 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -803,7 +802,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -880,7 +879,7 @@ public static Allof1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -892,7 +891,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -904,7 +903,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -915,24 +914,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -964,7 +963,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -991,7 +990,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +998,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1009,7 +1008,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1021,7 +1020,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1036,10 +1035,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,34 +1053,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Allof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedVoid(validate(arg, configuration)); } @Override - public Allof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedBoolean(validate(arg, configuration)); } @Override - public Allof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedNumber(validate(arg, configuration)); } @Override - public Allof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedString(validate(arg, configuration)); } @Override - public Allof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedList(validate(arg, configuration)); } @Override - public Allof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Allof1BoxedMap(validate(arg, configuration)); } @Override - public Allof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Allof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1097,7 +1096,7 @@ public Allof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java index e17daac12ce..856d9d3abfb 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -100,7 +99,7 @@ public static Schema02 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -124,7 +123,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,24 +134,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -211,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -229,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +240,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -256,10 +255,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -274,34 +273,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema02BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedVoid(validate(arg, configuration)); } @Override - public Schema02BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedBoolean(validate(arg, configuration)); } @Override - public Schema02BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedNumber(validate(arg, configuration)); } @Override - public Schema02BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedString(validate(arg, configuration)); } @Override - public Schema02BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedList(validate(arg, configuration)); } @Override - public Schema02BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema02BoxedMap(validate(arg, configuration)); } @Override - public Schema02Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema02Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -317,7 +316,7 @@ public Schema02Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -385,7 +384,7 @@ public static Schema01 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -397,7 +396,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -409,7 +408,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -420,24 +419,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -469,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -504,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -514,7 +513,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -526,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -541,10 +540,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -559,34 +558,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedVoid(validate(arg, configuration)); } @Override - public Schema01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedBoolean(validate(arg, configuration)); } @Override - public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedNumber(validate(arg, configuration)); } @Override - public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedString(validate(arg, configuration)); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedMap(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -602,7 +601,7 @@ public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -670,7 +669,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -682,7 +681,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -694,7 +693,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -705,24 +704,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -754,7 +753,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -781,7 +780,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -789,7 +788,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -799,7 +798,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -811,7 +810,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -826,10 +825,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -844,34 +843,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -887,7 +886,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -969,7 +968,7 @@ public static AllofCombinedWithAnyofOneof1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -981,7 +980,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -993,7 +992,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1004,24 +1003,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1053,7 +1052,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1080,7 +1079,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1088,7 +1087,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1098,7 +1097,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1110,7 +1109,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1125,10 +1124,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1143,34 +1142,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofCombinedWithAnyofOneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedVoid(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedNumber(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedString(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedList(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofCombinedWithAnyofOneof1BoxedMap(validate(arg, configuration)); } @Override - public AllofCombinedWithAnyofOneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofCombinedWithAnyofOneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1186,7 +1185,7 @@ public AllofCombinedWithAnyofOneof1Boxed validateAndBox(@Nullable Object arg, Sc } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java index 4c9d473a2f9..9ce014d0248 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -99,7 +98,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -111,7 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -134,24 +133,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -210,7 +209,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -255,10 +254,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,34 +272,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -316,7 +315,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -384,7 +383,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -396,7 +395,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -408,7 +407,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,24 +418,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -468,7 +467,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -495,7 +494,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +502,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -513,7 +512,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -540,10 +539,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,34 +557,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -601,7 +600,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -678,7 +677,7 @@ public static AllofSimpleTypes1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -690,7 +689,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -702,7 +701,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -713,24 +712,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -762,7 +761,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -789,7 +788,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -797,7 +796,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -807,7 +806,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -819,7 +818,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -834,10 +833,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -852,34 +851,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofSimpleTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedVoid(validate(arg, configuration)); } @Override - public AllofSimpleTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofSimpleTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedNumber(validate(arg, configuration)); } @Override - public AllofSimpleTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedString(validate(arg, configuration)); } @Override - public AllofSimpleTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedList(validate(arg, configuration)); } @Override - public AllofSimpleTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofSimpleTypes1BoxedMap(validate(arg, configuration)); } @Override - public AllofSimpleTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofSimpleTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -895,7 +894,7 @@ public AllofSimpleTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfigu } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java index a67e189c9e4..698b971ecc6 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +65,7 @@ public static Schema0Map of(Map arg, SchemaC public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -194,7 +193,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,7 +205,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,7 +217,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -229,24 +228,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -278,7 +277,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -305,7 +304,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -313,7 +312,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -323,7 +322,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -335,7 +334,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -350,10 +349,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -368,34 +367,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -411,7 +410,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -441,7 +440,7 @@ public static Schema1Map of(Map arg, SchemaC public Void baz() { @Nullable Object value = get("baz"); if (!(value == null || value instanceof Void)) { - throw new InvalidTypeException("Invalid value stored for baz"); + throw new RuntimeException("Invalid value stored for baz"); } return (Void) value; } @@ -569,7 +568,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -581,7 +580,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -593,7 +592,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -604,24 +603,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -653,7 +652,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -680,7 +679,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -688,7 +687,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -698,7 +697,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -710,7 +709,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -725,10 +724,10 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -743,34 +742,34 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -786,7 +785,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -816,7 +815,7 @@ public static AllofWithBaseSchemaMap of(Map public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -972,7 +971,7 @@ public static AllofWithBaseSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -984,7 +983,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -996,7 +995,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1007,24 +1006,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1056,7 +1055,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1083,7 +1082,7 @@ public AllofWithBaseSchemaMap getNewInstance(Map arg, List pathToI for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1091,7 +1090,7 @@ public AllofWithBaseSchemaMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1101,7 +1100,7 @@ public AllofWithBaseSchemaMap getNewInstance(Map arg, List pathToI return new AllofWithBaseSchemaMap(castProperties); } - public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1113,7 +1112,7 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration config } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1128,10 +1127,10 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration config } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1146,34 +1145,34 @@ public AllofWithBaseSchemaMap validate(Map arg, SchemaConfiguration config } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofWithBaseSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedVoid(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedNumber(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedString(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedList(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithBaseSchema1BoxedMap(validate(arg, configuration)); } @Override - public AllofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1189,7 +1188,7 @@ public AllofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java index 6ad17067551..5d05360f9f3 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -119,7 +118,7 @@ public static AllofWithOneEmptySchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,7 +130,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,7 +142,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -154,24 +153,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -230,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -238,7 +237,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -248,7 +247,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -260,7 +259,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -275,10 +274,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -293,34 +292,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedString(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedList(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithOneEmptySchema1BoxedMap(validate(arg, configuration)); } @Override - public AllofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -336,7 +335,7 @@ public AllofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, Schema } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java index 77063ed5e5c..58da6606e04 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -132,7 +131,7 @@ public static AllofWithTheFirstEmptySchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,7 +143,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,7 +155,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -167,24 +166,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -243,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -261,7 +260,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -273,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -288,10 +287,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,34 +305,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofWithTheFirstEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedVoid(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedNumber(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedString(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedList(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheFirstEmptySchema1BoxedMap(validate(arg, configuration)); } @Override - public AllofWithTheFirstEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheFirstEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -349,7 +348,7 @@ public AllofWithTheFirstEmptySchema1Boxed validateAndBox(@Nullable Object arg, S } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java index 0ea5f48a712..ce1633d2a1f 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -132,7 +131,7 @@ public static AllofWithTheLastEmptySchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,7 +143,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,7 +155,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -167,24 +166,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -243,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -261,7 +260,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -273,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -288,10 +287,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,34 +305,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofWithTheLastEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedVoid(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedNumber(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedString(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedList(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTheLastEmptySchema1BoxedMap(validate(arg, configuration)); } @Override - public AllofWithTheLastEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTheLastEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -349,7 +348,7 @@ public AllofWithTheLastEmptySchema1Boxed validateAndBox(@Nullable Object arg, Sc } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java index 6430ce42fd0..cb91cb50c79 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -131,7 +130,7 @@ public static AllofWithTwoEmptySchemas1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,7 +142,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -155,7 +154,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -166,24 +165,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,7 +214,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -250,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -260,7 +259,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -272,7 +271,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -287,10 +286,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -305,34 +304,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AllofWithTwoEmptySchemas1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedVoid(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedBoolean(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedNumber(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedString(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedList(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AllofWithTwoEmptySchemas1BoxedMap(validate(arg, configuration)); } @Override - public AllofWithTwoEmptySchemas1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AllofWithTwoEmptySchemas1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -348,7 +347,7 @@ public AllofWithTwoEmptySchemas1Boxed validateAndBox(@Nullable Object arg, Schem } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java index 901e8939216..66159633ae0 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Anyof.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; @@ -111,7 +110,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,7 +134,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -146,24 +145,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,7 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -222,7 +221,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -252,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -267,10 +266,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -285,34 +284,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -328,7 +327,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -405,7 +404,7 @@ public static Anyof1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -417,7 +416,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -429,7 +428,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -440,24 +439,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -489,7 +488,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -516,7 +515,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -524,7 +523,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -534,7 +533,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -546,7 +545,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -561,10 +560,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -579,34 +578,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Anyof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedVoid(validate(arg, configuration)); } @Override - public Anyof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedBoolean(validate(arg, configuration)); } @Override - public Anyof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedNumber(validate(arg, configuration)); } @Override - public Anyof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedString(validate(arg, configuration)); } @Override - public Anyof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedList(validate(arg, configuration)); } @Override - public Anyof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Anyof1BoxedMap(validate(arg, configuration)); } @Override - public Anyof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Anyof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -622,7 +621,7 @@ public Anyof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java index 1057b9bce71..d0c90282afe 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -65,7 +64,7 @@ public static Schema0Map of(Map arg, SchemaC public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -211,7 +210,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,7 +222,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,7 +234,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,24 +245,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -295,7 +294,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -322,7 +321,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +329,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -340,7 +339,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -352,7 +351,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -367,10 +366,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,34 +384,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -428,7 +427,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -458,7 +457,7 @@ public static Schema1Map of(Map arg, SchemaC public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -586,7 +585,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -598,7 +597,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -610,7 +609,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -621,24 +620,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -670,7 +669,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -697,7 +696,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +704,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -715,7 +714,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -727,7 +726,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -742,10 +741,10 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,34 +759,34 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -803,7 +802,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -880,7 +879,7 @@ public static AnyofComplexTypes1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -892,7 +891,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -904,7 +903,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -915,24 +914,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -964,7 +963,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -991,7 +990,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +998,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1009,7 +1008,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1021,7 +1020,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1036,10 +1035,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,34 +1053,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedVoid(validate(arg, configuration)); } @Override - public AnyofComplexTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyofComplexTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedNumber(validate(arg, configuration)); } @Override - public AnyofComplexTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedString(validate(arg, configuration)); } @Override - public AnyofComplexTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedList(validate(arg, configuration)); } @Override - public AnyofComplexTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofComplexTypes1BoxedMap(validate(arg, configuration)); } @Override - public AnyofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1097,7 +1096,7 @@ public AnyofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java index c3885e3556d..59378958342 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -99,7 +98,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -111,7 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -134,24 +133,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -210,7 +209,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -255,10 +254,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,34 +272,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -316,7 +315,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -384,7 +383,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -396,7 +395,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -408,7 +407,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,24 +418,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -468,7 +467,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -495,7 +494,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +502,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -513,7 +512,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -540,10 +539,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,34 +557,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -601,7 +600,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -658,29 +657,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithBaseSchema1BoxedString(validate(arg, configuration)); } @Override - public AnyofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java index 8566d7392b2..c8613b132f2 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -132,7 +131,7 @@ public static AnyofWithOneEmptySchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,7 +143,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,7 +155,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -167,24 +166,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -243,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -261,7 +260,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -273,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -288,10 +287,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,34 +305,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedString(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedList(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyofWithOneEmptySchema1BoxedMap(validate(arg, configuration)); } @Override - public AnyofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -349,7 +348,7 @@ public AnyofWithOneEmptySchema1Boxed validateAndBox(@Nullable Object arg, Schema } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java index ebcbb032fc3..8fe59faa883 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByInt.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -106,7 +105,7 @@ public static ByInt1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -118,7 +117,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,7 +129,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,24 +140,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -190,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -217,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -235,7 +234,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -247,7 +246,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,10 +261,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,34 +279,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ByInt1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedVoid(validate(arg, configuration)); } @Override - public ByInt1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedBoolean(validate(arg, configuration)); } @Override - public ByInt1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedNumber(validate(arg, configuration)); } @Override - public ByInt1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedString(validate(arg, configuration)); } @Override - public ByInt1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedList(validate(arg, configuration)); } @Override - public ByInt1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ByInt1BoxedMap(validate(arg, configuration)); } @Override - public ByInt1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByInt1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -323,7 +322,7 @@ public ByInt1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java index 828c756720c..93433de2ebf 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ByNumber.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -106,7 +105,7 @@ public static ByNumber1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -118,7 +117,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,7 +129,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,24 +140,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -190,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -217,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -235,7 +234,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -247,7 +246,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,10 +261,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,34 +279,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ByNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedVoid(validate(arg, configuration)); } @Override - public ByNumber1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedBoolean(validate(arg, configuration)); } @Override - public ByNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedNumber(validate(arg, configuration)); } @Override - public ByNumber1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedString(validate(arg, configuration)); } @Override - public ByNumber1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedList(validate(arg, configuration)); } @Override - public ByNumber1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ByNumber1BoxedMap(validate(arg, configuration)); } @Override - public ByNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ByNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -323,7 +322,7 @@ public ByNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java index c91371daa4a..404a15c9aaa 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/BySmallNumber.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -106,7 +105,7 @@ public static BySmallNumber1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -118,7 +117,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -130,7 +129,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,24 +140,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -190,7 +189,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -217,7 +216,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -225,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -235,7 +234,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -247,7 +246,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,10 +261,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -280,34 +279,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BySmallNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedVoid(validate(arg, configuration)); } @Override - public BySmallNumber1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedBoolean(validate(arg, configuration)); } @Override - public BySmallNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedNumber(validate(arg, configuration)); } @Override - public BySmallNumber1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedString(validate(arg, configuration)); } @Override - public BySmallNumber1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedList(validate(arg, configuration)); } @Override - public BySmallNumber1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new BySmallNumber1BoxedMap(validate(arg, configuration)); } @Override - public BySmallNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BySmallNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -323,7 +322,7 @@ public BySmallNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurat } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.java index a0830962bc1..406c120805b 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -119,7 +118,7 @@ public static ConstNulCharactersInStrings1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,7 +130,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,7 +142,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -154,24 +153,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +202,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -230,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -238,7 +237,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -248,7 +247,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -260,7 +259,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -275,10 +274,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -293,34 +292,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ConstNulCharactersInStrings1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ConstNulCharactersInStrings1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ConstNulCharactersInStrings1BoxedVoid(validate(arg, configuration)); } @Override - public ConstNulCharactersInStrings1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ConstNulCharactersInStrings1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ConstNulCharactersInStrings1BoxedBoolean(validate(arg, configuration)); } @Override - public ConstNulCharactersInStrings1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ConstNulCharactersInStrings1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ConstNulCharactersInStrings1BoxedNumber(validate(arg, configuration)); } @Override - public ConstNulCharactersInStrings1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ConstNulCharactersInStrings1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ConstNulCharactersInStrings1BoxedString(validate(arg, configuration)); } @Override - public ConstNulCharactersInStrings1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ConstNulCharactersInStrings1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ConstNulCharactersInStrings1BoxedList(validate(arg, configuration)); } @Override - public ConstNulCharactersInStrings1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ConstNulCharactersInStrings1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ConstNulCharactersInStrings1BoxedMap(validate(arg, configuration)); } @Override - public ConstNulCharactersInStrings1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ConstNulCharactersInStrings1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -336,7 +335,7 @@ public ConstNulCharactersInStrings1Boxed validateAndBox(@Nullable Object arg, Sc } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.java index b01a97a19a3..5b1f5093892 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -99,7 +98,7 @@ public static Contains getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -111,7 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -134,24 +133,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -210,7 +209,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -255,10 +254,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,34 +272,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ContainsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedVoid(validate(arg, configuration)); } @Override - public ContainsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedBoolean(validate(arg, configuration)); } @Override - public ContainsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedNumber(validate(arg, configuration)); } @Override - public ContainsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedString(validate(arg, configuration)); } @Override - public ContainsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedList(validate(arg, configuration)); } @Override - public ContainsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedMap(validate(arg, configuration)); } @Override - public ContainsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -316,7 +315,7 @@ public ContainsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -390,7 +389,7 @@ public static ContainsKeywordValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,7 +401,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -414,7 +413,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -425,24 +424,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -474,7 +473,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -501,7 +500,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -509,7 +508,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -519,7 +518,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -531,7 +530,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -546,10 +545,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -564,34 +563,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ContainsKeywordValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsKeywordValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsKeywordValidation1BoxedVoid(validate(arg, configuration)); } @Override - public ContainsKeywordValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsKeywordValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsKeywordValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public ContainsKeywordValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsKeywordValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsKeywordValidation1BoxedNumber(validate(arg, configuration)); } @Override - public ContainsKeywordValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsKeywordValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsKeywordValidation1BoxedString(validate(arg, configuration)); } @Override - public ContainsKeywordValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsKeywordValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsKeywordValidation1BoxedList(validate(arg, configuration)); } @Override - public ContainsKeywordValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsKeywordValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsKeywordValidation1BoxedMap(validate(arg, configuration)); } @Override - public ContainsKeywordValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsKeywordValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -607,7 +606,7 @@ public ContainsKeywordValidation1Boxed validateAndBox(@Nullable Object arg, Sche } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.java index ba2b387ffe4..97d9abb81d0 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -117,7 +116,7 @@ public static ContainsWithNullInstanceElements1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,7 +140,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,24 +151,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -273,10 +272,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -291,34 +290,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ContainsWithNullInstanceElements1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsWithNullInstanceElements1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsWithNullInstanceElements1BoxedVoid(validate(arg, configuration)); } @Override - public ContainsWithNullInstanceElements1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsWithNullInstanceElements1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsWithNullInstanceElements1BoxedBoolean(validate(arg, configuration)); } @Override - public ContainsWithNullInstanceElements1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsWithNullInstanceElements1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsWithNullInstanceElements1BoxedNumber(validate(arg, configuration)); } @Override - public ContainsWithNullInstanceElements1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsWithNullInstanceElements1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsWithNullInstanceElements1BoxedString(validate(arg, configuration)); } @Override - public ContainsWithNullInstanceElements1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsWithNullInstanceElements1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsWithNullInstanceElements1BoxedList(validate(arg, configuration)); } @Override - public ContainsWithNullInstanceElements1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsWithNullInstanceElements1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsWithNullInstanceElements1BoxedMap(validate(arg, configuration)); } @Override - public ContainsWithNullInstanceElements1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsWithNullInstanceElements1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -334,7 +333,7 @@ public ContainsWithNullInstanceElements1Boxed validateAndBox(@Nullable Object ar } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateFormat.java index 06354a2929a..c8b360a3a99 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static DateFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DateFormat1BoxedVoid(validate(arg, configuration)); } @Override - public DateFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DateFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public DateFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DateFormat1BoxedNumber(validate(arg, configuration)); } @Override - public DateFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateFormat1BoxedString(validate(arg, configuration)); } @Override - public DateFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DateFormat1BoxedList(validate(arg, configuration)); } @Override - public DateFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DateFormat1BoxedMap(validate(arg, configuration)); } @Override - public DateFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public DateFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java index fd3953683af..a8a45bb6723 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static DateTimeFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateTimeFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedVoid(validate(arg, configuration)); } @Override - public DateTimeFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public DateTimeFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedNumber(validate(arg, configuration)); } @Override - public DateTimeFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedString(validate(arg, configuration)); } @Override - public DateTimeFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedList(validate(arg, configuration)); } @Override - public DateTimeFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeFormat1BoxedMap(validate(arg, configuration)); } @Override - public DateTimeFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public DateTimeFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfigura } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.java index 93904b1952f..fd03924fda5 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -101,7 +100,7 @@ public static Footbar getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -113,7 +112,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -136,24 +135,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,7 +184,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -212,7 +211,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -220,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -230,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -257,10 +256,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -275,34 +274,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FootbarBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FootbarBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new FootbarBoxedVoid(validate(arg, configuration)); } @Override - public FootbarBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FootbarBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new FootbarBoxedBoolean(validate(arg, configuration)); } @Override - public FootbarBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FootbarBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FootbarBoxedNumber(validate(arg, configuration)); } @Override - public FootbarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FootbarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new FootbarBoxedString(validate(arg, configuration)); } @Override - public FootbarBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FootbarBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new FootbarBoxedList(validate(arg, configuration)); } @Override - public FootbarBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FootbarBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FootbarBoxedMap(validate(arg, configuration)); } @Override - public FootbarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FootbarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -318,7 +317,7 @@ public FootbarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -502,7 +501,7 @@ public static Foobar getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -514,7 +513,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -526,7 +525,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -537,24 +536,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -586,7 +585,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -613,7 +612,7 @@ public FoobarMap getNewInstance(Map arg, List pathToItem, PathToSc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -621,7 +620,7 @@ public FoobarMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -631,7 +630,7 @@ public FoobarMap getNewInstance(Map arg, List pathToItem, PathToSc return new FoobarMap(castProperties); } - public FoobarMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoobarMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -643,7 +642,7 @@ public FoobarMap validate(Map arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -658,10 +657,10 @@ public FoobarMap validate(Map arg, SchemaConfiguration configuration) thro } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -676,34 +675,34 @@ public FoobarMap validate(Map arg, SchemaConfiguration configuration) thro } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FoobarBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoobarBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new FoobarBoxedVoid(validate(arg, configuration)); } @Override - public FoobarBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoobarBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new FoobarBoxedBoolean(validate(arg, configuration)); } @Override - public FoobarBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoobarBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FoobarBoxedNumber(validate(arg, configuration)); } @Override - public FoobarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoobarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new FoobarBoxedString(validate(arg, configuration)); } @Override - public FoobarBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoobarBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new FoobarBoxedList(validate(arg, configuration)); } @Override - public FoobarBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoobarBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FoobarBoxedMap(validate(arg, configuration)); } @Override - public FoobarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoobarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -719,7 +718,7 @@ public FoobarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -796,7 +795,7 @@ public static DependentSchemasDependenciesWithEscapedCharacters1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -808,7 +807,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -820,7 +819,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -831,24 +830,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -880,7 +879,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -907,7 +906,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -915,7 +914,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -925,7 +924,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -937,7 +936,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -952,10 +951,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -970,34 +969,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid(validate(arg, configuration)); } @Override - public DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)); } @Override - public DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber(validate(arg, configuration)); } @Override - public DependentSchemasDependenciesWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependenciesWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependenciesWithEscapedCharacters1BoxedString(validate(arg, configuration)); } @Override - public DependentSchemasDependenciesWithEscapedCharacters1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependenciesWithEscapedCharacters1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependenciesWithEscapedCharacters1BoxedList(validate(arg, configuration)); } @Override - public DependentSchemasDependenciesWithEscapedCharacters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependenciesWithEscapedCharacters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependenciesWithEscapedCharacters1BoxedMap(validate(arg, configuration)); } @Override - public DependentSchemasDependenciesWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependenciesWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1013,7 +1012,7 @@ public DependentSchemasDependenciesWithEscapedCharacters1Boxed validateAndBox(@N } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.java index 83c040554bf..4ed83aa1f7d 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -199,7 +198,7 @@ public FooMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -207,7 +206,7 @@ public FooMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -217,7 +216,7 @@ public FooMap getNewInstance(Map arg, List pathToItem, PathToSchem return new FooMap(castProperties); } - public FooMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -229,29 +228,29 @@ public FooMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Foo1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Foo1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Foo1BoxedMap(validate(arg, configuration)); } @Override - public Foo1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Foo1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -450,7 +449,7 @@ public static DependentSchemasDependentSubschemaIncompatibleWithRoot1 getInstanc } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -462,7 +461,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -474,7 +473,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -485,24 +484,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -534,7 +533,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -561,7 +560,7 @@ public DependentSchemasDependentSubschemaIncompatibleWithRootMap getNewInstance( for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -569,7 +568,7 @@ public DependentSchemasDependentSubschemaIncompatibleWithRootMap getNewInstance( Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -579,7 +578,7 @@ public DependentSchemasDependentSubschemaIncompatibleWithRootMap getNewInstance( return new DependentSchemasDependentSubschemaIncompatibleWithRootMap(castProperties); } - public DependentSchemasDependentSubschemaIncompatibleWithRootMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependentSubschemaIncompatibleWithRootMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -591,7 +590,7 @@ public DependentSchemasDependentSubschemaIncompatibleWithRootMap validate(Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -624,34 +623,34 @@ public DependentSchemasDependentSubschemaIncompatibleWithRootMap validate(Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid(validate(arg, configuration)); } @Override - public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean(validate(arg, configuration)); } @Override - public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber(validate(arg, configuration)); } @Override - public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString(validate(arg, configuration)); } @Override - public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList(validate(arg, configuration)); } @Override - public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap(validate(arg, configuration)); } @Override - public DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -667,7 +666,7 @@ public DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed validateAndB } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.java index 8ba4171811e..eaa33eadb20 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -78,7 +77,7 @@ public Number foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (Number) value; } @@ -88,7 +87,7 @@ public Number bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -255,7 +254,7 @@ public static Bar getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,7 +266,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -279,7 +278,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -290,24 +289,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -339,7 +338,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -366,7 +365,7 @@ public BarMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -374,7 +373,7 @@ public BarMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -384,7 +383,7 @@ public BarMap getNewInstance(Map arg, List pathToItem, PathToSchem return new BarMap(castProperties); } - public BarMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -396,7 +395,7 @@ public BarMap validate(Map arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -411,10 +410,10 @@ public BarMap validate(Map arg, SchemaConfiguration configuration) throws } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -429,34 +428,34 @@ public BarMap validate(Map arg, SchemaConfiguration configuration) throws } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BarBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new BarBoxedVoid(validate(arg, configuration)); } @Override - public BarBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BarBoxedBoolean(validate(arg, configuration)); } @Override - public BarBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new BarBoxedNumber(validate(arg, configuration)); } @Override - public BarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new BarBoxedString(validate(arg, configuration)); } @Override - public BarBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new BarBoxedList(validate(arg, configuration)); } @Override - public BarBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new BarBoxedMap(validate(arg, configuration)); } @Override - public BarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -472,7 +471,7 @@ public BarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configu } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -548,7 +547,7 @@ public static DependentSchemasSingleDependency1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -560,7 +559,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -572,7 +571,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -583,24 +582,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -632,7 +631,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -659,7 +658,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -667,7 +666,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -677,7 +676,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -689,7 +688,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -704,10 +703,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -722,34 +721,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DependentSchemasSingleDependency1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasSingleDependency1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasSingleDependency1BoxedVoid(validate(arg, configuration)); } @Override - public DependentSchemasSingleDependency1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasSingleDependency1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasSingleDependency1BoxedBoolean(validate(arg, configuration)); } @Override - public DependentSchemasSingleDependency1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasSingleDependency1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasSingleDependency1BoxedNumber(validate(arg, configuration)); } @Override - public DependentSchemasSingleDependency1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasSingleDependency1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasSingleDependency1BoxedString(validate(arg, configuration)); } @Override - public DependentSchemasSingleDependency1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasSingleDependency1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasSingleDependency1BoxedList(validate(arg, configuration)); } @Override - public DependentSchemasSingleDependency1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasSingleDependency1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DependentSchemasSingleDependency1BoxedMap(validate(arg, configuration)); } @Override - public DependentSchemasSingleDependency1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DependentSchemasSingleDependency1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -765,7 +764,7 @@ public DependentSchemasSingleDependency1Boxed validateAndBox(@Nullable Object ar } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DurationFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DurationFormat.java index 6cbb99d9a8c..987e5bded08 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DurationFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/DurationFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static DurationFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DurationFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DurationFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DurationFormat1BoxedVoid(validate(arg, configuration)); } @Override - public DurationFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DurationFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DurationFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public DurationFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DurationFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DurationFormat1BoxedNumber(validate(arg, configuration)); } @Override - public DurationFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DurationFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DurationFormat1BoxedString(validate(arg, configuration)); } @Override - public DurationFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DurationFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DurationFormat1BoxedList(validate(arg, configuration)); } @Override - public DurationFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DurationFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DurationFormat1BoxedMap(validate(arg, configuration)); } @Override - public DurationFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DurationFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public DurationFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfigura } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java index 97090800803..8f6d32fe0bc 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmailFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static EmailFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EmailFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedVoid(validate(arg, configuration)); } @Override - public EmailFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public EmailFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedNumber(validate(arg, configuration)); } @Override - public EmailFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedString(validate(arg, configuration)); } @Override - public EmailFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedList(validate(arg, configuration)); } @Override - public EmailFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EmailFormat1BoxedMap(validate(arg, configuration)); } @Override - public EmailFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmailFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public EmailFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmptyDependents.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmptyDependents.java index 8ab187d5d7d..f0a6280acb6 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmptyDependents.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EmptyDependents.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; @@ -114,7 +113,7 @@ public static EmptyDependents1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -126,7 +125,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -138,7 +137,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -149,24 +148,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -198,7 +197,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -225,7 +224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -233,7 +232,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -243,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -255,7 +254,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -270,10 +269,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -288,34 +287,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EmptyDependents1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyDependents1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new EmptyDependents1BoxedVoid(validate(arg, configuration)); } @Override - public EmptyDependents1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyDependents1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new EmptyDependents1BoxedBoolean(validate(arg, configuration)); } @Override - public EmptyDependents1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyDependents1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EmptyDependents1BoxedNumber(validate(arg, configuration)); } @Override - public EmptyDependents1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyDependents1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EmptyDependents1BoxedString(validate(arg, configuration)); } @Override - public EmptyDependents1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyDependents1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new EmptyDependents1BoxedList(validate(arg, configuration)); } @Override - public EmptyDependents1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyDependents1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EmptyDependents1BoxedMap(validate(arg, configuration)); } @Override - public EmptyDependents1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyDependents1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -331,7 +330,7 @@ public EmptyDependents1Boxed validateAndBox(@Nullable Object arg, SchemaConfigur } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java index 925c8e678d9..e762044b002 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -168,29 +167,29 @@ public double validate(DoubleEnumWith0DoesNotMatchFalseEnums arg,SchemaConfigura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumWith0DoesNotMatchFalse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWith0DoesNotMatchFalse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EnumWith0DoesNotMatchFalse1BoxedNumber(validate(arg, configuration)); } @Override - public EnumWith0DoesNotMatchFalse1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWith0DoesNotMatchFalse1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java index 3fc1f77d7d0..0924081d382 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -168,29 +167,29 @@ public double validate(DoubleEnumWith1DoesNotMatchTrueEnums arg,SchemaConfigurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumWith1DoesNotMatchTrue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWith1DoesNotMatchTrue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EnumWith1DoesNotMatchTrue1BoxedNumber(validate(arg, configuration)); } @Override - public EnumWith1DoesNotMatchTrue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWith1DoesNotMatchTrue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java index d5dab170d98..5567fdd3228 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -93,29 +92,29 @@ public String validate(StringEnumWithEscapedCharactersEnums arg,SchemaConfigurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EnumWithEscapedCharacters1BoxedString(validate(arg, configuration)); } @Override - public EnumWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java index bfc0223b2f7..afd6b062012 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator; @@ -89,32 +88,32 @@ public boolean validate(BooleanEnumWithFalseDoesNotMatch0Enums arg,SchemaConfigu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumWithFalseDoesNotMatch01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithFalseDoesNotMatch01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new EnumWithFalseDoesNotMatch01BoxedBoolean(validate(arg, configuration)); } @Override - public EnumWithFalseDoesNotMatch01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithFalseDoesNotMatch01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java index 4581de4b395..df89d7cd7ac 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator; @@ -89,32 +88,32 @@ public boolean validate(BooleanEnumWithTrueDoesNotMatch1Enums arg,SchemaConfigur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumWithTrueDoesNotMatch11BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithTrueDoesNotMatch11BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new EnumWithTrueDoesNotMatch11BoxedBoolean(validate(arg, configuration)); } @Override - public EnumWithTrueDoesNotMatch11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumWithTrueDoesNotMatch11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java index 3822c82493e..7b05dad2aab 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumsInProperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -95,29 +94,29 @@ public String validate(StringFooEnums arg,SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FooBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new FooBoxedString(validate(arg, configuration)); } @Override - public FooBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringBarEnums implements StringValueMethod { @@ -184,29 +183,29 @@ public String validate(StringBarEnums arg,SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new BarBoxedString(validate(arg, configuration)); } @Override - public BarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -227,7 +226,7 @@ public static EnumsInPropertiesMap of(Map ar public String bar() { @Nullable Object value = get("bar"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -237,7 +236,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -369,7 +368,7 @@ public EnumsInPropertiesMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -377,7 +376,7 @@ public EnumsInPropertiesMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -387,7 +386,7 @@ public EnumsInPropertiesMap getNewInstance(Map arg, List pathToIte return new EnumsInPropertiesMap(castProperties); } - public EnumsInPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumsInPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -399,29 +398,29 @@ public EnumsInPropertiesMap validate(Map arg, SchemaConfiguration configur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumsInProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumsInProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EnumsInProperties1BoxedMap(validate(arg, configuration)); } @Override - public EnumsInProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumsInProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.java index d4454126242..8cadc733d31 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static ExclusivemaximumValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ExclusivemaximumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusivemaximumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusivemaximumValidation1BoxedVoid(validate(arg, configuration)); } @Override - public ExclusivemaximumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusivemaximumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusivemaximumValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public ExclusivemaximumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusivemaximumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusivemaximumValidation1BoxedNumber(validate(arg, configuration)); } @Override - public ExclusivemaximumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusivemaximumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusivemaximumValidation1BoxedString(validate(arg, configuration)); } @Override - public ExclusivemaximumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusivemaximumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusivemaximumValidation1BoxedList(validate(arg, configuration)); } @Override - public ExclusivemaximumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusivemaximumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusivemaximumValidation1BoxedMap(validate(arg, configuration)); } @Override - public ExclusivemaximumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusivemaximumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public ExclusivemaximumValidation1Boxed validateAndBox(@Nullable Object arg, Sch } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.java index 1da2ea949b2..349291eb553 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static ExclusiveminimumValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ExclusiveminimumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusiveminimumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusiveminimumValidation1BoxedVoid(validate(arg, configuration)); } @Override - public ExclusiveminimumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusiveminimumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusiveminimumValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public ExclusiveminimumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusiveminimumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusiveminimumValidation1BoxedNumber(validate(arg, configuration)); } @Override - public ExclusiveminimumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusiveminimumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusiveminimumValidation1BoxedString(validate(arg, configuration)); } @Override - public ExclusiveminimumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusiveminimumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusiveminimumValidation1BoxedList(validate(arg, configuration)); } @Override - public ExclusiveminimumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusiveminimumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ExclusiveminimumValidation1BoxedMap(validate(arg, configuration)); } @Override - public ExclusiveminimumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ExclusiveminimumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public ExclusiveminimumValidation1Boxed validateAndBox(@Nullable Object arg, Sch } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.java index 5b46639e358..4b13c4581cf 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -90,29 +89,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FloatDivisionInf1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatDivisionInf1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FloatDivisionInf1BoxedNumber(validate(arg, configuration)); } @Override - public FloatDivisionInf1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatDivisionInf1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java index 203112478de..7d72c39a7c8 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -113,7 +112,7 @@ public static Foo getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FooBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new FooBoxedVoid(validate(arg, configuration)); } @Override - public FooBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new FooBoxedBoolean(validate(arg, configuration)); } @Override - public FooBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FooBoxedNumber(validate(arg, configuration)); } @Override - public FooBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new FooBoxedString(validate(arg, configuration)); } @Override - public FooBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new FooBoxedList(validate(arg, configuration)); } @Override - public FooBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FooBoxedMap(validate(arg, configuration)); } @Override - public FooBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public FooBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configu } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -514,7 +513,7 @@ public static ForbiddenProperty1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -526,7 +525,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -538,7 +537,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -549,24 +548,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -598,7 +597,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -625,7 +624,7 @@ public ForbiddenPropertyMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -633,7 +632,7 @@ public ForbiddenPropertyMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -643,7 +642,7 @@ public ForbiddenPropertyMap getNewInstance(Map arg, List pathToIte return new ForbiddenPropertyMap(castProperties); } - public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -655,7 +654,7 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -670,10 +669,10 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -688,34 +687,34 @@ public ForbiddenPropertyMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ForbiddenProperty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedVoid(validate(arg, configuration)); } @Override - public ForbiddenProperty1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedBoolean(validate(arg, configuration)); } @Override - public ForbiddenProperty1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedNumber(validate(arg, configuration)); } @Override - public ForbiddenProperty1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedString(validate(arg, configuration)); } @Override - public ForbiddenProperty1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedList(validate(arg, configuration)); } @Override - public ForbiddenProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ForbiddenProperty1BoxedMap(validate(arg, configuration)); } @Override - public ForbiddenProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ForbiddenProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -731,7 +730,7 @@ public ForbiddenProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java index da84ef4c6ed..94bf4a17b61 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/HostnameFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static HostnameFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HostnameFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedVoid(validate(arg, configuration)); } @Override - public HostnameFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public HostnameFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedNumber(validate(arg, configuration)); } @Override - public HostnameFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedString(validate(arg, configuration)); } @Override - public HostnameFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedList(validate(arg, configuration)); } @Override - public HostnameFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HostnameFormat1BoxedMap(validate(arg, configuration)); } @Override - public HostnameFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HostnameFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public HostnameFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfigura } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.java index 1264c17e8a3..0347818971b 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static IdnEmailFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IdnEmailFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnEmailFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IdnEmailFormat1BoxedVoid(validate(arg, configuration)); } @Override - public IdnEmailFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnEmailFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IdnEmailFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public IdnEmailFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnEmailFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IdnEmailFormat1BoxedNumber(validate(arg, configuration)); } @Override - public IdnEmailFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnEmailFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IdnEmailFormat1BoxedString(validate(arg, configuration)); } @Override - public IdnEmailFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnEmailFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IdnEmailFormat1BoxedList(validate(arg, configuration)); } @Override - public IdnEmailFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnEmailFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IdnEmailFormat1BoxedMap(validate(arg, configuration)); } @Override - public IdnEmailFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnEmailFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public IdnEmailFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfigura } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.java index 54319cb6f3a..76e7459a8ce 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static IdnHostnameFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IdnHostnameFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnHostnameFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IdnHostnameFormat1BoxedVoid(validate(arg, configuration)); } @Override - public IdnHostnameFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnHostnameFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IdnHostnameFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public IdnHostnameFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnHostnameFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IdnHostnameFormat1BoxedNumber(validate(arg, configuration)); } @Override - public IdnHostnameFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnHostnameFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IdnHostnameFormat1BoxedString(validate(arg, configuration)); } @Override - public IdnHostnameFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnHostnameFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IdnHostnameFormat1BoxedList(validate(arg, configuration)); } @Override - public IdnHostnameFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnHostnameFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IdnHostnameFormat1BoxedMap(validate(arg, configuration)); } @Override - public IdnHostnameFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IdnHostnameFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public IdnHostnameFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.java index 9c02b645f10..b8a7fad4fb1 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -100,7 +99,7 @@ public static ElseSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -124,7 +123,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,24 +134,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -211,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -229,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +240,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -256,10 +255,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -274,34 +273,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ElseSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedVoid(validate(arg, configuration)); } @Override - public ElseSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public ElseSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedNumber(validate(arg, configuration)); } @Override - public ElseSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedString(validate(arg, configuration)); } @Override - public ElseSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedList(validate(arg, configuration)); } @Override - public ElseSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedMap(validate(arg, configuration)); } @Override - public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -317,7 +316,7 @@ public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -385,7 +384,7 @@ public static IfSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -397,7 +396,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -409,7 +408,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -420,24 +419,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -469,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -504,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -514,7 +513,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -526,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -541,10 +540,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -559,34 +558,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedVoid(validate(arg, configuration)); } @Override - public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedNumber(validate(arg, configuration)); } @Override - public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedString(validate(arg, configuration)); } @Override - public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedList(validate(arg, configuration)); } @Override - public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedMap(validate(arg, configuration)); } @Override - public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -602,7 +601,7 @@ public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -677,7 +676,7 @@ public static IfAndElseWithoutThen1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -689,7 +688,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -701,7 +700,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -712,24 +711,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -761,7 +760,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -788,7 +787,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -796,7 +795,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -806,7 +805,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -818,7 +817,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -833,10 +832,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -851,34 +850,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IfAndElseWithoutThen1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndElseWithoutThen1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndElseWithoutThen1BoxedVoid(validate(arg, configuration)); } @Override - public IfAndElseWithoutThen1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndElseWithoutThen1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndElseWithoutThen1BoxedBoolean(validate(arg, configuration)); } @Override - public IfAndElseWithoutThen1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndElseWithoutThen1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndElseWithoutThen1BoxedNumber(validate(arg, configuration)); } @Override - public IfAndElseWithoutThen1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndElseWithoutThen1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndElseWithoutThen1BoxedString(validate(arg, configuration)); } @Override - public IfAndElseWithoutThen1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndElseWithoutThen1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndElseWithoutThen1BoxedList(validate(arg, configuration)); } @Override - public IfAndElseWithoutThen1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndElseWithoutThen1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndElseWithoutThen1BoxedMap(validate(arg, configuration)); } @Override - public IfAndElseWithoutThen1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndElseWithoutThen1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -894,7 +893,7 @@ public IfAndElseWithoutThen1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.java index c46a8099bd1..a443ce4cd58 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -99,7 +98,7 @@ public static IfSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -111,7 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -134,24 +133,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -210,7 +209,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -255,10 +254,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,34 +272,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedVoid(validate(arg, configuration)); } @Override - public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedNumber(validate(arg, configuration)); } @Override - public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedString(validate(arg, configuration)); } @Override - public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedList(validate(arg, configuration)); } @Override - public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedMap(validate(arg, configuration)); } @Override - public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -316,7 +315,7 @@ public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -384,7 +383,7 @@ public static Then getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -396,7 +395,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -408,7 +407,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,24 +418,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -468,7 +467,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -495,7 +494,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +502,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -513,7 +512,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -540,10 +539,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,34 +557,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ThenBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedVoid(validate(arg, configuration)); } @Override - public ThenBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedBoolean(validate(arg, configuration)); } @Override - public ThenBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedNumber(validate(arg, configuration)); } @Override - public ThenBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedString(validate(arg, configuration)); } @Override - public ThenBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedList(validate(arg, configuration)); } @Override - public ThenBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedMap(validate(arg, configuration)); } @Override - public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -601,7 +600,7 @@ public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -676,7 +675,7 @@ public static IfAndThenWithoutElse1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -688,7 +687,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -700,7 +699,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -711,24 +710,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -760,7 +759,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -787,7 +786,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -795,7 +794,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -805,7 +804,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -817,7 +816,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -832,10 +831,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -850,34 +849,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IfAndThenWithoutElse1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndThenWithoutElse1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndThenWithoutElse1BoxedVoid(validate(arg, configuration)); } @Override - public IfAndThenWithoutElse1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndThenWithoutElse1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndThenWithoutElse1BoxedBoolean(validate(arg, configuration)); } @Override - public IfAndThenWithoutElse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndThenWithoutElse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndThenWithoutElse1BoxedNumber(validate(arg, configuration)); } @Override - public IfAndThenWithoutElse1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndThenWithoutElse1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndThenWithoutElse1BoxedString(validate(arg, configuration)); } @Override - public IfAndThenWithoutElse1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndThenWithoutElse1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndThenWithoutElse1BoxedList(validate(arg, configuration)); } @Override - public IfAndThenWithoutElse1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndThenWithoutElse1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IfAndThenWithoutElse1BoxedMap(validate(arg, configuration)); } @Override - public IfAndThenWithoutElse1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAndThenWithoutElse1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -893,7 +892,7 @@ public IfAndThenWithoutElse1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.java index 301de72323d..6da815fd975 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -113,7 +112,7 @@ public static ElseSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ElseSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedVoid(validate(arg, configuration)); } @Override - public ElseSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public ElseSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedNumber(validate(arg, configuration)); } @Override - public ElseSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedString(validate(arg, configuration)); } @Override - public ElseSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedList(validate(arg, configuration)); } @Override - public ElseSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedMap(validate(arg, configuration)); } @Override - public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -398,7 +397,7 @@ public static IfSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -410,7 +409,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -422,7 +421,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -433,24 +432,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -482,7 +481,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -509,7 +508,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -517,7 +516,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -527,7 +526,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -539,7 +538,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -554,10 +553,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -572,34 +571,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedVoid(validate(arg, configuration)); } @Override - public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedNumber(validate(arg, configuration)); } @Override - public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedString(validate(arg, configuration)); } @Override - public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedList(validate(arg, configuration)); } @Override - public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedMap(validate(arg, configuration)); } @Override - public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -615,7 +614,7 @@ public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringThenConst implements StringValueMethod { @@ -695,7 +694,7 @@ public static Then getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -707,7 +706,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -719,7 +718,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -730,24 +729,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -779,7 +778,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -806,7 +805,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -814,7 +813,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -824,7 +823,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -836,7 +835,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -851,10 +850,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -869,34 +868,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ThenBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedVoid(validate(arg, configuration)); } @Override - public ThenBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedBoolean(validate(arg, configuration)); } @Override - public ThenBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedNumber(validate(arg, configuration)); } @Override - public ThenBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedString(validate(arg, configuration)); } @Override - public ThenBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedList(validate(arg, configuration)); } @Override - public ThenBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedMap(validate(arg, configuration)); } @Override - public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -912,7 +911,7 @@ public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -988,7 +987,7 @@ public static IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1 getInsta } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1000,7 +999,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1012,7 +1011,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1023,24 +1022,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1072,7 +1071,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1099,7 +1098,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1107,7 +1106,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1117,7 +1116,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1129,7 +1128,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1144,10 +1143,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1162,34 +1161,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid(validate(arg, configuration)); } @Override - public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean(validate(arg, configuration)); } @Override - public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber(validate(arg, configuration)); } @Override - public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString(validate(arg, configuration)); } @Override - public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList(validate(arg, configuration)); } @Override - public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap(validate(arg, configuration)); } @Override - public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1205,7 +1204,7 @@ public IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed validateAn } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.java index 0cbc81ef544..2223140a8bb 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -113,7 +112,7 @@ public static ElseSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ElseSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedVoid(validate(arg, configuration)); } @Override - public ElseSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public ElseSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedNumber(validate(arg, configuration)); } @Override - public ElseSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedString(validate(arg, configuration)); } @Override - public ElseSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedList(validate(arg, configuration)); } @Override - public ElseSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedMap(validate(arg, configuration)); } @Override - public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -404,7 +403,7 @@ public static IgnoreElseWithoutIf1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -416,7 +415,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -428,7 +427,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -439,24 +438,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -488,7 +487,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -515,7 +514,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -523,7 +522,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -533,7 +532,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -545,7 +544,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -560,10 +559,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -578,34 +577,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IgnoreElseWithoutIf1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreElseWithoutIf1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreElseWithoutIf1BoxedVoid(validate(arg, configuration)); } @Override - public IgnoreElseWithoutIf1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreElseWithoutIf1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreElseWithoutIf1BoxedBoolean(validate(arg, configuration)); } @Override - public IgnoreElseWithoutIf1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreElseWithoutIf1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreElseWithoutIf1BoxedNumber(validate(arg, configuration)); } @Override - public IgnoreElseWithoutIf1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreElseWithoutIf1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreElseWithoutIf1BoxedString(validate(arg, configuration)); } @Override - public IgnoreElseWithoutIf1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreElseWithoutIf1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreElseWithoutIf1BoxedList(validate(arg, configuration)); } @Override - public IgnoreElseWithoutIf1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreElseWithoutIf1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreElseWithoutIf1BoxedMap(validate(arg, configuration)); } @Override - public IgnoreElseWithoutIf1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreElseWithoutIf1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -621,7 +620,7 @@ public IgnoreElseWithoutIf1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.java index 6bbdcfddf62..a6935324925 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -113,7 +112,7 @@ public static IfSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedVoid(validate(arg, configuration)); } @Override - public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedNumber(validate(arg, configuration)); } @Override - public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedString(validate(arg, configuration)); } @Override - public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedList(validate(arg, configuration)); } @Override - public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedMap(validate(arg, configuration)); } @Override - public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -404,7 +403,7 @@ public static IgnoreIfWithoutThenOrElse1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -416,7 +415,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -428,7 +427,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -439,24 +438,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -488,7 +487,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -515,7 +514,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -523,7 +522,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -533,7 +532,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -545,7 +544,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -560,10 +559,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -578,34 +577,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IgnoreIfWithoutThenOrElse1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreIfWithoutThenOrElse1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreIfWithoutThenOrElse1BoxedVoid(validate(arg, configuration)); } @Override - public IgnoreIfWithoutThenOrElse1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreIfWithoutThenOrElse1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreIfWithoutThenOrElse1BoxedBoolean(validate(arg, configuration)); } @Override - public IgnoreIfWithoutThenOrElse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreIfWithoutThenOrElse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreIfWithoutThenOrElse1BoxedNumber(validate(arg, configuration)); } @Override - public IgnoreIfWithoutThenOrElse1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreIfWithoutThenOrElse1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreIfWithoutThenOrElse1BoxedString(validate(arg, configuration)); } @Override - public IgnoreIfWithoutThenOrElse1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreIfWithoutThenOrElse1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreIfWithoutThenOrElse1BoxedList(validate(arg, configuration)); } @Override - public IgnoreIfWithoutThenOrElse1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreIfWithoutThenOrElse1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreIfWithoutThenOrElse1BoxedMap(validate(arg, configuration)); } @Override - public IgnoreIfWithoutThenOrElse1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreIfWithoutThenOrElse1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -621,7 +620,7 @@ public IgnoreIfWithoutThenOrElse1Boxed validateAndBox(@Nullable Object arg, Sche } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.java index abcecbb52ff..873076a7d35 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -113,7 +112,7 @@ public static Then getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ThenBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedVoid(validate(arg, configuration)); } @Override - public ThenBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedBoolean(validate(arg, configuration)); } @Override - public ThenBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedNumber(validate(arg, configuration)); } @Override - public ThenBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedString(validate(arg, configuration)); } @Override - public ThenBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedList(validate(arg, configuration)); } @Override - public ThenBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedMap(validate(arg, configuration)); } @Override - public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -404,7 +403,7 @@ public static IgnoreThenWithoutIf1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -416,7 +415,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -428,7 +427,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -439,24 +438,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -488,7 +487,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -515,7 +514,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -523,7 +522,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -533,7 +532,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -545,7 +544,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -560,10 +559,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -578,34 +577,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IgnoreThenWithoutIf1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreThenWithoutIf1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreThenWithoutIf1BoxedVoid(validate(arg, configuration)); } @Override - public IgnoreThenWithoutIf1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreThenWithoutIf1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreThenWithoutIf1BoxedBoolean(validate(arg, configuration)); } @Override - public IgnoreThenWithoutIf1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreThenWithoutIf1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreThenWithoutIf1BoxedNumber(validate(arg, configuration)); } @Override - public IgnoreThenWithoutIf1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreThenWithoutIf1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreThenWithoutIf1BoxedString(validate(arg, configuration)); } @Override - public IgnoreThenWithoutIf1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreThenWithoutIf1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreThenWithoutIf1BoxedList(validate(arg, configuration)); } @Override - public IgnoreThenWithoutIf1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreThenWithoutIf1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IgnoreThenWithoutIf1BoxedMap(validate(arg, configuration)); } @Override - public IgnoreThenWithoutIf1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IgnoreThenWithoutIf1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -621,7 +620,7 @@ public IgnoreThenWithoutIf1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java index 9db27444b5d..23dac5af28c 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv4Format.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static Ipv4Format1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Ipv4Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedVoid(validate(arg, configuration)); } @Override - public Ipv4Format1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedBoolean(validate(arg, configuration)); } @Override - public Ipv4Format1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedNumber(validate(arg, configuration)); } @Override - public Ipv4Format1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedString(validate(arg, configuration)); } @Override - public Ipv4Format1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedList(validate(arg, configuration)); } @Override - public Ipv4Format1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv4Format1BoxedMap(validate(arg, configuration)); } @Override - public Ipv4Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv4Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public Ipv4Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java index f52011acf83..01da7d38593 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Ipv6Format.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static Ipv6Format1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Ipv6Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedVoid(validate(arg, configuration)); } @Override - public Ipv6Format1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedBoolean(validate(arg, configuration)); } @Override - public Ipv6Format1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedNumber(validate(arg, configuration)); } @Override - public Ipv6Format1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedString(validate(arg, configuration)); } @Override - public Ipv6Format1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedList(validate(arg, configuration)); } @Override - public Ipv6Format1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Ipv6Format1BoxedMap(validate(arg, configuration)); } @Override - public Ipv6Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Ipv6Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public Ipv6Format1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IriFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IriFormat.java index b1482c09cfd..013f2c9d75e 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IriFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IriFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static IriFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IriFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IriFormat1BoxedVoid(validate(arg, configuration)); } @Override - public IriFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IriFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public IriFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IriFormat1BoxedNumber(validate(arg, configuration)); } @Override - public IriFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IriFormat1BoxedString(validate(arg, configuration)); } @Override - public IriFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IriFormat1BoxedList(validate(arg, configuration)); } @Override - public IriFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IriFormat1BoxedMap(validate(arg, configuration)); } @Override - public IriFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public IriFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.java index 121084c5602..81429726542 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static IriReferenceFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IriReferenceFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriReferenceFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IriReferenceFormat1BoxedVoid(validate(arg, configuration)); } @Override - public IriReferenceFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriReferenceFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IriReferenceFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public IriReferenceFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriReferenceFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IriReferenceFormat1BoxedNumber(validate(arg, configuration)); } @Override - public IriReferenceFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriReferenceFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IriReferenceFormat1BoxedString(validate(arg, configuration)); } @Override - public IriReferenceFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriReferenceFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IriReferenceFormat1BoxedList(validate(arg, configuration)); } @Override - public IriReferenceFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriReferenceFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IriReferenceFormat1BoxedMap(validate(arg, configuration)); } @Override - public IriReferenceFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IriReferenceFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public IriReferenceFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsContains.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsContains.java index e385e5dd4c0..c2fd01f3e93 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsContains.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsContains.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -100,7 +99,7 @@ public static Contains getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -124,7 +123,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,24 +134,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -211,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -229,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +240,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -256,10 +255,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -274,34 +273,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ContainsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedVoid(validate(arg, configuration)); } @Override - public ContainsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedBoolean(validate(arg, configuration)); } @Override - public ContainsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedNumber(validate(arg, configuration)); } @Override - public ContainsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedString(validate(arg, configuration)); } @Override - public ContainsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedList(validate(arg, configuration)); } @Override - public ContainsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedMap(validate(arg, configuration)); } @Override - public ContainsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -317,7 +316,7 @@ public ContainsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -385,7 +384,7 @@ public static Items getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -397,7 +396,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -409,7 +408,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -420,24 +419,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -469,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -504,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -514,7 +513,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -526,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -541,10 +540,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -559,34 +558,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedVoid(validate(arg, configuration)); } @Override - public ItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedBoolean(validate(arg, configuration)); } @Override - public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedNumber(validate(arg, configuration)); } @Override - public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedString(validate(arg, configuration)); } @Override - public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedList(validate(arg, configuration)); } @Override - public ItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedMap(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -602,7 +601,7 @@ public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -724,7 +723,7 @@ public ItemsContainsList getNewInstance(List arg, List pathToItem, Pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -746,29 +745,29 @@ public ItemsContainsList validate(List arg, SchemaConfiguration configuration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsContains1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsContains1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsContains1BoxedList(validate(arg, configuration)); } @Override - public ItemsContains1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsContains1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.java index f5abd8a53f1..a073a0dfedf 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -99,7 +98,7 @@ public static Items getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -111,7 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -134,24 +133,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -210,7 +209,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -255,10 +254,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,34 +272,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedVoid(validate(arg, configuration)); } @Override - public ItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedBoolean(validate(arg, configuration)); } @Override - public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedNumber(validate(arg, configuration)); } @Override - public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedString(validate(arg, configuration)); } @Override - public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedList(validate(arg, configuration)); } @Override - public ItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedMap(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -316,7 +315,7 @@ public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -437,7 +436,7 @@ public ItemsDoesNotLookInApplicatorsValidCaseList getNewInstance(List arg, Li itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -459,29 +458,29 @@ public ItemsDoesNotLookInApplicatorsValidCaseList validate(List arg, SchemaCo } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsDoesNotLookInApplicatorsValidCase1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsDoesNotLookInApplicatorsValidCase1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsDoesNotLookInApplicatorsValidCase1BoxedList(validate(arg, configuration)); } @Override - public ItemsDoesNotLookInApplicatorsValidCase1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsDoesNotLookInApplicatorsValidCase1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.java index 7803e3e960a..5e4361be6fa 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -111,12 +110,12 @@ public ItemsWithNullInstanceElementsList getNewInstance(List arg, List, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance == null || itemInstance instanceof Void)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Void) itemInstance); i += 1; @@ -136,29 +135,29 @@ public ItemsWithNullInstanceElementsList validate(List arg, SchemaConfigurati } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsWithNullInstanceElements1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsWithNullInstanceElements1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsWithNullInstanceElements1BoxedList(validate(arg, configuration)); } @Override - public ItemsWithNullInstanceElements1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsWithNullInstanceElements1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java index fce4b261f1d..fa8749c26d6 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static JsonPointerFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JsonPointerFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedVoid(validate(arg, configuration)); } @Override - public JsonPointerFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public JsonPointerFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedNumber(validate(arg, configuration)); } @Override - public JsonPointerFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedString(validate(arg, configuration)); } @Override - public JsonPointerFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedList(validate(arg, configuration)); } @Override - public JsonPointerFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new JsonPointerFormat1BoxedMap(validate(arg, configuration)); } @Override - public JsonPointerFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JsonPointerFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public JsonPointerFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.java index a3da96fbffa..c2eabb90feb 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MaxcontainsWithoutContainsIsIgnored1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MaxcontainsWithoutContainsIsIgnored1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxcontainsWithoutContainsIsIgnored1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MaxcontainsWithoutContainsIsIgnored1BoxedVoid(validate(arg, configuration)); } @Override - public MaxcontainsWithoutContainsIsIgnored1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxcontainsWithoutContainsIsIgnored1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MaxcontainsWithoutContainsIsIgnored1BoxedBoolean(validate(arg, configuration)); } @Override - public MaxcontainsWithoutContainsIsIgnored1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxcontainsWithoutContainsIsIgnored1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MaxcontainsWithoutContainsIsIgnored1BoxedNumber(validate(arg, configuration)); } @Override - public MaxcontainsWithoutContainsIsIgnored1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxcontainsWithoutContainsIsIgnored1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MaxcontainsWithoutContainsIsIgnored1BoxedString(validate(arg, configuration)); } @Override - public MaxcontainsWithoutContainsIsIgnored1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxcontainsWithoutContainsIsIgnored1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MaxcontainsWithoutContainsIsIgnored1BoxedList(validate(arg, configuration)); } @Override - public MaxcontainsWithoutContainsIsIgnored1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxcontainsWithoutContainsIsIgnored1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MaxcontainsWithoutContainsIsIgnored1BoxedMap(validate(arg, configuration)); } @Override - public MaxcontainsWithoutContainsIsIgnored1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxcontainsWithoutContainsIsIgnored1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MaxcontainsWithoutContainsIsIgnored1Boxed validateAndBox(@Nullable Object } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java index ff2f9aec232..aa726fc1d7c 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MaximumValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MaximumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MaximumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MaximumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MaximumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedString(validate(arg, configuration)); } @Override - public MaximumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedList(validate(arg, configuration)); } @Override - public MaximumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidation1BoxedMap(validate(arg, configuration)); } @Override - public MaximumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MaximumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java index 9f2eefdd7cd..8b9f476e860 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MaximumValidationWithUnsignedInteger1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MaximumValidationWithUnsignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedVoid(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedBoolean(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedNumber(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedString(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedList(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MaximumValidationWithUnsignedInteger1BoxedMap(validate(arg, configuration)); } @Override - public MaximumValidationWithUnsignedInteger1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaximumValidationWithUnsignedInteger1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MaximumValidationWithUnsignedInteger1Boxed validateAndBox(@Nullable Objec } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java index dfbadbb5e68..4c4efef907a 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MaxitemsValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MaxitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MaxitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MaxitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MaxitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedString(validate(arg, configuration)); } @Override - public MaxitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedList(validate(arg, configuration)); } @Override - public MaxitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MaxitemsValidation1BoxedMap(validate(arg, configuration)); } @Override - public MaxitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MaxitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java index 02d41b936b7..c93a08ffe0b 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MaxlengthValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MaxlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MaxlengthValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MaxlengthValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MaxlengthValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedString(validate(arg, configuration)); } @Override - public MaxlengthValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedList(validate(arg, configuration)); } @Override - public MaxlengthValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MaxlengthValidation1BoxedMap(validate(arg, configuration)); } @Override - public MaxlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MaxlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java index c71474bd82f..ea6e8963c47 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static Maxproperties0MeansTheObjectIsEmpty1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedString(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedList(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Maxproperties0MeansTheObjectIsEmpty1BoxedMap(validate(arg, configuration)); } @Override - public Maxproperties0MeansTheObjectIsEmpty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Maxproperties0MeansTheObjectIsEmpty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public Maxproperties0MeansTheObjectIsEmpty1Boxed validateAndBox(@Nullable Object } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java index 5386164471a..468b9336092 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MaxpropertiesValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MaxpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedString(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedList(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MaxpropertiesValidation1BoxedMap(validate(arg, configuration)); } @Override - public MaxpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MaxpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MaxpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, Schema } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.java index a7fe9ba9db4..0fc53a0ee87 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MincontainsWithoutContainsIsIgnored1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MincontainsWithoutContainsIsIgnored1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MincontainsWithoutContainsIsIgnored1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MincontainsWithoutContainsIsIgnored1BoxedVoid(validate(arg, configuration)); } @Override - public MincontainsWithoutContainsIsIgnored1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MincontainsWithoutContainsIsIgnored1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MincontainsWithoutContainsIsIgnored1BoxedBoolean(validate(arg, configuration)); } @Override - public MincontainsWithoutContainsIsIgnored1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MincontainsWithoutContainsIsIgnored1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MincontainsWithoutContainsIsIgnored1BoxedNumber(validate(arg, configuration)); } @Override - public MincontainsWithoutContainsIsIgnored1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MincontainsWithoutContainsIsIgnored1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MincontainsWithoutContainsIsIgnored1BoxedString(validate(arg, configuration)); } @Override - public MincontainsWithoutContainsIsIgnored1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MincontainsWithoutContainsIsIgnored1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MincontainsWithoutContainsIsIgnored1BoxedList(validate(arg, configuration)); } @Override - public MincontainsWithoutContainsIsIgnored1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MincontainsWithoutContainsIsIgnored1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MincontainsWithoutContainsIsIgnored1BoxedMap(validate(arg, configuration)); } @Override - public MincontainsWithoutContainsIsIgnored1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MincontainsWithoutContainsIsIgnored1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MincontainsWithoutContainsIsIgnored1Boxed validateAndBox(@Nullable Object } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java index 29325be0f63..eefb6bdaa0b 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MinimumValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MinimumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MinimumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MinimumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MinimumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedString(validate(arg, configuration)); } @Override - public MinimumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedList(validate(arg, configuration)); } @Override - public MinimumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidation1BoxedMap(validate(arg, configuration)); } @Override - public MinimumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MinimumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java index 531298768ff..33543c9daf1 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MinimumValidationWithSignedInteger1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MinimumValidationWithSignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedVoid(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedBoolean(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedNumber(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedString(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedList(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MinimumValidationWithSignedInteger1BoxedMap(validate(arg, configuration)); } @Override - public MinimumValidationWithSignedInteger1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinimumValidationWithSignedInteger1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MinimumValidationWithSignedInteger1Boxed validateAndBox(@Nullable Object } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java index 13a669101d6..b933bb806b4 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinitemsValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MinitemsValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MinitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MinitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MinitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MinitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedString(validate(arg, configuration)); } @Override - public MinitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedList(validate(arg, configuration)); } @Override - public MinitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MinitemsValidation1BoxedMap(validate(arg, configuration)); } @Override - public MinitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MinitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java index 835bdc24f37..02e7fe8cac3 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinlengthValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MinlengthValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MinlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MinlengthValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MinlengthValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MinlengthValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedString(validate(arg, configuration)); } @Override - public MinlengthValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedList(validate(arg, configuration)); } @Override - public MinlengthValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MinlengthValidation1BoxedMap(validate(arg, configuration)); } @Override - public MinlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MinlengthValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java index 1802917d267..a04af48e3f5 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static MinpropertiesValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MinpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedVoid(validate(arg, configuration)); } @Override - public MinpropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public MinpropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedNumber(validate(arg, configuration)); } @Override - public MinpropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedString(validate(arg, configuration)); } @Override - public MinpropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedList(validate(arg, configuration)); } @Override - public MinpropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MinpropertiesValidation1BoxedMap(validate(arg, configuration)); } @Override - public MinpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MinpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public MinpropertiesValidation1Boxed validateAndBox(@Nullable Object arg, Schema } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.java index 8f0ecd29ca8..05561731433 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; @@ -116,7 +115,7 @@ public static MultipleDependentsRequired1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -128,7 +127,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,7 +139,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -151,24 +150,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -200,7 +199,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -227,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -235,7 +234,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -245,7 +244,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -257,7 +256,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -272,10 +271,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -290,34 +289,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipleDependentsRequired1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleDependentsRequired1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleDependentsRequired1BoxedVoid(validate(arg, configuration)); } @Override - public MultipleDependentsRequired1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleDependentsRequired1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleDependentsRequired1BoxedBoolean(validate(arg, configuration)); } @Override - public MultipleDependentsRequired1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleDependentsRequired1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleDependentsRequired1BoxedNumber(validate(arg, configuration)); } @Override - public MultipleDependentsRequired1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleDependentsRequired1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleDependentsRequired1BoxedString(validate(arg, configuration)); } @Override - public MultipleDependentsRequired1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleDependentsRequired1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleDependentsRequired1BoxedList(validate(arg, configuration)); } @Override - public MultipleDependentsRequired1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleDependentsRequired1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleDependentsRequired1BoxedMap(validate(arg, configuration)); } @Override - public MultipleDependentsRequired1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleDependentsRequired1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -333,7 +332,7 @@ public MultipleDependentsRequired1Boxed validateAndBox(@Nullable Object arg, Sch } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.java index 4214bb19e2d..60776eb34ea 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.java @@ -16,7 +16,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; @@ -113,7 +112,7 @@ public static Aaa getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AaaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AaaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AaaBoxedVoid(validate(arg, configuration)); } @Override - public AaaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AaaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AaaBoxedBoolean(validate(arg, configuration)); } @Override - public AaaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AaaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AaaBoxedNumber(validate(arg, configuration)); } @Override - public AaaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AaaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AaaBoxedString(validate(arg, configuration)); } @Override - public AaaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AaaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AaaBoxedList(validate(arg, configuration)); } @Override - public AaaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AaaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AaaBoxedMap(validate(arg, configuration)); } @Override - public AaaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AaaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public AaaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configu } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -407,7 +406,7 @@ public static MultipleSimultaneousPatternpropertiesAreValidated1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,7 +418,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -431,7 +430,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -442,24 +441,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -491,7 +490,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -518,7 +517,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -526,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -536,7 +535,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -548,7 +547,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -563,10 +562,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -581,34 +580,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid(validate(arg, configuration)); } @Override - public MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean(validate(arg, configuration)); } @Override - public MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber(validate(arg, configuration)); } @Override - public MultipleSimultaneousPatternpropertiesAreValidated1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleSimultaneousPatternpropertiesAreValidated1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleSimultaneousPatternpropertiesAreValidated1BoxedString(validate(arg, configuration)); } @Override - public MultipleSimultaneousPatternpropertiesAreValidated1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleSimultaneousPatternpropertiesAreValidated1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleSimultaneousPatternpropertiesAreValidated1BoxedList(validate(arg, configuration)); } @Override - public MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap(validate(arg, configuration)); } @Override - public MultipleSimultaneousPatternpropertiesAreValidated1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleSimultaneousPatternpropertiesAreValidated1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -624,7 +623,7 @@ public MultipleSimultaneousPatternpropertiesAreValidated1Boxed validateAndBox(@N } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.java index 9a4a8a513ee..4c6ef81ac46 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -109,39 +108,39 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber(validate(arg, configuration)); } @Override - public MultipleTypesCanBeSpecifiedInAnArray1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleTypesCanBeSpecifiedInAnArray1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MultipleTypesCanBeSpecifiedInAnArray1BoxedString(validate(arg, configuration)); } @Override - public MultipleTypesCanBeSpecifiedInAnArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipleTypesCanBeSpecifiedInAnArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java index b7648383ba2..be402dca36e 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -113,7 +112,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -406,7 +405,7 @@ public static NestedAllofToCheckValidationSemantics1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -418,7 +417,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,7 +429,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -441,24 +440,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -490,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -517,7 +516,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -535,7 +534,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -547,7 +546,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -562,10 +561,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,34 +579,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NestedAllofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedString(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedList(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAllofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)); } @Override - public NestedAllofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAllofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -623,7 +622,7 @@ public NestedAllofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Obje } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java index 7709bbbf75c..fdca504a464 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -113,7 +112,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -406,7 +405,7 @@ public static NestedAnyofToCheckValidationSemantics1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -418,7 +417,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,7 +429,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -441,24 +440,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -490,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -517,7 +516,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -535,7 +534,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -547,7 +546,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -562,10 +561,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,34 +579,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedString(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedList(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NestedAnyofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)); } @Override - public NestedAnyofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedAnyofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -623,7 +622,7 @@ public NestedAnyofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Obje } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java index 9e6928c1b4c..a85dac715e0 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedItems.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NumberJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -120,12 +119,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -145,29 +144,29 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Items2BoxedList(validate(arg, configuration)); } @Override - public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -242,12 +241,12 @@ public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList) itemInstance); i += 1; @@ -267,29 +266,29 @@ public ItemsList1 validate(List arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Items1BoxedList(validate(arg, configuration)); } @Override - public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -364,12 +363,12 @@ public ItemsList2 getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList1)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList1) itemInstance); i += 1; @@ -389,29 +388,29 @@ public ItemsList2 validate(List arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedList(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -492,12 +491,12 @@ public NestedItemsList getNewInstance(List arg, List pathToItem, Path itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList2)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList2) itemInstance); i += 1; @@ -517,29 +516,29 @@ public NestedItemsList validate(List arg, SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NestedItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NestedItems1BoxedList(validate(arg, configuration)); } @Override - public NestedItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java index e75084fe04d..489c92daf72 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -113,7 +112,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,7 +136,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -148,24 +147,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -254,7 +253,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -269,10 +268,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -287,34 +286,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -330,7 +329,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -406,7 +405,7 @@ public static NestedOneofToCheckValidationSemantics1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -418,7 +417,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -430,7 +429,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -441,24 +440,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -490,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -517,7 +516,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -535,7 +534,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -547,7 +546,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -562,10 +561,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -580,34 +579,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NestedOneofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedString(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedList(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NestedOneofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)); } @Override - public NestedOneofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NestedOneofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -623,7 +622,7 @@ public NestedOneofToCheckValidationSemantics1Boxed validateAndBox(@Nullable Obje } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } 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 0a3b69df087..156ad105802 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 @@ -12,7 +12,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -122,7 +121,7 @@ public NonAsciiPatternWithAdditionalpropertiesMap getNewInstance(Map arg, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -130,7 +129,7 @@ public NonAsciiPatternWithAdditionalpropertiesMap getNewInstance(Map arg, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -140,7 +139,7 @@ public NonAsciiPatternWithAdditionalpropertiesMap getNewInstance(Map arg, return new NonAsciiPatternWithAdditionalpropertiesMap(castProperties); } - public NonAsciiPatternWithAdditionalpropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NonAsciiPatternWithAdditionalpropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,29 +151,29 @@ public NonAsciiPatternWithAdditionalpropertiesMap validate(Map arg, Schema @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NonAsciiPatternWithAdditionalproperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NonAsciiPatternWithAdditionalproperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NonAsciiPatternWithAdditionalproperties1BoxedMap(validate(arg, configuration)); } @Override - public NonAsciiPatternWithAdditionalproperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NonAsciiPatternWithAdditionalproperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.java index d106e1a35cc..bf5d6ee54b1 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -100,7 +99,7 @@ public static IfSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -124,7 +123,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,24 +134,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -211,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -229,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +240,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -256,10 +255,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -274,34 +273,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedVoid(validate(arg, configuration)); } @Override - public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedNumber(validate(arg, configuration)); } @Override - public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedString(validate(arg, configuration)); } @Override - public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedList(validate(arg, configuration)); } @Override - public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedMap(validate(arg, configuration)); } @Override - public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -317,7 +316,7 @@ public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -385,7 +384,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -397,7 +396,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -409,7 +408,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -420,24 +419,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -469,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -504,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -514,7 +513,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -526,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -541,10 +540,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -559,34 +558,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -602,7 +601,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -670,7 +669,7 @@ public static Then getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -682,7 +681,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -694,7 +693,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -705,24 +704,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -754,7 +753,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -781,7 +780,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -789,7 +788,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -799,7 +798,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -811,7 +810,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -826,10 +825,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -844,34 +843,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ThenBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedVoid(validate(arg, configuration)); } @Override - public ThenBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedBoolean(validate(arg, configuration)); } @Override - public ThenBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedNumber(validate(arg, configuration)); } @Override - public ThenBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedString(validate(arg, configuration)); } @Override - public ThenBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedList(validate(arg, configuration)); } @Override - public ThenBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedMap(validate(arg, configuration)); } @Override - public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -887,7 +886,7 @@ public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -955,7 +954,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -967,7 +966,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -979,7 +978,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -990,24 +989,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1039,7 +1038,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1066,7 +1065,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1074,7 +1073,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1084,7 +1083,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1096,7 +1095,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1111,10 +1110,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1129,34 +1128,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1172,7 +1171,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1240,7 +1239,7 @@ public static ElseSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1252,7 +1251,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1264,7 +1263,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1275,24 +1274,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1324,7 +1323,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1351,7 +1350,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1359,7 +1358,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1369,7 +1368,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1381,7 +1380,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1396,10 +1395,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1414,34 +1413,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ElseSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedVoid(validate(arg, configuration)); } @Override - public ElseSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public ElseSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedNumber(validate(arg, configuration)); } @Override - public ElseSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedString(validate(arg, configuration)); } @Override - public ElseSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedList(validate(arg, configuration)); } @Override - public ElseSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedMap(validate(arg, configuration)); } @Override - public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1457,7 +1456,7 @@ public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1525,7 +1524,7 @@ public static Schema2 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1537,7 +1536,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1549,7 +1548,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1560,24 +1559,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1609,7 +1608,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1636,7 +1635,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1644,7 +1643,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1654,7 +1653,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1666,7 +1665,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1681,10 +1680,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1699,34 +1698,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema2BoxedVoid(validate(arg, configuration)); } @Override - public Schema2BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema2BoxedBoolean(validate(arg, configuration)); } @Override - public Schema2BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema2BoxedNumber(validate(arg, configuration)); } @Override - public Schema2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema2BoxedString(validate(arg, configuration)); } @Override - public Schema2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema2BoxedList(validate(arg, configuration)); } @Override - public Schema2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema2BoxedMap(validate(arg, configuration)); } @Override - public Schema2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1742,7 +1741,7 @@ public Schema2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1820,7 +1819,7 @@ public static NonInterferenceAcrossCombinedSchemas1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1832,7 +1831,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1844,7 +1843,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1855,24 +1854,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1904,7 +1903,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1931,7 +1930,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1939,7 +1938,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1949,7 +1948,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1961,7 +1960,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1976,10 +1975,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1994,34 +1993,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NonInterferenceAcrossCombinedSchemas1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NonInterferenceAcrossCombinedSchemas1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NonInterferenceAcrossCombinedSchemas1BoxedVoid(validate(arg, configuration)); } @Override - public NonInterferenceAcrossCombinedSchemas1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NonInterferenceAcrossCombinedSchemas1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NonInterferenceAcrossCombinedSchemas1BoxedBoolean(validate(arg, configuration)); } @Override - public NonInterferenceAcrossCombinedSchemas1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NonInterferenceAcrossCombinedSchemas1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NonInterferenceAcrossCombinedSchemas1BoxedNumber(validate(arg, configuration)); } @Override - public NonInterferenceAcrossCombinedSchemas1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NonInterferenceAcrossCombinedSchemas1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NonInterferenceAcrossCombinedSchemas1BoxedString(validate(arg, configuration)); } @Override - public NonInterferenceAcrossCombinedSchemas1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NonInterferenceAcrossCombinedSchemas1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NonInterferenceAcrossCombinedSchemas1BoxedList(validate(arg, configuration)); } @Override - public NonInterferenceAcrossCombinedSchemas1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NonInterferenceAcrossCombinedSchemas1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NonInterferenceAcrossCombinedSchemas1BoxedMap(validate(arg, configuration)); } @Override - public NonInterferenceAcrossCombinedSchemas1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NonInterferenceAcrossCombinedSchemas1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -2037,7 +2036,7 @@ public NonInterferenceAcrossCombinedSchemas1Boxed validateAndBox(@Nullable Objec } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java index 98514e1cbff..15045fcbc96 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Not.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; @@ -117,7 +116,7 @@ public static Not1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,7 +140,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,24 +151,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -273,10 +272,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -291,34 +290,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Not1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedVoid(validate(arg, configuration)); } @Override - public Not1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedBoolean(validate(arg, configuration)); } @Override - public Not1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedNumber(validate(arg, configuration)); } @Override - public Not1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedString(validate(arg, configuration)); } @Override - public Not1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedList(validate(arg, configuration)); } @Override - public Not1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Not1BoxedMap(validate(arg, configuration)); } @Override - public Not1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Not1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -334,7 +333,7 @@ public Not1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java index 0e92dc9eac8..6947755b346 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +65,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -151,7 +150,7 @@ public NotMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -159,7 +158,7 @@ public NotMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -169,7 +168,7 @@ public NotMap getNewInstance(Map arg, List pathToItem, PathToSchem return new NotMap(castProperties); } - public NotMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -181,29 +180,29 @@ public NotMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NotBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NotBoxedMap(validate(arg, configuration)); } @Override - public NotBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -278,7 +277,7 @@ public static NotMoreComplexSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -290,7 +289,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -302,7 +301,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,24 +312,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -362,7 +361,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -389,7 +388,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -397,7 +396,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -407,7 +406,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,7 +418,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -434,10 +433,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -452,34 +451,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NotMoreComplexSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedString(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedList(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NotMoreComplexSchema1BoxedMap(validate(arg, configuration)); } @Override - public NotMoreComplexSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMoreComplexSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -495,7 +494,7 @@ public NotMoreComplexSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.java index 04424f0d255..4dd805fff73 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -117,42 +116,42 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } else if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NotBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NotBoxedNumber(validate(arg, configuration)); } @Override - public NotBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NotBoxedBoolean(validate(arg, configuration)); } @Override - public NotBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } else if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -226,7 +225,7 @@ public static NotMultipleTypes1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -238,7 +237,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -250,7 +249,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -261,24 +260,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -310,7 +309,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -337,7 +336,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -345,7 +344,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -355,7 +354,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -367,7 +366,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -382,10 +381,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -400,34 +399,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NotMultipleTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMultipleTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NotMultipleTypes1BoxedVoid(validate(arg, configuration)); } @Override - public NotMultipleTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMultipleTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NotMultipleTypes1BoxedBoolean(validate(arg, configuration)); } @Override - public NotMultipleTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMultipleTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NotMultipleTypes1BoxedNumber(validate(arg, configuration)); } @Override - public NotMultipleTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMultipleTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NotMultipleTypes1BoxedString(validate(arg, configuration)); } @Override - public NotMultipleTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMultipleTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NotMultipleTypes1BoxedList(validate(arg, configuration)); } @Override - public NotMultipleTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMultipleTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NotMultipleTypes1BoxedMap(validate(arg, configuration)); } @Override - public NotMultipleTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotMultipleTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -443,7 +442,7 @@ public NotMultipleTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfigu } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java index cccbac4a8ff..89f32a64c25 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -91,29 +90,29 @@ public String validate(StringNulCharactersInStringsEnums arg,SchemaConfiguration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NulCharactersInStrings1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NulCharactersInStrings1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NulCharactersInStrings1BoxedString(validate(arg, configuration)); } @Override - public NulCharactersInStrings1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NulCharactersInStrings1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java index 01f7f868c52..6eda0789786 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -79,7 +78,7 @@ public Number foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (Number) value; } @@ -89,7 +88,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -244,7 +243,7 @@ public static ObjectPropertiesValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -256,7 +255,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -268,7 +267,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -279,24 +278,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -328,7 +327,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -355,7 +354,7 @@ public ObjectPropertiesValidationMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -363,7 +362,7 @@ public ObjectPropertiesValidationMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -373,7 +372,7 @@ public ObjectPropertiesValidationMap getNewInstance(Map arg, List return new ObjectPropertiesValidationMap(castProperties); } - public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -385,7 +384,7 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -400,10 +399,10 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -418,34 +417,34 @@ public ObjectPropertiesValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectPropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedVoid(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedNumber(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedString(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedList(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectPropertiesValidation1BoxedMap(validate(arg, configuration)); } @Override - public ObjectPropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectPropertiesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -461,7 +460,7 @@ public ObjectPropertiesValidation1Boxed validateAndBox(@Nullable Object arg, Sch } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java index 86951cf5e63..d649859a696 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Oneof.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; @@ -111,7 +110,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,7 +134,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -146,24 +145,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,7 +194,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -222,7 +221,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -252,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -267,10 +266,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -285,34 +284,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -328,7 +327,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -405,7 +404,7 @@ public static Oneof1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -417,7 +416,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -429,7 +428,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -440,24 +439,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -489,7 +488,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -516,7 +515,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -524,7 +523,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -534,7 +533,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -546,7 +545,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -561,10 +560,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -579,34 +578,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Oneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedVoid(validate(arg, configuration)); } @Override - public Oneof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedBoolean(validate(arg, configuration)); } @Override - public Oneof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedNumber(validate(arg, configuration)); } @Override - public Oneof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedString(validate(arg, configuration)); } @Override - public Oneof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedList(validate(arg, configuration)); } @Override - public Oneof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Oneof1BoxedMap(validate(arg, configuration)); } @Override - public Oneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Oneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -622,7 +621,7 @@ public Oneof1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java index ee1966faee0..c6eab7c1eef 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -65,7 +64,7 @@ public static Schema0Map of(Map arg, SchemaC public Number bar() { @Nullable Object value = get("bar"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (Number) value; } @@ -211,7 +210,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,7 +222,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,7 +234,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,24 +245,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -295,7 +294,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -322,7 +321,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -330,7 +329,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -340,7 +339,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -352,7 +351,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -367,10 +366,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -385,34 +384,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -428,7 +427,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -458,7 +457,7 @@ public static Schema1Map of(Map arg, SchemaC public String foo() { @Nullable Object value = get("foo"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -586,7 +585,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -598,7 +597,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -610,7 +609,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -621,24 +620,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -670,7 +669,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -697,7 +696,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -705,7 +704,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -715,7 +714,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -727,7 +726,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -742,10 +741,10 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -760,34 +759,34 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -803,7 +802,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -880,7 +879,7 @@ public static OneofComplexTypes1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -892,7 +891,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -904,7 +903,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -915,24 +914,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -964,7 +963,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -991,7 +990,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -999,7 +998,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1009,7 +1008,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1021,7 +1020,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1036,10 +1035,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1054,34 +1053,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OneofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedVoid(validate(arg, configuration)); } @Override - public OneofComplexTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedBoolean(validate(arg, configuration)); } @Override - public OneofComplexTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedNumber(validate(arg, configuration)); } @Override - public OneofComplexTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedString(validate(arg, configuration)); } @Override - public OneofComplexTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedList(validate(arg, configuration)); } @Override - public OneofComplexTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new OneofComplexTypes1BoxedMap(validate(arg, configuration)); } @Override - public OneofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1097,7 +1096,7 @@ public OneofComplexTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java index e9d3f27028e..e5fa1ac5522 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -99,7 +98,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -111,7 +110,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,7 +122,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -134,24 +133,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -210,7 +209,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -255,10 +254,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -273,34 +272,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -316,7 +315,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -384,7 +383,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -396,7 +395,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -408,7 +407,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,24 +418,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -468,7 +467,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -495,7 +494,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +502,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -513,7 +512,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -525,7 +524,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -540,10 +539,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -558,34 +557,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -601,7 +600,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -658,29 +657,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OneofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithBaseSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithBaseSchema1BoxedString(validate(arg, configuration)); } @Override - public OneofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithBaseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java index 96c4c68034b..4c9debae918 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -132,7 +131,7 @@ public static OneofWithEmptySchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,7 +143,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,7 +155,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -167,24 +166,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -243,7 +242,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +250,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -261,7 +260,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -273,7 +272,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -288,10 +287,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -306,34 +305,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OneofWithEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedVoid(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedBoolean(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedNumber(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedString(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedList(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithEmptySchema1BoxedMap(validate(arg, configuration)); } @Override - public OneofWithEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -349,7 +348,7 @@ public OneofWithEmptySchema1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java index b62dc7bf97e..b1a56e9ea64 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/OneofWithRequired.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -50,11 +49,19 @@ public static Schema0Map of(Map arg, SchemaC } public @Nullable Object bar() { - return getOrThrow("bar"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object foo() { - return getOrThrow("foo"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -315,7 +322,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -327,7 +334,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -339,7 +346,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -350,24 +357,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -399,7 +406,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -426,7 +433,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -434,7 +441,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -444,7 +451,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -456,7 +463,7 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -471,10 +478,10 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -489,34 +496,34 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -532,7 +539,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -550,11 +557,19 @@ public static Schema1Map of(Map arg, SchemaC } public @Nullable Object baz() { - return getOrThrow("baz"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object foo() { - return getOrThrow("foo"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -815,7 +830,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -827,7 +842,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -839,7 +854,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -850,24 +865,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -899,7 +914,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -926,7 +941,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -934,7 +949,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -944,7 +959,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -956,7 +971,7 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -971,10 +986,10 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -989,34 +1004,34 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1032,7 +1047,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1079,7 +1094,7 @@ public static OneofWithRequired1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1087,7 +1102,7 @@ public static OneofWithRequired1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1097,7 +1112,7 @@ public static OneofWithRequired1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1109,29 +1124,29 @@ public static OneofWithRequired1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OneofWithRequired1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithRequired1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new OneofWithRequired1BoxedMap(validate(arg, configuration)); } @Override - public OneofWithRequired1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OneofWithRequired1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java index 49d4017ae06..e0493ed1d41 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +107,7 @@ public static PatternIsNotAnchored1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +119,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +142,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -192,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -237,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +248,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,10 +263,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,34 +281,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternIsNotAnchored1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedVoid(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedBoolean(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedNumber(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedString(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedList(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PatternIsNotAnchored1BoxedMap(validate(arg, configuration)); } @Override - public PatternIsNotAnchored1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternIsNotAnchored1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +324,7 @@ public PatternIsNotAnchored1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java index 7e0ffabd596..9027293703c 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternValidation.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +107,7 @@ public static PatternValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +119,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +142,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -192,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -237,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +248,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,10 +263,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,34 +281,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedVoid(validate(arg, configuration)); } @Override - public PatternValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public PatternValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedNumber(validate(arg, configuration)); } @Override - public PatternValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedString(validate(arg, configuration)); } @Override - public PatternValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedList(validate(arg, configuration)); } @Override - public PatternValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PatternValidation1BoxedMap(validate(arg, configuration)); } @Override - public PatternValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +324,7 @@ public PatternValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.java index 50e1a0e927b..070e2d2a816 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.java @@ -16,7 +16,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; @@ -121,7 +120,7 @@ public static PatternpropertiesValidatesPropertiesMatchingARegex1 getInstance() } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -133,7 +132,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -145,7 +144,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,24 +155,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -205,7 +204,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -250,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -262,7 +261,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -277,10 +276,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -295,34 +294,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid(validate(arg, configuration)); } @Override - public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean(validate(arg, configuration)); } @Override - public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber(validate(arg, configuration)); } @Override - public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString(validate(arg, configuration)); } @Override - public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList(validate(arg, configuration)); } @Override - public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap(validate(arg, configuration)); } @Override - public PatternpropertiesValidatesPropertiesMatchingARegex1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesValidatesPropertiesMatchingARegex1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -338,7 +337,7 @@ public PatternpropertiesValidatesPropertiesMatchingARegex1Boxed validateAndBox(@ } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.java index 03c1bff09ce..b068c18a706 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.java @@ -16,7 +16,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -121,7 +120,7 @@ public static PatternpropertiesWithNullValuedInstanceProperties1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -133,7 +132,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -145,7 +144,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,24 +155,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -205,7 +204,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -250,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -262,7 +261,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -277,10 +276,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -295,34 +294,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid(validate(arg, configuration)); } @Override - public PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean(validate(arg, configuration)); } @Override - public PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber(validate(arg, configuration)); } @Override - public PatternpropertiesWithNullValuedInstanceProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesWithNullValuedInstanceProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesWithNullValuedInstanceProperties1BoxedString(validate(arg, configuration)); } @Override - public PatternpropertiesWithNullValuedInstanceProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesWithNullValuedInstanceProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesWithNullValuedInstanceProperties1BoxedList(validate(arg, configuration)); } @Override - public PatternpropertiesWithNullValuedInstanceProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesWithNullValuedInstanceProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PatternpropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)); } @Override - public PatternpropertiesWithNullValuedInstanceProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternpropertiesWithNullValuedInstanceProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -338,7 +337,7 @@ public PatternpropertiesWithNullValuedInstanceProperties1Boxed validateAndBox(@N } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.java index c7574319af8..125a47da8d4 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.IntJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -146,12 +145,12 @@ public PrefixitemsValidationAdjustsTheStartingIndexForItemsList getNewInstance(L itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Object) itemInstance); i += 1; @@ -171,29 +170,29 @@ public PrefixitemsValidationAdjustsTheStartingIndexForItemsList validate(List } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList(validate(arg, configuration)); } @Override - public PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.java index 07000cebd05..0947f2b33f3 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -191,7 +190,7 @@ public static PrefixitemsWithNullInstanceElements1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +202,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,7 +214,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -226,24 +225,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -275,7 +274,7 @@ public PrefixitemsWithNullInstanceElementsList getNewInstance(List arg, List< itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -302,7 +301,7 @@ public PrefixitemsWithNullInstanceElementsList validate(List arg, SchemaConfi for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -310,7 +309,7 @@ public PrefixitemsWithNullInstanceElementsList validate(List arg, SchemaConfi Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -320,7 +319,7 @@ public PrefixitemsWithNullInstanceElementsList validate(List arg, SchemaConfi return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -332,7 +331,7 @@ public PrefixitemsWithNullInstanceElementsList validate(List arg, SchemaConfi } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -347,10 +346,10 @@ public PrefixitemsWithNullInstanceElementsList validate(List arg, SchemaConfi } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -365,34 +364,34 @@ public PrefixitemsWithNullInstanceElementsList validate(List arg, SchemaConfi } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PrefixitemsWithNullInstanceElements1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PrefixitemsWithNullInstanceElements1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PrefixitemsWithNullInstanceElements1BoxedVoid(validate(arg, configuration)); } @Override - public PrefixitemsWithNullInstanceElements1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PrefixitemsWithNullInstanceElements1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PrefixitemsWithNullInstanceElements1BoxedBoolean(validate(arg, configuration)); } @Override - public PrefixitemsWithNullInstanceElements1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PrefixitemsWithNullInstanceElements1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PrefixitemsWithNullInstanceElements1BoxedNumber(validate(arg, configuration)); } @Override - public PrefixitemsWithNullInstanceElements1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PrefixitemsWithNullInstanceElements1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PrefixitemsWithNullInstanceElements1BoxedString(validate(arg, configuration)); } @Override - public PrefixitemsWithNullInstanceElements1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PrefixitemsWithNullInstanceElements1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PrefixitemsWithNullInstanceElements1BoxedList(validate(arg, configuration)); } @Override - public PrefixitemsWithNullInstanceElements1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PrefixitemsWithNullInstanceElements1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PrefixitemsWithNullInstanceElements1BoxedMap(validate(arg, configuration)); } @Override - public PrefixitemsWithNullInstanceElements1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PrefixitemsWithNullInstanceElements1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -408,7 +407,7 @@ public PrefixitemsWithNullInstanceElements1Boxed validateAndBox(@Nullable Object } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } 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 503c22b688e..4e574420c49 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 @@ -16,7 +16,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -117,7 +116,7 @@ public static Fo getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,7 +140,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,24 +151,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -273,10 +272,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -291,34 +290,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FoBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new FoBoxedVoid(validate(arg, configuration)); } @Override - public FoBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new FoBoxedBoolean(validate(arg, configuration)); } @Override - public FoBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FoBoxedNumber(validate(arg, configuration)); } @Override - public FoBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new FoBoxedString(validate(arg, configuration)); } @Override - public FoBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new FoBoxedList(validate(arg, configuration)); } @Override - public FoBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FoBoxedMap(validate(arg, configuration)); } @Override - public FoBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FoBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -334,7 +333,7 @@ public FoBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configur } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -377,7 +376,7 @@ public static Foo getInstance() { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -399,29 +398,29 @@ public static Foo getInstance() { } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FooBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new FooBoxedList(validate(arg, configuration)); } @Override - public FooBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -454,7 +453,7 @@ public FrozenList foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof FrozenList)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (FrozenList) value; } @@ -464,7 +463,7 @@ public FrozenList bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof FrozenList)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (FrozenList) value; } @@ -473,7 +472,7 @@ public Number getAdditionalProperty(String name) throws UnsetPropertyException, throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (Number) value; } @@ -612,7 +611,7 @@ public PropertiesPatternpropertiesAdditionalpropertiesInteractionMap getNewInsta for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -620,12 +619,12 @@ public PropertiesPatternpropertiesAdditionalpropertiesInteractionMap getNewInsta Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } @@ -633,7 +632,7 @@ public PropertiesPatternpropertiesAdditionalpropertiesInteractionMap getNewInsta return new PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(castProperties); } - public PropertiesPatternpropertiesAdditionalpropertiesInteractionMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesPatternpropertiesAdditionalpropertiesInteractionMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -645,29 +644,29 @@ public PropertiesPatternpropertiesAdditionalpropertiesInteractionMap validate(Ma @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap(validate(arg, configuration)); } @Override - public PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.java index 685264451d4..dc5ccc4df36 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -78,7 +77,7 @@ public String length() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for length"); + throw new RuntimeException("Invalid value stored for length"); } return (String) value; } @@ -193,7 +192,7 @@ public static ToStringSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -205,7 +204,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -217,7 +216,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,24 +227,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -277,7 +276,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -304,7 +303,7 @@ public ToStringMap getNewInstance(Map arg, List pathToItem, PathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -312,7 +311,7 @@ public ToStringMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -322,7 +321,7 @@ public ToStringMap getNewInstance(Map arg, List pathToItem, PathTo return new ToStringMap(castProperties); } - public ToStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ToStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -334,7 +333,7 @@ public ToStringMap validate(Map arg, SchemaConfiguration configuration) th } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -349,10 +348,10 @@ public ToStringMap validate(Map arg, SchemaConfiguration configuration) th } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -367,34 +366,34 @@ public ToStringMap validate(Map arg, SchemaConfiguration configuration) th } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ToStringSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ToStringSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ToStringSchemaBoxedVoid(validate(arg, configuration)); } @Override - public ToStringSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ToStringSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ToStringSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public ToStringSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ToStringSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ToStringSchemaBoxedNumber(validate(arg, configuration)); } @Override - public ToStringSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ToStringSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ToStringSchemaBoxedString(validate(arg, configuration)); } @Override - public ToStringSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ToStringSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ToStringSchemaBoxedList(validate(arg, configuration)); } @Override - public ToStringSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ToStringSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ToStringSchemaBoxedMap(validate(arg, configuration)); } @Override - public ToStringSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ToStringSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -410,7 +409,7 @@ public ToStringSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfigurat } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -444,7 +443,7 @@ public Number constructor() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for constructor"); + throw new RuntimeException("Invalid value stored for constructor"); } return (Number) value; } @@ -681,7 +680,7 @@ public static PropertiesWhoseNamesAreJavascriptObjectPropertyNames1 getInstance( } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -693,7 +692,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -705,7 +704,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -716,24 +715,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -765,7 +764,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -792,7 +791,7 @@ public PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap getNewInstance(Ma for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -800,7 +799,7 @@ public PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap getNewInstance(Ma Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -810,7 +809,7 @@ public PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap getNewInstance(Ma return new PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap(castProperties); } - public PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -822,7 +821,7 @@ public PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap validate(Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -855,34 +854,34 @@ public PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap validate(Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(validate(arg, configuration)); } @Override - public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(validate(arg, configuration)); } @Override - public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(validate(arg, configuration)); } @Override - public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(validate(arg, configuration)); } @Override - public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(validate(arg, configuration)); } @Override - public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap(validate(arg, configuration)); } @Override - public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -898,7 +897,7 @@ public PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed validateAndBox } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java index 6e99b7bfe97..78e2eecd84c 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -425,7 +424,7 @@ public static PropertiesWithEscapedCharacters1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -437,7 +436,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -449,7 +448,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -460,24 +459,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -509,7 +508,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -536,7 +535,7 @@ public PropertiesWithEscapedCharactersMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -544,7 +543,7 @@ public PropertiesWithEscapedCharactersMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -554,7 +553,7 @@ public PropertiesWithEscapedCharactersMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -566,7 +565,7 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfigur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -581,10 +580,10 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfigur } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -599,34 +598,34 @@ public PropertiesWithEscapedCharactersMap validate(Map arg, SchemaConfigur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PropertiesWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedVoid(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedNumber(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedString(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedList(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithEscapedCharacters1BoxedMap(validate(arg, configuration)); } @Override - public PropertiesWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -642,7 +641,7 @@ public PropertiesWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.java index 4ebca7f490d..4121898f8f2 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +65,7 @@ public Void foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Void)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (Void) value; } @@ -187,7 +186,7 @@ public static PropertiesWithNullValuedInstanceProperties1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -199,7 +198,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -211,7 +210,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -222,24 +221,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -271,7 +270,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -298,7 +297,7 @@ public PropertiesWithNullValuedInstancePropertiesMap getNewInstance(Map ar for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -306,7 +305,7 @@ public PropertiesWithNullValuedInstancePropertiesMap getNewInstance(Map ar Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -316,7 +315,7 @@ public PropertiesWithNullValuedInstancePropertiesMap getNewInstance(Map ar return new PropertiesWithNullValuedInstancePropertiesMap(castProperties); } - public PropertiesWithNullValuedInstancePropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithNullValuedInstancePropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -328,7 +327,7 @@ public PropertiesWithNullValuedInstancePropertiesMap validate(Map arg, Sch } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -343,10 +342,10 @@ public PropertiesWithNullValuedInstancePropertiesMap validate(Map arg, Sch } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -361,34 +360,34 @@ public PropertiesWithNullValuedInstancePropertiesMap validate(Map arg, Sch } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PropertiesWithNullValuedInstanceProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithNullValuedInstanceProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithNullValuedInstanceProperties1BoxedVoid(validate(arg, configuration)); } @Override - public PropertiesWithNullValuedInstanceProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithNullValuedInstanceProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithNullValuedInstanceProperties1BoxedBoolean(validate(arg, configuration)); } @Override - public PropertiesWithNullValuedInstanceProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithNullValuedInstanceProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithNullValuedInstanceProperties1BoxedNumber(validate(arg, configuration)); } @Override - public PropertiesWithNullValuedInstanceProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithNullValuedInstanceProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithNullValuedInstanceProperties1BoxedString(validate(arg, configuration)); } @Override - public PropertiesWithNullValuedInstanceProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithNullValuedInstanceProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithNullValuedInstanceProperties1BoxedList(validate(arg, configuration)); } @Override - public PropertiesWithNullValuedInstanceProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithNullValuedInstanceProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)); } @Override - public PropertiesWithNullValuedInstanceProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertiesWithNullValuedInstanceProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -404,7 +403,7 @@ public PropertiesWithNullValuedInstanceProperties1Boxed validateAndBox(@Nullable } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java index 070d7d5977f..ee776b80ce2 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -177,7 +176,7 @@ public static PropertyNamedRefThatIsNotAReference1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -212,24 +211,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -261,7 +260,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -288,7 +287,7 @@ public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -296,7 +295,7 @@ public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -306,7 +305,7 @@ public PropertyNamedRefThatIsNotAReferenceMap getNewInstance(Map arg, List return new PropertyNamedRefThatIsNotAReferenceMap(castProperties); } - public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -318,7 +317,7 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -333,10 +332,10 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConf } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -351,34 +350,34 @@ public PropertyNamedRefThatIsNotAReferenceMap validate(Map arg, SchemaConf } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedVoid(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedBoolean(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedNumber(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedString(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedList(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamedRefThatIsNotAReference1BoxedMap(validate(arg, configuration)); } @Override - public PropertyNamedRefThatIsNotAReference1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamedRefThatIsNotAReference1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -394,7 +393,7 @@ public PropertyNamedRefThatIsNotAReference1Boxed validateAndBox(@Nullable Object } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.java index 15cb89341c1..64e1db202bc 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -79,29 +78,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PropertyNamesBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamesBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamesBoxedString(validate(arg, configuration)); } @Override - public PropertyNamesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -175,7 +174,7 @@ public static PropertynamesValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -187,7 +186,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -199,7 +198,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -210,24 +209,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -259,7 +258,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -286,7 +285,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -294,7 +293,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -304,7 +303,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -316,7 +315,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -331,10 +330,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -349,34 +348,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PropertynamesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertynamesValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new PropertynamesValidation1BoxedVoid(validate(arg, configuration)); } @Override - public PropertynamesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertynamesValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new PropertynamesValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public PropertynamesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertynamesValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new PropertynamesValidation1BoxedNumber(validate(arg, configuration)); } @Override - public PropertynamesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertynamesValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PropertynamesValidation1BoxedString(validate(arg, configuration)); } @Override - public PropertynamesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertynamesValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PropertynamesValidation1BoxedList(validate(arg, configuration)); } @Override - public PropertynamesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertynamesValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PropertynamesValidation1BoxedMap(validate(arg, configuration)); } @Override - public PropertynamesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertynamesValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -392,7 +391,7 @@ public PropertynamesValidation1Boxed validateAndBox(@Nullable Object arg, Schema } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RegexFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RegexFormat.java index cd8b8320ee6..7b66d3734ff 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RegexFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RegexFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static RegexFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RegexFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RegexFormat1BoxedVoid(validate(arg, configuration)); } @Override - public RegexFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RegexFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public RegexFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RegexFormat1BoxedNumber(validate(arg, configuration)); } @Override - public RegexFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RegexFormat1BoxedString(validate(arg, configuration)); } @Override - public RegexFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RegexFormat1BoxedList(validate(arg, configuration)); } @Override - public RegexFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RegexFormat1BoxedMap(validate(arg, configuration)); } @Override - public RegexFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public RegexFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.java index a8f1b0e7078..fe38777bf74 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.java @@ -16,7 +16,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -134,7 +133,7 @@ public static RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -146,7 +145,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -158,7 +157,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -169,24 +168,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -245,7 +244,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -253,7 +252,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -263,7 +262,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -275,7 +274,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -290,10 +289,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -308,34 +307,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid(validate(arg, configuration)); } @Override - public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean(validate(arg, configuration)); } @Override - public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber(validate(arg, configuration)); } @Override - public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString(validate(arg, configuration)); } @Override - public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList(validate(arg, configuration)); } @Override - public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap(validate(arg, configuration)); } @Override - public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -351,7 +350,7 @@ public RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed validateAndBox(@N } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.java index f919b948fe2..7afaca672e6 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static RelativeJsonPointerFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RelativeJsonPointerFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RelativeJsonPointerFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RelativeJsonPointerFormat1BoxedVoid(validate(arg, configuration)); } @Override - public RelativeJsonPointerFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RelativeJsonPointerFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RelativeJsonPointerFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public RelativeJsonPointerFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RelativeJsonPointerFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RelativeJsonPointerFormat1BoxedNumber(validate(arg, configuration)); } @Override - public RelativeJsonPointerFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RelativeJsonPointerFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RelativeJsonPointerFormat1BoxedString(validate(arg, configuration)); } @Override - public RelativeJsonPointerFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RelativeJsonPointerFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RelativeJsonPointerFormat1BoxedList(validate(arg, configuration)); } @Override - public RelativeJsonPointerFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RelativeJsonPointerFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RelativeJsonPointerFormat1BoxedMap(validate(arg, configuration)); } @Override - public RelativeJsonPointerFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RelativeJsonPointerFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public RelativeJsonPointerFormat1Boxed validateAndBox(@Nullable Object arg, Sche } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java index 8be0cb10a2a..3d0de2d7315 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -229,7 +228,7 @@ public static RequiredDefaultValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +240,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -253,7 +252,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -264,24 +263,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,7 +312,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -340,7 +339,7 @@ public RequiredDefaultValidationMap getNewInstance(Map arg, List p for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -348,7 +347,7 @@ public RequiredDefaultValidationMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -358,7 +357,7 @@ public RequiredDefaultValidationMap getNewInstance(Map arg, List p return new RequiredDefaultValidationMap(castProperties); } - public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -370,7 +369,7 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -385,10 +384,10 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -403,34 +402,34 @@ public RequiredDefaultValidationMap validate(Map arg, SchemaConfiguration } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RequiredDefaultValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedVoid(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedNumber(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedString(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedList(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredDefaultValidation1BoxedMap(validate(arg, configuration)); } @Override - public RequiredDefaultValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredDefaultValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -446,7 +445,7 @@ public RequiredDefaultValidation1Boxed validateAndBox(@Nullable Object arg, Sche } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.java index bea1d705d49..1260dc5219b 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -51,7 +50,11 @@ public static RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap of } public @Nullable Object constructor() { - return getOrThrow("constructor"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -443,7 +446,7 @@ public static RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1 getI } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -455,7 +458,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -467,7 +470,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -478,24 +481,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -527,7 +530,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -554,7 +557,7 @@ public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap getNewIns for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -562,7 +565,7 @@ public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap getNewIns Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -572,7 +575,7 @@ public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap getNewIns return new RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap(castProperties); } - public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -584,7 +587,7 @@ public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap validate( } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -599,10 +602,10 @@ public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap validate( } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -617,34 +620,34 @@ public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap validate( } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(validate(arg, configuration)); } @Override - public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(validate(arg, configuration)); } @Override - public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(validate(arg, configuration)); } @Override - public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(validate(arg, configuration)); } @Override - public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(validate(arg, configuration)); } @Override - public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap(validate(arg, configuration)); } @Override - public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -660,7 +663,7 @@ public RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed valida } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java index aeaff53e4dd..d8d395a931a 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -75,7 +74,11 @@ public static RequiredValidationMap of(Map a } public @Nullable Object foo() { - return getOrThrow("foo"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object bar() throws UnsetPropertyException { @@ -323,7 +326,7 @@ public static RequiredValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -335,7 +338,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -347,7 +350,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -358,24 +361,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -407,7 +410,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -434,7 +437,7 @@ public RequiredValidationMap getNewInstance(Map arg, List pathToIt for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -442,7 +445,7 @@ public RequiredValidationMap getNewInstance(Map arg, List pathToIt Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -452,7 +455,7 @@ public RequiredValidationMap getNewInstance(Map arg, List pathToIt return new RequiredValidationMap(castProperties); } - public RequiredValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -464,7 +467,7 @@ public RequiredValidationMap validate(Map arg, SchemaConfiguration configu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -479,10 +482,10 @@ public RequiredValidationMap validate(Map arg, SchemaConfiguration configu } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -497,34 +500,34 @@ public RequiredValidationMap validate(Map arg, SchemaConfiguration configu } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RequiredValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedVoid(validate(arg, configuration)); } @Override - public RequiredValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public RequiredValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedNumber(validate(arg, configuration)); } @Override - public RequiredValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedString(validate(arg, configuration)); } @Override - public RequiredValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedList(validate(arg, configuration)); } @Override - public RequiredValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredValidation1BoxedMap(validate(arg, configuration)); } @Override - public RequiredValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -540,7 +543,7 @@ public RequiredValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java index 8f3fb5dbb03..02037113e85 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -229,7 +228,7 @@ public static RequiredWithEmptyArray1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +240,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -253,7 +252,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -264,24 +263,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,7 +312,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -340,7 +339,7 @@ public RequiredWithEmptyArrayMap getNewInstance(Map arg, List path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -348,7 +347,7 @@ public RequiredWithEmptyArrayMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -358,7 +357,7 @@ public RequiredWithEmptyArrayMap getNewInstance(Map arg, List path return new RequiredWithEmptyArrayMap(castProperties); } - public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -370,7 +369,7 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration con } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -385,10 +384,10 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -403,34 +402,34 @@ public RequiredWithEmptyArrayMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RequiredWithEmptyArray1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedVoid(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedBoolean(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedNumber(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedString(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedList(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEmptyArray1BoxedMap(validate(arg, configuration)); } @Override - public RequiredWithEmptyArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEmptyArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -446,7 +445,7 @@ public RequiredWithEmptyArray1Boxed validateAndBox(@Nullable Object arg, SchemaC } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java index 4b8b674d256..05018eb695c 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -1725,7 +1724,7 @@ public static RequiredWithEscapedCharacters1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1737,7 +1736,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1749,7 +1748,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1760,24 +1759,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1809,7 +1808,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1836,7 +1835,7 @@ public RequiredWithEscapedCharactersMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1844,7 +1843,7 @@ public RequiredWithEscapedCharactersMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1854,7 +1853,7 @@ public RequiredWithEscapedCharactersMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1866,7 +1865,7 @@ public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfigurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1881,10 +1880,10 @@ public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfigurat } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1899,34 +1898,34 @@ public RequiredWithEscapedCharactersMap validate(Map arg, SchemaConfigurat } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RequiredWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedVoid(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedNumber(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedString(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedList(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new RequiredWithEscapedCharacters1BoxedMap(validate(arg, configuration)); } @Override - public RequiredWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RequiredWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1942,7 +1941,7 @@ public RequiredWithEscapedCharacters1Boxed validateAndBox(@Nullable Object arg, } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java index 9234455603c..798c779beed 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -178,29 +177,29 @@ public double validate(DoubleSimpleEnumValidationEnums arg,SchemaConfiguration c } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SimpleEnumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleEnumValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleEnumValidation1BoxedNumber(validate(arg, configuration)); } @Override - public SimpleEnumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleEnumValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SingleDependency.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SingleDependency.java index 86d60b1a92f..ed420a8867c 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SingleDependency.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SingleDependency.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; @@ -115,7 +114,7 @@ public static SingleDependency1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -127,7 +126,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -139,7 +138,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -150,24 +149,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -199,7 +198,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -226,7 +225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -244,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -256,7 +255,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -271,10 +270,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -289,34 +288,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SingleDependency1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SingleDependency1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new SingleDependency1BoxedVoid(validate(arg, configuration)); } @Override - public SingleDependency1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SingleDependency1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new SingleDependency1BoxedBoolean(validate(arg, configuration)); } @Override - public SingleDependency1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SingleDependency1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SingleDependency1BoxedNumber(validate(arg, configuration)); } @Override - public SingleDependency1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SingleDependency1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new SingleDependency1BoxedString(validate(arg, configuration)); } @Override - public SingleDependency1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SingleDependency1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new SingleDependency1BoxedList(validate(arg, configuration)); } @Override - public SingleDependency1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SingleDependency1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SingleDependency1BoxedMap(validate(arg, configuration)); } @Override - public SingleDependency1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SingleDependency1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -332,7 +331,7 @@ public SingleDependency1Boxed validateAndBox(@Nullable Object arg, SchemaConfigu } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.java index b58e1485c35..545f7e592bc 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -90,29 +89,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SmallMultipleOfLargeInteger1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SmallMultipleOfLargeInteger1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SmallMultipleOfLargeInteger1BoxedNumber(validate(arg, configuration)); } @Override - public SmallMultipleOfLargeInteger1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SmallMultipleOfLargeInteger1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TimeFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TimeFormat.java index 63242646ef3..5cc90b85f6d 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TimeFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TimeFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static TimeFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TimeFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TimeFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new TimeFormat1BoxedVoid(validate(arg, configuration)); } @Override - public TimeFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TimeFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new TimeFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public TimeFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TimeFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new TimeFormat1BoxedNumber(validate(arg, configuration)); } @Override - public TimeFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TimeFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new TimeFormat1BoxedString(validate(arg, configuration)); } @Override - public TimeFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TimeFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new TimeFormat1BoxedList(validate(arg, configuration)); } @Override - public TimeFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TimeFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new TimeFormat1BoxedMap(validate(arg, configuration)); } @Override - public TimeFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TimeFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public TimeFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.java index 67c76fd1ca7..f4fb52660d7 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -90,7 +89,7 @@ public static TypeArrayObjectOrNull1 getInstance() { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -116,7 +115,7 @@ public static TypeArrayObjectOrNull1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -124,7 +123,7 @@ public static TypeArrayObjectOrNull1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -134,7 +133,7 @@ public static TypeArrayObjectOrNull1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -157,7 +156,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } else if (arg instanceof Map) { @@ -165,10 +164,10 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } else if (arg == null) { return validate((Void) null, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { @@ -176,22 +175,22 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } else if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TypeArrayObjectOrNull1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TypeArrayObjectOrNull1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new TypeArrayObjectOrNull1BoxedList(validate(arg, configuration)); } @Override - public TypeArrayObjectOrNull1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TypeArrayObjectOrNull1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new TypeArrayObjectOrNull1BoxedMap(validate(arg, configuration)); } @Override - public TypeArrayObjectOrNull1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TypeArrayObjectOrNull1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new TypeArrayObjectOrNull1BoxedVoid(validate(arg, configuration)); } @Override - public TypeArrayObjectOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TypeArrayObjectOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { @@ -200,7 +199,7 @@ public TypeArrayObjectOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaCo Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.java index 257deb56122..27e876b3a56 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -81,7 +80,7 @@ public static TypeArrayOrObject1 getInstance() { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -107,7 +106,7 @@ public static TypeArrayOrObject1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -115,7 +114,7 @@ public static TypeArrayOrObject1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -125,7 +124,7 @@ public static TypeArrayOrObject1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -137,39 +136,39 @@ public static TypeArrayOrObject1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TypeArrayOrObject1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TypeArrayOrObject1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new TypeArrayOrObject1BoxedList(validate(arg, configuration)); } @Override - public TypeArrayOrObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TypeArrayOrObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new TypeArrayOrObject1BoxedMap(validate(arg, configuration)); } @Override - public TypeArrayOrObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TypeArrayOrObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.java index da598e74bd5..0aa9f826cdf 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -117,7 +116,7 @@ public static UnevaluateditemsAsSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,7 +140,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,24 +151,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -273,10 +272,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -291,34 +290,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UnevaluateditemsAsSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsAsSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsAsSchema1BoxedVoid(validate(arg, configuration)); } @Override - public UnevaluateditemsAsSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsAsSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsAsSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public UnevaluateditemsAsSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsAsSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsAsSchema1BoxedNumber(validate(arg, configuration)); } @Override - public UnevaluateditemsAsSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsAsSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsAsSchema1BoxedString(validate(arg, configuration)); } @Override - public UnevaluateditemsAsSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsAsSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsAsSchema1BoxedList(validate(arg, configuration)); } @Override - public UnevaluateditemsAsSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsAsSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsAsSchema1BoxedMap(validate(arg, configuration)); } @Override - public UnevaluateditemsAsSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsAsSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -334,7 +333,7 @@ public UnevaluateditemsAsSchema1Boxed validateAndBox(@Nullable Object arg, Schem } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.java index c217d3c4b19..20c008ada91 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -100,7 +99,7 @@ public static Contains getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -124,7 +123,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,24 +134,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -211,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -229,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +240,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -256,10 +255,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -274,34 +273,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ContainsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedVoid(validate(arg, configuration)); } @Override - public ContainsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedBoolean(validate(arg, configuration)); } @Override - public ContainsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedNumber(validate(arg, configuration)); } @Override - public ContainsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedString(validate(arg, configuration)); } @Override - public ContainsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedList(validate(arg, configuration)); } @Override - public ContainsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ContainsBoxedMap(validate(arg, configuration)); } @Override - public ContainsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ContainsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -317,7 +316,7 @@ public ContainsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -385,7 +384,7 @@ public static Schema0 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -397,7 +396,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -409,7 +408,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -420,24 +419,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -469,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -504,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -514,7 +513,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -526,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -541,10 +540,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -559,34 +558,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedVoid(validate(arg, configuration)); } @Override - public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedBoolean(validate(arg, configuration)); } @Override - public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedNumber(validate(arg, configuration)); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedList(validate(arg, configuration)); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -602,7 +601,7 @@ public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -670,7 +669,7 @@ public static Contains1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -682,7 +681,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -694,7 +693,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -705,24 +704,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -754,7 +753,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -781,7 +780,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -789,7 +788,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -799,7 +798,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -811,7 +810,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -826,10 +825,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -844,34 +843,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Contains1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Contains1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Contains1BoxedVoid(validate(arg, configuration)); } @Override - public Contains1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Contains1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Contains1BoxedBoolean(validate(arg, configuration)); } @Override - public Contains1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Contains1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Contains1BoxedNumber(validate(arg, configuration)); } @Override - public Contains1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Contains1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Contains1BoxedString(validate(arg, configuration)); } @Override - public Contains1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Contains1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Contains1BoxedList(validate(arg, configuration)); } @Override - public Contains1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Contains1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Contains1BoxedMap(validate(arg, configuration)); } @Override - public Contains1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Contains1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -887,7 +886,7 @@ public Contains1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -955,7 +954,7 @@ public static Schema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -967,7 +966,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -979,7 +978,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -990,24 +989,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1039,7 +1038,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1066,7 +1065,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1074,7 +1073,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1084,7 +1083,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1096,7 +1095,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1111,10 +1110,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1129,34 +1128,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedVoid(validate(arg, configuration)); } @Override - public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedNumber(validate(arg, configuration)); } @Override - public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedString(validate(arg, configuration)); } @Override - public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedList(validate(arg, configuration)); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1172,7 +1171,7 @@ public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1240,7 +1239,7 @@ public static UnevaluatedItems getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1252,7 +1251,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1264,7 +1263,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1275,24 +1274,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1324,7 +1323,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1351,7 +1350,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1359,7 +1358,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1369,7 +1368,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1381,7 +1380,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1396,10 +1395,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1414,34 +1413,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UnevaluatedItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedItemsBoxedVoid(validate(arg, configuration)); } @Override - public UnevaluatedItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedItemsBoxedBoolean(validate(arg, configuration)); } @Override - public UnevaluatedItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedItemsBoxedNumber(validate(arg, configuration)); } @Override - public UnevaluatedItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedItemsBoxedString(validate(arg, configuration)); } @Override - public UnevaluatedItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedItemsBoxedList(validate(arg, configuration)); } @Override - public UnevaluatedItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedItemsBoxedMap(validate(arg, configuration)); } @Override - public UnevaluatedItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1457,7 +1456,7 @@ public UnevaluatedItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfigur } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1535,7 +1534,7 @@ public static UnevaluateditemsDependsOnMultipleNestedContains1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1547,7 +1546,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1559,7 +1558,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1570,24 +1569,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1619,7 +1618,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1646,7 +1645,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1654,7 +1653,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1664,7 +1663,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1676,7 +1675,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1691,10 +1690,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1709,34 +1708,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid(validate(arg, configuration)); } @Override - public UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean(validate(arg, configuration)); } @Override - public UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber(validate(arg, configuration)); } @Override - public UnevaluateditemsDependsOnMultipleNestedContains1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsDependsOnMultipleNestedContains1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsDependsOnMultipleNestedContains1BoxedString(validate(arg, configuration)); } @Override - public UnevaluateditemsDependsOnMultipleNestedContains1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsDependsOnMultipleNestedContains1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsDependsOnMultipleNestedContains1BoxedList(validate(arg, configuration)); } @Override - public UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap(validate(arg, configuration)); } @Override - public UnevaluateditemsDependsOnMultipleNestedContains1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsDependsOnMultipleNestedContains1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1752,7 +1751,7 @@ public UnevaluateditemsDependsOnMultipleNestedContains1Boxed validateAndBox(@Nul } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.java index 99d330e3bd4..dc21168b587 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NumberJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -139,12 +138,12 @@ public UnevaluateditemsWithItemsList getNewInstance(List arg, List pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -164,29 +163,29 @@ public UnevaluateditemsWithItemsList validate(List arg, SchemaConfiguration c } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UnevaluateditemsWithItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsWithItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsWithItems1BoxedList(validate(arg, configuration)); } @Override - public UnevaluateditemsWithItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsWithItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.java index 9956b7ba3b4..2905d689044 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -117,7 +116,7 @@ public static UnevaluateditemsWithNullInstanceElements1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,7 +140,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,24 +151,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -273,10 +272,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -291,34 +290,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UnevaluateditemsWithNullInstanceElements1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsWithNullInstanceElements1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsWithNullInstanceElements1BoxedVoid(validate(arg, configuration)); } @Override - public UnevaluateditemsWithNullInstanceElements1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsWithNullInstanceElements1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsWithNullInstanceElements1BoxedBoolean(validate(arg, configuration)); } @Override - public UnevaluateditemsWithNullInstanceElements1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsWithNullInstanceElements1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsWithNullInstanceElements1BoxedNumber(validate(arg, configuration)); } @Override - public UnevaluateditemsWithNullInstanceElements1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsWithNullInstanceElements1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsWithNullInstanceElements1BoxedString(validate(arg, configuration)); } @Override - public UnevaluateditemsWithNullInstanceElements1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsWithNullInstanceElements1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsWithNullInstanceElements1BoxedList(validate(arg, configuration)); } @Override - public UnevaluateditemsWithNullInstanceElements1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsWithNullInstanceElements1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluateditemsWithNullInstanceElements1BoxedMap(validate(arg, configuration)); } @Override - public UnevaluateditemsWithNullInstanceElements1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluateditemsWithNullInstanceElements1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -334,7 +333,7 @@ public UnevaluateditemsWithNullInstanceElements1Boxed validateAndBox(@Nullable O } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.java index bda17631ee9..e79590d214c 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NumberJsonSchema; @@ -80,29 +79,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PropertyNamesBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamesBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PropertyNamesBoxedString(validate(arg, configuration)); } @Override - public PropertyNamesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PropertyNamesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -188,7 +187,7 @@ public static UnevaluatedpropertiesNotAffectedByPropertynames1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -200,7 +199,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -212,7 +211,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,24 +222,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -272,7 +271,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -299,7 +298,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -307,7 +306,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -317,7 +316,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -329,7 +328,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -344,10 +343,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -362,34 +361,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesNotAffectedByPropertynames1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesNotAffectedByPropertynames1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -405,7 +404,7 @@ public UnevaluatedpropertiesNotAffectedByPropertynames1Boxed validateAndBox(@Nul } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.java index 548aeba1138..8b8a70e3eac 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -71,29 +70,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UnevaluatedPropertiesBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedPropertiesBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedPropertiesBoxedString(validate(arg, configuration)); } @Override - public UnevaluatedPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -137,7 +136,7 @@ public static UnevaluatedpropertiesSchema1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -145,7 +144,7 @@ public static UnevaluatedpropertiesSchema1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -155,7 +154,7 @@ public static UnevaluatedpropertiesSchema1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -167,29 +166,29 @@ public static UnevaluatedpropertiesSchema1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UnevaluatedpropertiesSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesSchema1BoxedMap(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.java index 31ec85272ba..e212359ad3d 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -70,7 +69,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -243,7 +242,7 @@ public UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap getNewInstance(M for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -251,7 +250,7 @@ public UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap getNewInstance(M Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -261,7 +260,7 @@ public UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap getNewInstance(M return new UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap(castProperties); } - public UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -273,29 +272,29 @@ public UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap validate(Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.java index 9ad1f1ae961..af6f46c0755 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -117,7 +116,7 @@ public static UnevaluatedpropertiesWithNullValuedInstanceProperties1 getInstance } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,7 +140,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,24 +151,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -273,10 +272,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -291,34 +290,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)); } @Override - public UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -334,7 +333,7 @@ public UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed validateAndBo } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java index 4399cec94a9..078f29b8bbf 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static UniqueitemsFalseValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UniqueitemsFalseValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedVoid(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedNumber(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedString(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedList(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseValidation1BoxedMap(validate(arg, configuration)); } @Override - public UniqueitemsFalseValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public UniqueitemsFalseValidation1Boxed validateAndBox(@Nullable Object arg, Sch } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.java index b88cfa6ce18..6fe3839c5b9 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -204,7 +203,7 @@ public static UniqueitemsFalseWithAnArrayOfItems1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,7 +227,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -239,24 +238,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -288,7 +287,7 @@ public UniqueitemsFalseWithAnArrayOfItemsList getNewInstance(List arg, List, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -315,7 +314,7 @@ public UniqueitemsFalseWithAnArrayOfItemsList validate(List arg, SchemaConfig for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -323,7 +322,7 @@ public UniqueitemsFalseWithAnArrayOfItemsList validate(List arg, SchemaConfig Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -333,7 +332,7 @@ public UniqueitemsFalseWithAnArrayOfItemsList validate(List arg, SchemaConfig return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -345,7 +344,7 @@ public UniqueitemsFalseWithAnArrayOfItemsList validate(List arg, SchemaConfig } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -360,10 +359,10 @@ public UniqueitemsFalseWithAnArrayOfItemsList validate(List arg, SchemaConfig } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -378,34 +377,34 @@ public UniqueitemsFalseWithAnArrayOfItemsList validate(List arg, SchemaConfig } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UniqueitemsFalseWithAnArrayOfItems1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseWithAnArrayOfItems1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseWithAnArrayOfItems1BoxedVoid(validate(arg, configuration)); } @Override - public UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean(validate(arg, configuration)); } @Override - public UniqueitemsFalseWithAnArrayOfItems1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseWithAnArrayOfItems1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseWithAnArrayOfItems1BoxedNumber(validate(arg, configuration)); } @Override - public UniqueitemsFalseWithAnArrayOfItems1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseWithAnArrayOfItems1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseWithAnArrayOfItems1BoxedString(validate(arg, configuration)); } @Override - public UniqueitemsFalseWithAnArrayOfItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseWithAnArrayOfItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseWithAnArrayOfItems1BoxedList(validate(arg, configuration)); } @Override - public UniqueitemsFalseWithAnArrayOfItems1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseWithAnArrayOfItems1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsFalseWithAnArrayOfItems1BoxedMap(validate(arg, configuration)); } @Override - public UniqueitemsFalseWithAnArrayOfItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsFalseWithAnArrayOfItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -421,7 +420,7 @@ public UniqueitemsFalseWithAnArrayOfItems1Boxed validateAndBox(@Nullable Object } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java index 2433913da51..71f3ddc3708 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static UniqueitemsValidation1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UniqueitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedVoid(validate(arg, configuration)); } @Override - public UniqueitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedBoolean(validate(arg, configuration)); } @Override - public UniqueitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedNumber(validate(arg, configuration)); } @Override - public UniqueitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedString(validate(arg, configuration)); } @Override - public UniqueitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedList(validate(arg, configuration)); } @Override - public UniqueitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsValidation1BoxedMap(validate(arg, configuration)); } @Override - public UniqueitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public UniqueitemsValidation1Boxed validateAndBox(@Nullable Object arg, SchemaCo } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.java index b9a6aaaf51e..a9e14cc23a5 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -204,7 +203,7 @@ public static UniqueitemsWithAnArrayOfItems1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,7 +215,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,7 +227,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -239,24 +238,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -288,7 +287,7 @@ public UniqueitemsWithAnArrayOfItemsList getNewInstance(List arg, List, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -315,7 +314,7 @@ public UniqueitemsWithAnArrayOfItemsList validate(List arg, SchemaConfigurati for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -323,7 +322,7 @@ public UniqueitemsWithAnArrayOfItemsList validate(List arg, SchemaConfigurati Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -333,7 +332,7 @@ public UniqueitemsWithAnArrayOfItemsList validate(List arg, SchemaConfigurati return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -345,7 +344,7 @@ public UniqueitemsWithAnArrayOfItemsList validate(List arg, SchemaConfigurati } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -360,10 +359,10 @@ public UniqueitemsWithAnArrayOfItemsList validate(List arg, SchemaConfigurati } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -378,34 +377,34 @@ public UniqueitemsWithAnArrayOfItemsList validate(List arg, SchemaConfigurati } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UniqueitemsWithAnArrayOfItems1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsWithAnArrayOfItems1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsWithAnArrayOfItems1BoxedVoid(validate(arg, configuration)); } @Override - public UniqueitemsWithAnArrayOfItems1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsWithAnArrayOfItems1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsWithAnArrayOfItems1BoxedBoolean(validate(arg, configuration)); } @Override - public UniqueitemsWithAnArrayOfItems1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsWithAnArrayOfItems1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsWithAnArrayOfItems1BoxedNumber(validate(arg, configuration)); } @Override - public UniqueitemsWithAnArrayOfItems1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsWithAnArrayOfItems1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsWithAnArrayOfItems1BoxedString(validate(arg, configuration)); } @Override - public UniqueitemsWithAnArrayOfItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsWithAnArrayOfItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsWithAnArrayOfItems1BoxedList(validate(arg, configuration)); } @Override - public UniqueitemsWithAnArrayOfItems1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsWithAnArrayOfItems1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UniqueitemsWithAnArrayOfItems1BoxedMap(validate(arg, configuration)); } @Override - public UniqueitemsWithAnArrayOfItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UniqueitemsWithAnArrayOfItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -421,7 +420,7 @@ public UniqueitemsWithAnArrayOfItems1Boxed validateAndBox(@Nullable Object arg, } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java index bc2d00b8518..6b23d7035f4 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static UriFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UriFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedVoid(validate(arg, configuration)); } @Override - public UriFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public UriFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedNumber(validate(arg, configuration)); } @Override - public UriFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedString(validate(arg, configuration)); } @Override - public UriFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedList(validate(arg, configuration)); } @Override - public UriFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UriFormat1BoxedMap(validate(arg, configuration)); } @Override - public UriFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public UriFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java index bee6021f6cf..dea06a51577 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static UriReferenceFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UriReferenceFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedVoid(validate(arg, configuration)); } @Override - public UriReferenceFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public UriReferenceFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedNumber(validate(arg, configuration)); } @Override - public UriReferenceFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedString(validate(arg, configuration)); } @Override - public UriReferenceFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedList(validate(arg, configuration)); } @Override - public UriReferenceFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UriReferenceFormat1BoxedMap(validate(arg, configuration)); } @Override - public UriReferenceFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriReferenceFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public UriReferenceFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java index 16dead22e86..598b74632e2 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static UriTemplateFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UriTemplateFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedVoid(validate(arg, configuration)); } @Override - public UriTemplateFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public UriTemplateFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedNumber(validate(arg, configuration)); } @Override - public UriTemplateFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedString(validate(arg, configuration)); } @Override - public UriTemplateFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedList(validate(arg, configuration)); } @Override - public UriTemplateFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UriTemplateFormat1BoxedMap(validate(arg, configuration)); } @Override - public UriTemplateFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UriTemplateFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public UriTemplateFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UuidFormat.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UuidFormat.java index 99b379ce994..59608501fb4 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UuidFormat.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/UuidFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -105,7 +104,7 @@ public static UuidFormat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -117,7 +116,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -140,24 +139,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,7 +188,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -261,10 +260,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -279,34 +278,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UuidFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidFormat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UuidFormat1BoxedVoid(validate(arg, configuration)); } @Override - public UuidFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidFormat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UuidFormat1BoxedBoolean(validate(arg, configuration)); } @Override - public UuidFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidFormat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UuidFormat1BoxedNumber(validate(arg, configuration)); } @Override - public UuidFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidFormat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UuidFormat1BoxedString(validate(arg, configuration)); } @Override - public UuidFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidFormat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UuidFormat1BoxedList(validate(arg, configuration)); } @Override - public UuidFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UuidFormat1BoxedMap(validate(arg, configuration)); } @Override - public UuidFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -322,7 +321,7 @@ public UuidFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.java index cacd8bf2b2d..807502a3134 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -100,7 +99,7 @@ public static ElseSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -124,7 +123,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,24 +134,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -211,7 +210,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -229,7 +228,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,7 +240,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -256,10 +255,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -274,34 +273,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ElseSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedVoid(validate(arg, configuration)); } @Override - public ElseSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public ElseSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedNumber(validate(arg, configuration)); } @Override - public ElseSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedString(validate(arg, configuration)); } @Override - public ElseSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedList(validate(arg, configuration)); } @Override - public ElseSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ElseSchemaBoxedMap(validate(arg, configuration)); } @Override - public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -317,7 +316,7 @@ public ElseSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -385,7 +384,7 @@ public static IfSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -397,7 +396,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -409,7 +408,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -420,24 +419,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -469,7 +468,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -504,7 +503,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -514,7 +513,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -526,7 +525,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -541,10 +540,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -559,34 +558,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedVoid(validate(arg, configuration)); } @Override - public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedNumber(validate(arg, configuration)); } @Override - public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedString(validate(arg, configuration)); } @Override - public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedList(validate(arg, configuration)); } @Override - public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IfSchemaBoxedMap(validate(arg, configuration)); } @Override - public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -602,7 +601,7 @@ public IfSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -670,7 +669,7 @@ public static Then getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -682,7 +681,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -694,7 +693,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -705,24 +704,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -754,7 +753,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -781,7 +780,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -789,7 +788,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -799,7 +798,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -811,7 +810,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -826,10 +825,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -844,34 +843,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ThenBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedVoid(validate(arg, configuration)); } @Override - public ThenBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedBoolean(validate(arg, configuration)); } @Override - public ThenBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedNumber(validate(arg, configuration)); } @Override - public ThenBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedString(validate(arg, configuration)); } @Override - public ThenBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedList(validate(arg, configuration)); } @Override - public ThenBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ThenBoxedMap(validate(arg, configuration)); } @Override - public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -887,7 +886,7 @@ public ThenBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -963,7 +962,7 @@ public static ValidateAgainstCorrectBranchThenVsElse1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -975,7 +974,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -987,7 +986,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -998,24 +997,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1047,7 +1046,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1074,7 +1073,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1082,7 +1081,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1092,7 +1091,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1104,7 +1103,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1119,10 +1118,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1137,34 +1136,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ValidateAgainstCorrectBranchThenVsElse1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ValidateAgainstCorrectBranchThenVsElse1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ValidateAgainstCorrectBranchThenVsElse1BoxedVoid(validate(arg, configuration)); } @Override - public ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean(validate(arg, configuration)); } @Override - public ValidateAgainstCorrectBranchThenVsElse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ValidateAgainstCorrectBranchThenVsElse1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ValidateAgainstCorrectBranchThenVsElse1BoxedNumber(validate(arg, configuration)); } @Override - public ValidateAgainstCorrectBranchThenVsElse1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ValidateAgainstCorrectBranchThenVsElse1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ValidateAgainstCorrectBranchThenVsElse1BoxedString(validate(arg, configuration)); } @Override - public ValidateAgainstCorrectBranchThenVsElse1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ValidateAgainstCorrectBranchThenVsElse1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ValidateAgainstCorrectBranchThenVsElse1BoxedList(validate(arg, configuration)); } @Override - public ValidateAgainstCorrectBranchThenVsElse1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ValidateAgainstCorrectBranchThenVsElse1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ValidateAgainstCorrectBranchThenVsElse1BoxedMap(validate(arg, configuration)); } @Override - public ValidateAgainstCorrectBranchThenVsElse1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ValidateAgainstCorrectBranchThenVsElse1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1180,7 +1179,7 @@ public ValidateAgainstCorrectBranchThenVsElse1Boxed validateAndBox(@Nullable Obj } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index 10f995aadef..90fa50e06e4 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -12,41 +12,62 @@ public class ApiConfiguration { private final ServerInfo serverInfo; + private final ServerIndexInfo serverIndexInfo; private final @Nullable Duration timeout; public ApiConfiguration() { serverInfo = new ServerInfo(); + serverIndexInfo = new ServerIndexInfo(); timeout = null; } - public ApiConfiguration(ServerInfo serverInfo, Duration timeout) { + public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, Duration timeout) { this.serverInfo = serverInfo; + this.serverIndexInfo = serverIndexInfo; this.timeout = timeout; } public static class ServerInfo { - protected final RootServerInfo rootServerInfo; + protected final RootServerInfo.RootServerInfo1 rootServerInfo; public ServerInfo() { - rootServerInfo = new RootServerInfo(); + rootServerInfo = new RootServerInfo.RootServerInfo1(); } public ServerInfo( - @Nullable RootServerInfo rootServerInfo + RootServerInfo. @Nullable RootServerInfo1 rootServerInfo ) { - this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo::new); + this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo.RootServerInfo1::new); + } + } + + public static class ServerIndexInfo { + protected RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex; + public ServerIndexInfo() {} + + public ServerIndexInfo rootServerInfoServerIndex(RootServerInfo.ServerIndex serverIndex) { + this.rootServerInfoServerIndex = serverIndex; + return this; } } public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { - return serverInfo.rootServerInfo.getServer(serverIndex); + var serverProvider = serverInfo.rootServerInfo; + if (serverIndex == null) { + RootServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.rootServerInfoServerIndex; + if (configServerIndex == null) { + throw new RuntimeException("rootServerInfoServerIndex is unset"); + } + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); } public Map> getDefaultHeaders() { return new HashMap<>(); } - public@Nullable Duration getTimeout() { + public @Nullable Duration getTimeout() { return timeout; } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java index 3bea6999da1..268e9373289 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.exceptions; @SuppressWarnings("serial") -public class BaseException extends RuntimeException { +public class BaseException extends Exception { public BaseException(String s) { super(s); } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java new file mode 100644 index 00000000000..4e9633c9d8d --- /dev/null +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.exceptions; + +@SuppressWarnings("serial") +public class NotImplementedException extends BaseException { + public NotImplementedException(String s) { + super(s); + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java index 2b09f2f77df..0fc91100784 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -5,18 +5,21 @@ import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.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 Map> content; + public final AbstractMap.SimpleEntry> content; - public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, Map> content) { + public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, AbstractMap.SimpleEntry> content) { super(required, ParameterStyle.SIMPLE, explode, allowReserved); this.content = content; } @@ -28,34 +31,28 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { - for (Map.Entry> entry: content.entrySet()) { - var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; - String contentType = entry.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - var value = ContentTypeSerializer.toJson(castInData); - return toHeaders(name, value); - } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) { + 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) { - for (Map.Entry> entry: content.entrySet()) { - String contentType = entry.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - return entry.getValue().schema().validate(deserializedJson, configuration); - } else { - throw new RuntimeException("Header deserialization of "+contentType+" has not yet been implemented"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } return deserializedJson; } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java index ac9f6274b0d..42387a7859b 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Header.java @@ -2,11 +2,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.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); - @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration); + 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/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java index 7bac0c8a6be..11707301d30 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java @@ -1,26 +1,22 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.AbstractMap; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; -import static java.util.stream.Collectors.toList; -import static java.util.stream.Collectors.toMap; - public class Rfc6570Serializer { private static final String ENCODING = "UTF-8"; private static final Set namedParameterSeparators = Set.of("&", ";"); - private static String percentEncode(String s) { + private static String percentEncode(String s) throws NotImplementedException { if (s == null) { return ""; } @@ -31,11 +27,11 @@ private static String percentEncode(String s) { .replace("%7E", "~"); // This could be done faster with more hand-crafted code. } catch (UnsupportedEncodingException wow) { - throw new RuntimeException(wow.getMessage(), wow); + throw new NotImplementedException(wow.getMessage()); } } - private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) { + 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= @@ -62,7 +58,7 @@ private static String percentEncode(String s) { // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 return null; } - throw new InvalidTypeException("Unable to generate a rfc6570 item representation of "+item); + throw new NotImplementedException("Unable to generate a rfc6570 item representation of "+item); } private static String rfc6570StrNumberExpansion( @@ -71,7 +67,7 @@ private static String rfc6570StrNumberExpansion( 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; @@ -87,11 +83,15 @@ private static String rfc6570ListExpansion( PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { - var itemValues = inData.stream() - .map(v -> rfc6570ItemValue(v, percentEncode)) - .filter(Objects::nonNull) - .collect(toList()); + ) 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 ""; @@ -116,12 +116,19 @@ private static String rfc6570MapExpansion( PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { - var inDataMap = inData.entrySet().stream() - .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), rfc6570ItemValue(entry.getValue(), percentEncode))) - .filter(entry -> entry.getValue() != null) - .collect(toMap(Map.Entry::getKey, Map.Entry::getValue, (x, y) -> y, LinkedHashMap::new)); - + ) 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 ""; @@ -143,7 +150,7 @@ protected static String rfc6570Expansion( boolean explode, boolean percentEncode, PrefixSeparatorIterator prefixSeparatorIterator - ) { + ) throws NotImplementedException { /* Separator is for separate variables like dict with explode true, not for array item separation @@ -181,6 +188,6 @@ protected static String rfc6570Expansion( ); } // bool, bytes, etc - throw new InvalidTypeException("Unable to generate a rfc6570 representation of "+inData); + throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java index e4fcfd99924..0f929d9c63b 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java @@ -3,6 +3,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.parameter.ParameterStyle; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; @@ -30,7 +32,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { + 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); @@ -49,7 +51,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid 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) { + 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<>(); @@ -60,7 +62,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return castList; } - private @Nullable Object getCastInData(JsonSchema schema, List inData) { + private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { if (schema.type == null) { if (inData.size() == 1) { return inData.get(0); @@ -68,7 +70,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return getList(schema, inData); } else if (schema.type.size() == 1) { if (schema.type.equals(BOOLEAN_TYPES)) { - throw new RuntimeException("Boolean serialization is not defined in Rfc6570, there is no agreed upon way to sent a boolean, send a string enum instead"); + 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) { @@ -76,16 +78,16 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid } else if (schema.type.equals(LIST_TYPES)) { return getList(schema, inData); } else if (schema.type.equals(MAP_TYPES)) { - throw new RuntimeException("Header map deserialization has not yet been implemented"); + 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 RuntimeException("Header deserialization for schemas with multiple types has not yet been implemented"); + 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) { + 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); diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java index d18be288684..f5fa5a0a75b 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; public class StyleSerializer extends Rfc6570Serializer { public static String serializeSimple( @@ -8,7 +9,7 @@ public static String serializeSimple( String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); return rfc6570Expansion( name, @@ -24,7 +25,7 @@ public static String serializeForm( String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { // todo check that the prefix and suffix matches this one PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); return rfc6570Expansion( @@ -40,7 +41,7 @@ public static String serializeMatrix( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); return rfc6570Expansion( name, @@ -55,7 +56,7 @@ public static String serializeLabel( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); return rfc6570Expansion( name, @@ -70,7 +71,7 @@ public static String serializeSpaceDelimited( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); return rfc6570Expansion( name, @@ -85,7 +86,7 @@ public static String serializePipeDelimited( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); return rfc6570Expansion( name, diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java index 79a3e781051..d5e00cc2fa9 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java @@ -3,30 +3,28 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import java.util.Map; import java.util.AbstractMap; public class ContentParameter extends ParameterBase implements Parameter { - public final Map> content; + public final AbstractMap.SimpleEntry> content; - public ContentParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, Map> 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) { - for (Map.Entry> entry: content.entrySet()) { - String contentType = entry.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - var value = ContentTypeSerializer.toJson(inData); - return new AbstractMap.SimpleEntry<>(name, value); - } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java index b04b2ca1754..dcd3b6faf6b 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.Map; @@ -13,7 +14,7 @@ protected CookieSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData) { + public String serialize(Map inData) throws NotImplementedException { String result = ""; Map sortedData = new TreeMap<>(inData); for (Map.Entry entry: sortedData.entrySet()) { diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java index b4a23229944..1969f2c0b21 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.LinkedHashMap; @@ -14,7 +15,7 @@ protected HeadersSerializer(Map parameters) { this.parameters = parameters; } - public Map> serialize(Map inData) { + public Map> serialize(Map inData) throws NotImplementedException { Map> results = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java index 9fe0745417c..adf3896d557 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java @@ -1,9 +1,10 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData); + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java index 5864f89c901..78015037211 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.Map; @@ -12,7 +13,7 @@ protected PathSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData, String pathWithPlaceholders) { + public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException { String result = pathWithPlaceholders; for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java index 91ea0b041bb..880151ed144 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.HashMap; @@ -14,7 +15,7 @@ protected QuerySerializer(Map parameters) { this.parameters = parameters; } - public Map getQueryMap(Map inData) { + public Map getQueryMap(Map inData) throws NotImplementedException { Map results = new HashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java index 8acfdafcc8a..eef0b6bc371 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java @@ -2,6 +2,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.header.StyleSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import java.util.AbstractMap; @@ -26,7 +27,7 @@ private ParameterStyle getStyle() { } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { ParameterStyle usedStyle = getStyle(); boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; String value; @@ -52,7 +53,7 @@ public AbstractMap.SimpleEntry serialize(@Nullable Object inData } else { // usedStyle == ParameterStyle.DEEP_OBJECT // query - throw new RuntimeException("Style deep object serialization has not yet been implemented."); + throw new NotImplementedException("Style deep object serialization has not yet been implemented."); } return new AbstractMap.SimpleEntry<>(name, value); } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java index 37fb90cd4f2..6be6cbffd80 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java @@ -5,6 +5,7 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.Map; @@ -33,14 +34,14 @@ private SerializedRequestBody serializeTextPlain(String contentType, @Nullable O 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) { + 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 RuntimeException("Serialization has not yet been implemented for contentType="+contentType+". If you need it please file a PR"); + 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); + public abstract SerializedRequestBody serialize(T requestBody) throws NotImplementedException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java index bbd744abebc..9ec3e3c44a6 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java @@ -2,6 +2,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.header.Header; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; @@ -18,7 +20,7 @@ public HeadersDeserializer(Map headers, MapSchemaValidator headersToValidate = new HashMap<>(); for (Map.Entry> entry: responseHeaders.map().entrySet()) { String headerName = entry.getKey(); diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java index 59079f9f1a1..640f2a96415 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java @@ -7,31 +7,27 @@ import java.util.Optional; import org.checkerframework.checker.nullness.qual.Nullable; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.ToNumberPolicy; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.header.Header; public abstract class ResponseDeserializer { public final Map content; public final @Nullable Map headers; - private static final Gson gson = new GsonBuilder() - .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .create(); public ResponseDeserializer(Map content) { this.content = content; this.headers = null; } - protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration); - protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration); + 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); @@ -42,7 +38,7 @@ protected String deserializeTextPlain(byte[] body) { return new String(body, StandardCharsets.UTF_8); } - protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) { + 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); @@ -50,23 +46,28 @@ protected T deserializeBody(String contentType, byte[] body, JsonSchema s String bodyData = deserializeTextPlain(body); return schema.validateAndBox(bodyData, configuration); } - throw new RuntimeException("Deserialization for contentType="+contentType+" has not yet been implemented."); + throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); } - public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { - throw new RuntimeException("Invalid response returned, Content-Type header is missing and it must be included"); + throw new ApiException( + "Invalid response returned, Content-Type header is missing and it must be included", + response + ); } String contentType = contentTypeInfo.get(); - if (content != null && !content.containsKey(contentType)) { - throw new RuntimeException( - "Invalid contentType returned. contentType="+contentType+" was returned "+ - "when only "+content.keySet()+" are defined for statusCode="+response.statusCode() + @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, bodyBytes, configuration); + SealedBodyClass body = getBody(contentType, mediaType, bodyBytes, configuration); HeaderClass headers = getHeaders(response.headers(), configuration); return new DeserializedHttpResponse<>(body, headers); } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java index 20b56db17da..f72be2313af 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java @@ -2,7 +2,10 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import java.net.http.HttpResponse; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration); + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index 0ffcae114bd..7990efaa995 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -86,7 +85,7 @@ public static AnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,7 +97,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -110,7 +109,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,24 +120,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -170,7 +169,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -180,7 +179,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -205,7 +204,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -214,7 +213,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,11 +240,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -260,41 +259,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -310,7 +309,7 @@ public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java index 2cceae9d49f..12af2ba8196 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -44,7 +43,7 @@ public static BooleanJsonSchema1 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,30 +59,30 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index 15b5ca67f26..4853a27dee8 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static DateJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -66,30 +65,30 @@ public String validate(LocalDate arg, SchemaConfiguration configuration) throws if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof LocalDate) { return validate((LocalDate) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java index e695f3c2ac9..a5b4f50d788 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static DateTimeJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -66,30 +65,30 @@ public String validate(ZonedDateTime arg, SchemaConfiguration configuration) thr if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof ZonedDateTime) { return validate((ZonedDateTime) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java index f961e94f802..6651aa44497 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static DecimalJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,28 +60,28 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DecimalJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java index 56f7894f670..9bcb31d2068 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static DoubleJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -56,7 +55,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -65,28 +64,28 @@ public double validate(double arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java index 65221627b46..101b2ea1f57 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static FloatJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -56,7 +55,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @@ -65,28 +64,28 @@ public float validate(float arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FloatJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java index 836fa1db724..2938d08bf21 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -49,7 +48,7 @@ public static Int32JsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -59,7 +58,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } @@ -72,28 +71,28 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int32JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java index da3f9d8d5f7..c17217a89ab 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -51,7 +50,7 @@ public static Int64JsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,11 +60,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } @@ -82,28 +81,28 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int64JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java index 6205c5b4380..34b79da8f66 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -51,7 +50,7 @@ public static IntJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,11 +60,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } @@ -82,28 +81,28 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index 7ebb3106467..8135ed020cf 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -56,7 +55,7 @@ public static ListJsonSchema1 getInstance() { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -66,7 +65,7 @@ public static ListJsonSchema1 getInstance() { return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -82,28 +81,28 @@ public static ListJsonSchema1 getInstance() { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ListJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index 47e141dac53..85396cda11a 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -54,7 +53,7 @@ public static MapJsonSchema1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -62,7 +61,7 @@ public static MapJsonSchema1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -71,7 +70,7 @@ public static MapJsonSchema1 getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,28 +85,28 @@ public static MapJsonSchema1 getInstance() { if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index de1ed91b0cd..7a1a3367d78 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -88,7 +87,7 @@ public static NotAnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -100,7 +99,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,24 +122,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,7 +171,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -182,7 +181,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -199,7 +198,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -207,7 +206,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,11 +242,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,41 +261,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -312,7 +311,7 @@ public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java index d028dbf295e..af32938007e 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -45,7 +44,7 @@ public static NullJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,29 +59,29 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NullJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java index 5c33b047d95..57629ac9557 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -50,7 +49,7 @@ public static NumberJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,19 +59,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -81,28 +80,28 @@ public double validate(double arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java index 749f5faba63..7185ac28496 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static StringJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -74,11 +73,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof LocalDate) { @@ -88,20 +87,20 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java index c2087929db7..2502602642f 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static UuidJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -66,30 +65,30 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UuidJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java index 64d9f476798..b7afc854c15 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java @@ -1,5 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -11,7 +13,7 @@ public class AdditionalPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java index eb6bcf21d4a..4b969c68a20 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java @@ -1,11 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; public class AllOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var allOf = data.schema().allOf; if (allOf == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java index d466518d3fe..19d4e0337c9 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java @@ -10,7 +10,7 @@ public class AnyOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var anyOf = data.schema().anyOf; if (anyOf == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java index cb28fcb9662..639d32e889e 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java @@ -5,7 +5,7 @@ import java.math.BigDecimal; public abstract class BigDecimalValidator { - protected BigDecimal getBigDecimal(Number arg) { + protected BigDecimal getBigDecimal(Number arg) throws ValidationException { if (arg instanceof Integer) { return new BigDecimal((Integer) arg); } else if (arg instanceof Long) { diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java index cbf6ed9ddbf..7e80fd207c2 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface BooleanEnumValidator { - boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java index 7bade32a205..96c69f5a7a2 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface BooleanSchemaValidator { - boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java index 6409a23e5ca..93872adcc2f 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java @@ -10,7 +10,7 @@ public class ConstValidator extends BigDecimalValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!data.schema().constValueSet) { return null; } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java index fbfd1c9c700..41565577d58 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java @@ -9,7 +9,7 @@ public class ContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof List)) { return null; } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java index 43fe8423969..1f1d1ba5e68 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java @@ -1,5 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; +import org.openapijsonschematools.client.exceptions.ValidationException; + public interface DefaultValueMethod { - T defaultValue(); + T defaultValue() throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java index 77b21ca801d..2640e2f6d8d 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java @@ -11,7 +11,7 @@ public class DependentRequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java index e329529fe8a..f51b5eaf339 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashSet; import java.util.Map; @@ -10,7 +11,7 @@ public class DependentSchemasValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java index aa59920f5ac..f2b8b1e7d74 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface DoubleEnumValidator { - double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java index 3f50d9326c4..18573a77ef7 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ElseValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var elseSchema = data.schema().elseSchema; if (elseSchema == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java index 8af756619bd..66563d80960 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java @@ -15,7 +15,7 @@ private static boolean enumContainsArg(Set<@Nullable Object> enumValues, @Nullab @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var enumValues = data.schema().enumValues; if (enumValues == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java index 7d05ff65546..e05df98079f 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMaximum = data.schema().exclusiveMaximum; if (exclusiveMaximum == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java index 73eb1e547c3..0e06f391f62 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMinimum = data.schema().exclusiveMinimum; if (exclusiveMinimum == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java index 33d4834731d..17317003a34 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface FloatEnumValidator { - float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java index c1ca45e44f3..35c089a03c7 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java @@ -18,7 +18,7 @@ public class FormatValidator implements KeywordValidator { private final static BigDecimal doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308d); private final static BigDecimal doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308d); - private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) { + private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) throws ValidationException { if (format.startsWith("int")) { // there is a json schema test where 1.0 validates as an integer BigInteger intArg; @@ -85,7 +85,7 @@ private static void validateNumericFormat(Number arg, ValidationMetadata validat } } - private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) { + private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { switch (format) { case "uuid" -> { try { @@ -133,7 +133,7 @@ private static void validateStringFormat(String arg, ValidationMetadata validati @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var format = data.schema().format; if (format == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java index b145ab8007a..2a05893a22a 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java @@ -7,7 +7,7 @@ public class IfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var ifSchema = data.schema().ifSchema; if (ifSchema == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java index 491cb228f18..cb20c832f9b 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface IntegerEnumValidator { - int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java index 1b03c0b3094..68d62107337 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class ItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var items = data.schema().items; if (items == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index beb7460b86c..a597533422f 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; +import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.checkerframework.checker.nullness.qual.Nullable; import java.math.BigDecimal; import java.time.LocalDate; @@ -221,9 +220,9 @@ protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { this.keywordToValidator = keywordToValidator; } - public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; - public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; - public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; + public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas); + public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; + public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; private List getContainsPathToSchemas( @Nullable Object arg, @@ -262,7 +261,7 @@ private List getContainsPathToSchemas( private PathToSchemasMap getPatternPropertiesPathToSchemas( @Nullable Object arg, ValidationMetadata validationMetadata - ) { + ) throws ValidationException { if (!(arg instanceof Map mapArg) || patternProperties == null) { return new PathToSchemasMap(); } @@ -270,7 +269,7 @@ private PathToSchemasMap getPatternPropertiesPathToSchemas( for (Map.Entry entry: mapArg.entrySet()) { Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new InvalidTypeException("Invalid non-string type for map key"); + throw new ValidationException("Invalid non-string type for map key"); } List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); propPathToItem.add(key); @@ -306,7 +305,7 @@ private PathToSchemasMap getIfPathToSchemas( try { var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException | InvalidTypeException ignored) {} + } catch (ValidationException ignored) {} return pathToSchemas; } @@ -389,7 +388,7 @@ protected Void castToAllowedTypes(Void arg, List pathToItem, Set castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { pathSet.add(pathToItem); List<@Nullable Object> argFixed = new ArrayList<>(); int i =0; @@ -403,13 +402,13 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws ValidationException { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new ValidationException("Invalid non-string key value"); } Object val = entry.getValue(); List newPathToItem = new ArrayList<>(pathToItem); @@ -420,7 +419,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set pathToItem, Set> pathSet) { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws ValidationException { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { @@ -448,7 +447,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set argClass = arg.getClass(); - throw new InvalidTypeException("Invalid type passed in for input="+arg+" type="+argClass); + throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); } } @@ -468,7 +467,7 @@ public String getNewInstance(String arg, List pathToItem, PathToSchemasM return arg; } - protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) { + protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) throws ValidationException { PathToSchemasMap pathToSchemasMap = new PathToSchemasMap(); // todo add check of validationMetadata.validationRanEarlier(this) PathToSchemasMap otherPathToSchemas = validate(jsonSchema, arg, validationMetadata); diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index d0ff52b29c8..a7752b37595 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas); - OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; + OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException; + BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java index 88410ffc5e2..6b6bcd88c47 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface LongEnumValidator { - long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java index 984693428e8..9bd7d432165 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; import java.util.Map; public interface MapSchemaValidator { - OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas); - OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; + OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException; + BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java index 9e9b3b92c18..315771b9e0c 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java @@ -9,7 +9,7 @@ public class MaxContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxContains = data.schema().maxContains; if (maxContains == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java index 98ed5cb4ff4..2749843cbf2 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java @@ -9,7 +9,7 @@ public class MaxItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxItems = data.schema().maxItems; if (maxItems == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java index 08d91666c5d..f2a77fa91f6 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java @@ -7,7 +7,7 @@ public class MaxLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxLength = data.schema().maxLength; if (maxLength == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java index d117f1688e2..57a53e71be5 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java @@ -9,7 +9,7 @@ public class MaxPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxProperties = data.schema().maxProperties; if (maxProperties == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java index 702f09686dc..df1c7f5c338 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java @@ -7,7 +7,7 @@ public class MaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maximum = data.schema().maximum; if (maximum == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java index 1827e95cc83..6ea4404dc1f 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java @@ -9,7 +9,7 @@ public class MinContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minContains = data.schema().minContains; if (minContains == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java index d1933ca7750..25bae60bda7 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java @@ -9,7 +9,7 @@ public class MinItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minItems = data.schema().minItems; if (minItems == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java index 1defdc891e3..f4639e8a207 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java @@ -7,7 +7,7 @@ public class MinLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minLength = data.schema().minLength; if (minLength == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java index c0b99e7fb7d..011ac76dd31 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java @@ -9,7 +9,7 @@ public class MinPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minProperties = data.schema().minProperties; if (minProperties == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java index 3b539120e42..76065fe50b5 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java @@ -7,7 +7,7 @@ public class MinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minimum = data.schema().minimum; if (minimum == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java index eebc07a0f10..d8273d04d9c 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java @@ -9,7 +9,7 @@ public class MultipleOfValidator extends BigDecimalValidator implements KeywordV @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var multipleOf = data.schema().multipleOf; if (multipleOf == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java index b077e2056a1..3e6b8e91e7c 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java @@ -7,7 +7,7 @@ public class NotValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var not = data.schema().not; if (not == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java index 96b52a74b9f..bc6bd3663bb 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface NullEnumValidator { - Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java index c49fc0150fe..c30cde9f9b7 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java @@ -1,13 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; -import java.util.List; -import java.util.Set; - public interface NullSchemaValidator { - Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java index c426b250af8..dd3c349ad69 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface NumberSchemaValidator { - Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java index 3c4f4b5a085..7dd5f4128ac 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java @@ -10,7 +10,7 @@ public class OneOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var oneOf = data.schema().oneOf; if (oneOf == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java index eceeb19e311..d7eebd78098 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java @@ -7,7 +7,7 @@ public class PatternValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var pattern = data.schema().pattern; if (pattern == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java index 237bc250190..510f3a8760e 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class PrefixItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var prefixItems = data.schema().prefixItems; if (prefixItems == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java index b8ddd6fcb46..8803b661fd6 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -12,7 +13,7 @@ public class PropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var properties = data.schema().properties; if (properties == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java index 087cd308b11..0169ff5bdba 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +11,7 @@ public class PropertyNamesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var propertyNames = data.schema().propertyNames; if (propertyNames == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java index f2e1a8ecde8..2519cbcfd3b 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -12,7 +12,7 @@ public class RequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var required = data.schema().required; if (required == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java index 49ca190ae5f..baf86081fd7 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface StringEnumValidator { - String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java index 8cbc38335bf..e6729893fca 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface StringSchemaValidator { - String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + String validate(String arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java index bf599bc812f..75c083e2edc 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ThenValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var then = data.schema().then; if (then == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java index bb4133a770e..300d472cfdf 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; import java.util.Map; @@ -10,7 +10,7 @@ public class TypeValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var type = data.schema().type; if (type == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java index 8903d0b19a7..407904da444 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class UnevaluatedItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedItems = data.schema().unevaluatedItems; if (unevaluatedItems == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java index 344c0cfab1b..8fd34950404 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -11,7 +11,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedProperties = data.schema().unevaluatedProperties; if (unevaluatedProperties == null) { return null; @@ -27,7 +27,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { JsonSchema unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties); for(Map.Entry entry: mapArg.entrySet()) { if (!(entry.getKey() instanceof String propName)) { - throw new InvalidTypeException("Map keys must be strings"); + throw new ValidationException("Map keys must be strings"); } List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); propPathToItem.add(propName); diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java index a42a7d60b60..6b40ba79fff 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -11,7 +11,7 @@ public class UniqueItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var uniqueItems = data.schema().uniqueItems; if (uniqueItems == null) { return null; diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index 1c23a427dd0..8e17449eb27 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; @@ -73,7 +72,7 @@ public static UnsetAnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -85,7 +84,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -97,7 +96,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -108,24 +107,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -157,7 +156,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -167,7 +166,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -192,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,11 +227,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -247,41 +246,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -297,7 +296,7 @@ public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaC } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java index 8c93a971aae..f736485870c 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java @@ -1,8 +1,6 @@ package org.openapijsonschematools.client.servers; -import org.checkerframework.checker.nullness.qual.Nullable; - public interface ServerProvider { - Server getServer(@Nullable T serverIndex); + Server getServer(T serverIndex); } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.java index bf8415219c8..ff1a139293b 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ASchemaGivenForPrefixitemsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testCorrectTypesPasses() { + public void testCorrectTypesPasses() throws ValidationException { // correct types final var schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testCorrectTypesPasses() { } @Test - public void testArrayWithAdditionalItemsPasses() { + public void testArrayWithAdditionalItemsPasses() throws ValidationException { // array with additional items final var schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance(); schema.validate( @@ -50,7 +49,7 @@ public void testArrayWithAdditionalItemsPasses() { } @Test - public void testJavascriptPseudoArrayIsValidPasses() { + public void testJavascriptPseudoArrayIsValidPasses() throws ValidationException { // JavaScript pseudo-array is valid final var schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance(); schema.validate( @@ -73,7 +72,7 @@ public void testJavascriptPseudoArrayIsValidPasses() { } @Test - public void testEmptyArrayPasses() { + public void testEmptyArrayPasses() throws ValidationException { // empty array final var schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance(); schema.validate( @@ -96,13 +95,13 @@ public void testWrongTypesFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIncompleteArrayOfItemsPasses() { + public void testIncompleteArrayOfItemsPasses() throws ValidationException { // incomplete array of items final var schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.java index f6bfb6cc8e7..6f3b3d7e7cf 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AdditionalItemsAreAllowedByDefaultTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testOnlyTheFirstItemIsValidatedPasses() { + public void testOnlyTheFirstItemIsValidatedPasses() throws ValidationException { // only the first item is validated final var schema = AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java index b279d9037a1..cc313aecdc7 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AdditionalpropertiesAreAllowedByDefaultTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAdditionalPropertiesAreAllowedPasses() { + public void testAdditionalPropertiesAreAllowedPasses() throws ValidationException { // additional properties are allowed final var schema = AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java index 8c8d5a930f8..511ed766816 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AdditionalpropertiesCanExistByItselfTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnAdditionalValidPropertyIsValidPasses() { + public void testAnAdditionalValidPropertyIsValidPasses() throws ValidationException { // an additional valid property is valid final var schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testAnAdditionalInvalidPropertyIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.java index b8d4769dc83..f09a9c8225e 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,7 +35,7 @@ public void testPropertiesDefinedInAllofAreNotExaminedFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.java index d5aa85b058a..f85074f23d3 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AdditionalpropertiesWithNullValuedInstancePropertiesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllowsNullValuesPasses() { + public void testAllowsNullValuesPasses() throws ValidationException { // allows null values final var schema = AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.java index c004fa8d3dd..f35e5425807 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AdditionalpropertiesWithSchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNoAdditionalPropertiesIsValidPasses() { + public void testNoAdditionalPropertiesIsValidPasses() throws ValidationException { // no additional properties is valid final var schema = AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testNoAdditionalPropertiesIsValidPasses() { } @Test - public void testAnAdditionalValidPropertyIsValidPasses() { + public void testAnAdditionalValidPropertyIsValidPasses() throws ValidationException { // an additional valid property is valid final var schema = AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1.getInstance(); schema.validate( @@ -78,7 +77,7 @@ public void testAnAdditionalInvalidPropertyIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java index e32dd818973..0a0b984f2a9 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testAllofFalseAnyofFalseOneofTrueFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -42,7 +41,7 @@ public void testAllofFalseAnyofTrueOneofFalseFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -57,7 +56,7 @@ public void testAllofFalseAnyofTrueOneofTrueFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -72,13 +71,13 @@ public void testAllofTrueAnyofFalseOneofFalseFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAllofTrueAnyofTrueOneofTruePasses() { + public void testAllofTrueAnyofTrueOneofTruePasses() throws ValidationException { // allOf: true, anyOf: true, oneOf: true final var schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance(); schema.validate( @@ -97,7 +96,7 @@ public void testAllofFalseAnyofFalseOneofFalseFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -112,7 +111,7 @@ public void testAllofTrueAnyofFalseOneofTrueFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -127,7 +126,7 @@ public void testAllofTrueAnyofTrueOneofFalseFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java index 6738af4533a..a1674088c48 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testMismatchOneFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidPasses() { + public void testValidPasses() throws ValidationException { // valid final var schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java index 96ceb9d6354..dd860fd7933 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -32,7 +31,7 @@ public void testMismatchSecondFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -56,7 +55,7 @@ public void testWrongTypeFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -76,13 +75,13 @@ public void testMismatchFirstFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAllofPasses() { + public void testAllofPasses() throws ValidationException { // allOf final var schema = Allof.Allof1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java index 8b7da7ba706..6ecb6d11785 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,7 +35,7 @@ public void testMismatchBaseSchemaFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -60,13 +59,13 @@ public void testMismatchFirstAllofFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidPasses() { + public void testValidPasses() throws ValidationException { // valid final var schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance(); schema.validate( @@ -103,7 +102,7 @@ public void testMismatchBothFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -127,7 +126,7 @@ public void testMismatchSecondAllofFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java index 4a51f3f1393..b9789ef7a07 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AllofWithOneEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnyDataIsValidPasses() { + public void testAnyDataIsValidPasses() throws ValidationException { // any data is valid final var schema = AllofWithOneEmptySchema.AllofWithOneEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java index 84351d8fbe9..8ca39f6230c 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testStringIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNumberIsValidPasses() { + public void testNumberIsValidPasses() throws ValidationException { // number is valid final var schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java index f0a11562d85..8dd9396f839 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testStringIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNumberIsValidPasses() { + public void testNumberIsValidPasses() throws ValidationException { // number is valid final var schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java index b7bcf055a29..de5acdab7e0 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AllofWithTwoEmptySchemasTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnyDataIsValidPasses() { + public void testAnyDataIsValidPasses() throws ValidationException { // any data is valid final var schema = AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java index a931b23d567..16f9ce46d75 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AnyofComplexTypesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testSecondAnyofValidComplexPasses() { + public void testSecondAnyofValidComplexPasses() throws ValidationException { // second anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testSecondAnyofValidComplexPasses() { } @Test - public void testBothAnyofValidComplexPasses() { + public void testBothAnyofValidComplexPasses() throws ValidationException { // both anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( @@ -52,7 +51,7 @@ public void testBothAnyofValidComplexPasses() { } @Test - public void testFirstAnyofValidComplexPasses() { + public void testFirstAnyofValidComplexPasses() throws ValidationException { // first anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( @@ -85,7 +84,7 @@ public void testNeitherAnyofValidComplexFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java index ef97ff6dff1..8862d6c0537 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AnyofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBothAnyofValidPasses() { + public void testBothAnyofValidPasses() throws ValidationException { // both anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( @@ -37,13 +36,13 @@ public void testNeitherAnyofValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testFirstAnyofValidPasses() { + public void testFirstAnyofValidPasses() throws ValidationException { // first anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testFirstAnyofValidPasses() { } @Test - public void testSecondAnyofValidPasses() { + public void testSecondAnyofValidPasses() throws ValidationException { // second anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java index b75095b0576..ba43a0f6796 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testMismatchBaseSchemaFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testOneAnyofValidPasses() { + public void testOneAnyofValidPasses() throws ValidationException { // one anyOf valid final var schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance(); schema.validate( @@ -52,7 +51,7 @@ public void testBothAnyofInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java index 8829498ffaa..dd35d31abde 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AnyofWithOneEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNumberIsValidPasses() { + public void testNumberIsValidPasses() throws ValidationException { // number is valid final var schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testNumberIsValidPasses() { } @Test - public void testStringIsValidPasses() { + public void testStringIsValidPasses() throws ValidationException { // string is valid final var schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java index 900780d146a..11db0660547 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testABooleanIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -42,13 +41,13 @@ public void testAFloatIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAnArrayIsAnArrayPasses() { + public void testAnArrayIsAnArrayPasses() throws ValidationException { // an array is an array final var schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance(); schema.validate( @@ -68,7 +67,7 @@ public void testNullIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -83,7 +82,7 @@ public void testAStringIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -98,7 +97,7 @@ public void testAnIntegerIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -114,7 +113,7 @@ public void testAnObjectIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java index 28095652c59..87d8cd62521 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testAFloatIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -42,13 +41,13 @@ public void testAStringIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testFalseIsABooleanPasses() { + public void testFalseIsABooleanPasses() throws ValidationException { // false is a boolean final var schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance(); schema.validate( @@ -58,7 +57,7 @@ public void testFalseIsABooleanPasses() { } @Test - public void testTrueIsABooleanPasses() { + public void testTrueIsABooleanPasses() throws ValidationException { // true is a boolean final var schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance(); schema.validate( @@ -78,7 +77,7 @@ public void testAnObjectIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -94,7 +93,7 @@ public void testAnArrayIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -109,7 +108,7 @@ public void testNullIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -124,7 +123,7 @@ public void testAnIntegerIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -139,7 +138,7 @@ public void testZeroIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -154,7 +153,7 @@ public void testAnEmptyStringIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java index 5238a51609e..74374bb8c74 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testIntByIntFailFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIntByIntPasses() { + public void testIntByIntPasses() throws ValidationException { // int by int final var schema = ByInt.ByInt1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testIntByIntPasses() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException { // ignores non-numbers final var schema = ByInt.ByInt1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java index c7a9bc144bd..4e7853023c6 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void test35IsNotMultipleOf15Fails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void test45IsMultipleOf15Passes() { + public void test45IsMultipleOf15Passes() throws ValidationException { // 4.5 is multiple of 1.5 final var schema = ByNumber.ByNumber1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void test45IsMultipleOf15Passes() { } @Test - public void testZeroIsMultipleOfAnythingPasses() { + public void testZeroIsMultipleOfAnythingPasses() throws ValidationException { // zero is multiple of anything final var schema = ByNumber.ByNumber1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java index 4bbf88c3921..49412ed2b66 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void test000751IsNotMultipleOf00001Fails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void test00075IsMultipleOf00001Passes() { + public void test00075IsMultipleOf00001Passes() throws ValidationException { // 0.0075 is multiple of 0.0001 final var schema = BySmallNumber.BySmallNumber1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.java index 6d379f49285..f69ab37c041 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ConstNulCharactersInStringsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMatchStringWithNulPasses() { + public void testMatchStringWithNulPasses() throws ValidationException { // match string with nul final var schema = ConstNulCharactersInStrings.ConstNulCharactersInStrings1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testDoNotMatchStringLackingNulFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.java index c69a4404792..fcb2a5fcd1f 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ContainsKeywordValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testArrayWithTwoItemsMatchingSchema56IsValidPasses() { + public void testArrayWithTwoItemsMatchingSchema56IsValidPasses() throws ValidationException { // array with two items matching schema (5, 6) is valid final var schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testArrayWithTwoItemsMatchingSchema56IsValidPasses() { } @Test - public void testNotArrayIsValidPasses() { + public void testNotArrayIsValidPasses() throws ValidationException { // not array is valid final var schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance(); schema.validate( @@ -44,7 +43,7 @@ public void testNotArrayIsValidPasses() { } @Test - public void testArrayWithItemMatchingSchema5IsValidPasses() { + public void testArrayWithItemMatchingSchema5IsValidPasses() throws ValidationException { // array with item matching schema (5) is valid final var schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance(); schema.validate( @@ -58,7 +57,7 @@ public void testArrayWithItemMatchingSchema5IsValidPasses() { } @Test - public void testArrayWithItemMatchingSchema6IsValidPasses() { + public void testArrayWithItemMatchingSchema6IsValidPasses() throws ValidationException { // array with item matching schema (6) is valid final var schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance(); schema.validate( @@ -85,7 +84,7 @@ public void testArrayWithoutItemsMatchingSchemaIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -101,7 +100,7 @@ public void testEmptyArrayIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java index 0a573bbc857..b1b96c9e8d7 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ContainsWithNullInstanceElementsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllowsNullItemsPasses() { + public void testAllowsNullItemsPasses() throws ValidationException { // allows null items final var schema = ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateFormatTest.java index f81b657f6c4..ed02708dd02 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class DateFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = DateFormat.DateFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = DateFormat.DateFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = DateFormat.DateFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testInvalidDateStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidDateStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid date string is only an annotation by default final var schema = DateFormat.DateFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testInvalidDateStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = DateFormat.DateFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = DateFormat.DateFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = DateFormat.DateFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java index 0c6c5abdde0..99cfc33382a 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class DateTimeFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testInvalidDateTimeStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidDateTimeStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid date-time string is only an annotation by default final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testInvalidDateTimeStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -48,7 +47,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.java index 97d5a50e14d..121cdd4dab9 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -32,7 +31,7 @@ public void testQuotedQuoteInvalidUnderDependentSchemaFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -56,13 +55,13 @@ public void testQuotedTabInvalidUnderDependentSchemaFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testQuotedTabPasses() { + public void testQuotedTabPasses() throws ValidationException { // quoted tab final var schema = DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1.getInstance(); schema.validate( @@ -108,7 +107,7 @@ public void testQuotedQuoteFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.java index 85c57a20c0f..06d74b83b46 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -32,13 +31,13 @@ public void testMatchesRootFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testMatchesDependencyPasses() { + public void testMatchesDependencyPasses() throws ValidationException { // matches dependency final var schema = DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testMatchesDependencyPasses() { } @Test - public void testNoDependencyPasses() { + public void testNoDependencyPasses() throws ValidationException { // no dependency final var schema = DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance(); schema.validate( @@ -86,7 +85,7 @@ public void testMatchesBothFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.java index 6c162125f0e..45d72027fdb 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,13 +35,13 @@ public void testWrongTypeFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidPasses() { + public void testValidPasses() throws ValidationException { // valid final var schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance(); schema.validate( @@ -61,7 +60,7 @@ public void testValidPasses() { } @Test - public void testNoDependencyPasses() { + public void testNoDependencyPasses() throws ValidationException { // no dependency final var schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance(); schema.validate( @@ -76,7 +75,7 @@ public void testNoDependencyPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance(); schema.validate( @@ -86,7 +85,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance(); schema.validate( @@ -116,13 +115,13 @@ public void testWrongTypeBothFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException { // ignores strings final var schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance(); schema.validate( @@ -150,7 +149,7 @@ public void testWrongTypeOtherFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DurationFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DurationFormatTest.java index 74179b71d47..d63978f88ab 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DurationFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DurationFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class DurationFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = DurationFormat.DurationFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = DurationFormat.DurationFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = DurationFormat.DurationFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testInvalidDurationStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidDurationStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid duration string is only an annotation by default final var schema = DurationFormat.DurationFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testInvalidDurationStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = DurationFormat.DurationFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = DurationFormat.DurationFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = DurationFormat.DurationFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java index bfea6a62b4f..9277a3c898d 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class EmailFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testInvalidEmailStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidEmailStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid email string is only an annotation by default final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testInvalidEmailStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.java index ec2e20bfbdd..b44fbb68c1b 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class EmptyDependentsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testEmptyObjectPasses() { + public void testEmptyObjectPasses() throws ValidationException { // empty object final var schema = EmptyDependents.EmptyDependents1.getInstance(); schema.validate( @@ -29,7 +28,7 @@ public void testEmptyObjectPasses() { } @Test - public void testNonObjectIsValidPasses() { + public void testNonObjectIsValidPasses() throws ValidationException { // non-object is valid final var schema = EmptyDependents.EmptyDependents1.getInstance(); schema.validate( @@ -39,7 +38,7 @@ public void testNonObjectIsValidPasses() { } @Test - public void testObjectWithOnePropertyPasses() { + public void testObjectWithOnePropertyPasses() throws ValidationException { // object with one property final var schema = EmptyDependents.EmptyDependents1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java index 3a72a8ab282..41bd273b265 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class EnumWith0DoesNotMatchFalseTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testFloatZeroIsValidPasses() { + public void testFloatZeroIsValidPasses() throws ValidationException { // float zero is valid final var schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance(); schema.validate( @@ -37,13 +36,13 @@ public void testFalseIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIntegerZeroIsValidPasses() { + public void testIntegerZeroIsValidPasses() throws ValidationException { // integer zero is valid final var schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java index fbfeb797f7a..68149695cb4 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testTrueIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testFloatOneIsValidPasses() { + public void testFloatOneIsValidPasses() throws ValidationException { // float one is valid final var schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testFloatOneIsValidPasses() { } @Test - public void testIntegerOneIsValidPasses() { + public void testIntegerOneIsValidPasses() throws ValidationException { // integer one is valid final var schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java index 1b2fd92ec8e..824c69b9e52 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testAnotherStringIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testMember2IsValidPasses() { + public void testMember2IsValidPasses() throws ValidationException { // member 2 is valid final var schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testMember2IsValidPasses() { } @Test - public void testMember1IsValidPasses() { + public void testMember1IsValidPasses() throws ValidationException { // member 1 is valid final var schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java index 4737d1537ac..2ebf7b16a0b 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testFloatZeroIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testFalseIsValidPasses() { + public void testFalseIsValidPasses() throws ValidationException { // false is valid final var schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance(); schema.validate( @@ -52,7 +51,7 @@ public void testIntegerZeroIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java index 183135f6f0f..126722f76af 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testFloatOneIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -42,13 +41,13 @@ public void testIntegerOneIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testTrueIsValidPasses() { + public void testTrueIsValidPasses() throws ValidationException { // true is valid final var schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java index 0917720a711..6ae3209d9ab 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,7 +35,7 @@ public void testWrongBarValueFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -60,7 +59,7 @@ public void testWrongFooValueFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -76,13 +75,13 @@ public void testMissingAllPropertiesIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testBothPropertiesAreValidPasses() { + public void testBothPropertiesAreValidPasses() throws ValidationException { // both properties are valid final var schema = EnumsInProperties.EnumsInProperties1.getInstance(); schema.validate( @@ -101,7 +100,7 @@ public void testBothPropertiesAreValidPasses() { } @Test - public void testMissingOptionalPropertyIsValidPasses() { + public void testMissingOptionalPropertyIsValidPasses() throws ValidationException { // missing optional property is valid final var schema = EnumsInProperties.EnumsInProperties1.getInstance(); schema.validate( @@ -130,7 +129,7 @@ public void testMissingRequiredPropertyIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.java index 75d75903a94..f83179be9f4 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ExclusivemaximumValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBelowTheExclusivemaximumIsValidPasses() { + public void testBelowTheExclusivemaximumIsValidPasses() throws ValidationException { // below the exclusiveMaximum is valid final var schema = ExclusivemaximumValidation.ExclusivemaximumValidation1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testBelowTheExclusivemaximumIsValidPasses() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException { // ignores non-numbers final var schema = ExclusivemaximumValidation.ExclusivemaximumValidation1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testAboveTheExclusivemaximumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -62,7 +61,7 @@ public void testBoundaryPointIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.java index eb62a7feebe..265482a812a 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testBelowTheExclusiveminimumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAboveTheExclusiveminimumIsValidPasses() { + public void testAboveTheExclusiveminimumIsValidPasses() throws ValidationException { // above the exclusiveMinimum is valid final var schema = ExclusiveminimumValidation.ExclusiveminimumValidation1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testAboveTheExclusiveminimumIsValidPasses() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException { // ignores non-numbers final var schema = ExclusiveminimumValidation.ExclusiveminimumValidation1.getInstance(); schema.validate( @@ -62,7 +61,7 @@ public void testBoundaryPointIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.java index d2ad415a2c3..33d5b5155ce 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testAlwaysInvalidButNaiveImplementationsMayRaiseAnOverflowErrorFails configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java index 82ee3dc86a9..f4abf2a98e7 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,13 +35,13 @@ public void testPropertyPresentFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testPropertyAbsentPasses() { + public void testPropertyAbsentPasses() throws ValidationException { // property absent final var schema = ForbiddenProperty.ForbiddenProperty1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java index f167c9594d6..d60fec65aea 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class HostnameFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testInvalidHostnameStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidHostnameStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid hostname string is only an annotation by default final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testInvalidHostnameStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.java index 4e0875a4d26..f4d18eacb63 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class IdnEmailFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = IdnEmailFormat.IdnEmailFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = IdnEmailFormat.IdnEmailFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = IdnEmailFormat.IdnEmailFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = IdnEmailFormat.IdnEmailFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testInvalidIdnEmailStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidIdnEmailStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid idn-email string is only an annotation by default final var schema = IdnEmailFormat.IdnEmailFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testInvalidIdnEmailStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = IdnEmailFormat.IdnEmailFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = IdnEmailFormat.IdnEmailFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.java index 92f2d7805db..577d58e5260 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class IdnHostnameFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testInvalidIdnHostnameStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidIdnHostnameStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid idn-hostname string is only an annotation by default final var schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testInvalidIdnHostnameStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.java index 20a7dbdd4c7..72898162d8e 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class IfAndElseWithoutThenTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testValidWhenIfTestPassesPasses() { + public void testValidWhenIfTestPassesPasses() throws ValidationException { // valid when if test passes final var schema = IfAndElseWithoutThen.IfAndElseWithoutThen1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testValidWhenIfTestPassesPasses() { } @Test - public void testValidThroughElsePasses() { + public void testValidThroughElsePasses() throws ValidationException { // valid through else final var schema = IfAndElseWithoutThen.IfAndElseWithoutThen1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testInvalidThroughElseFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.java index 82af8c41e6f..9e62b44648d 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class IfAndThenWithoutElseTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testValidThroughThenPasses() { + public void testValidThroughThenPasses() throws ValidationException { // valid through then final var schema = IfAndThenWithoutElse.IfAndThenWithoutElse1.getInstance(); schema.validate( @@ -37,13 +36,13 @@ public void testInvalidThroughThenFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidWhenIfTestFailsPasses() { + public void testValidWhenIfTestFailsPasses() throws ValidationException { // valid when if test fails final var schema = IfAndThenWithoutElse.IfAndThenWithoutElse1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.java index 56fd99e69bc..1237406e198 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testInvalidRedirectsToElseAndFailsFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testYesRedirectsToThenAndPassesPasses() { + public void testYesRedirectsToThenAndPassesPasses() throws ValidationException { // yes redirects to then and passes final var schema = IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testYesRedirectsToThenAndPassesPasses() { } @Test - public void testOtherRedirectsToElseAndPassesPasses() { + public void testOtherRedirectsToElseAndPassesPasses() throws ValidationException { // other redirects to else and passes final var schema = IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1.getInstance(); schema.validate( @@ -62,7 +61,7 @@ public void testNoRedirectsToThenAndFailsFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.java index 7f7c1fca73b..c840f937ff5 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class IgnoreElseWithoutIfTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testValidWhenInvalidAgainstLoneElsePasses() { + public void testValidWhenInvalidAgainstLoneElsePasses() throws ValidationException { // valid when invalid against lone else final var schema = IgnoreElseWithoutIf.IgnoreElseWithoutIf1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testValidWhenInvalidAgainstLoneElsePasses() { } @Test - public void testValidWhenValidAgainstLoneElsePasses() { + public void testValidWhenValidAgainstLoneElsePasses() throws ValidationException { // valid when valid against lone else final var schema = IgnoreElseWithoutIf.IgnoreElseWithoutIf1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.java index 562794f036d..182952547c9 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class IgnoreIfWithoutThenOrElseTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testValidWhenInvalidAgainstLoneIfPasses() { + public void testValidWhenInvalidAgainstLoneIfPasses() throws ValidationException { // valid when invalid against lone if final var schema = IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testValidWhenInvalidAgainstLoneIfPasses() { } @Test - public void testValidWhenValidAgainstLoneIfPasses() { + public void testValidWhenValidAgainstLoneIfPasses() throws ValidationException { // valid when valid against lone if final var schema = IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.java index 71df12e95fb..df38e3dbd08 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class IgnoreThenWithoutIfTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testValidWhenValidAgainstLoneThenPasses() { + public void testValidWhenValidAgainstLoneThenPasses() throws ValidationException { // valid when valid against lone then final var schema = IgnoreThenWithoutIf.IgnoreThenWithoutIf1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testValidWhenValidAgainstLoneThenPasses() { } @Test - public void testValidWhenInvalidAgainstLoneThenPasses() { + public void testValidWhenInvalidAgainstLoneThenPasses() throws ValidationException { // valid when invalid against lone then final var schema = IgnoreThenWithoutIf.IgnoreThenWithoutIf1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java index 9bd3fc054a5..4feb92f8419 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -28,7 +27,7 @@ public void testAnObjectIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -44,7 +43,7 @@ public void testAnArrayIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -59,13 +58,13 @@ public void testNullIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAFloatWithZeroFractionalPartIsAnIntegerPasses() { + public void testAFloatWithZeroFractionalPartIsAnIntegerPasses() throws ValidationException { // a float with zero fractional part is an integer final var schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance(); schema.validate( @@ -84,7 +83,7 @@ public void testABooleanIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -99,7 +98,7 @@ public void testAStringIsStillNotAnIntegerEvenIfItLooksLikeOneFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -114,13 +113,13 @@ public void testAStringIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAnIntegerIsAnIntegerPasses() { + public void testAnIntegerIsAnIntegerPasses() throws ValidationException { // an integer is an integer final var schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance(); schema.validate( @@ -139,7 +138,7 @@ public void testAFloatIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java index c0f957ce8ae..ea0360a448f 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class Ipv4FormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testInvalidIpv4StringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidIpv4StringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid ipv4 string is only an annotation by default final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testInvalidIpv4StringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java index b1590f23ed1..e8048a31bc2 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class Ipv6FormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testInvalidIpv6StringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidIpv6StringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid ipv6 string is only an annotation by default final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testInvalidIpv6StringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IriFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IriFormatTest.java index ce6298686e6..9974ad6f161 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IriFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IriFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class IriFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = IriFormat.IriFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = IriFormat.IriFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = IriFormat.IriFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = IriFormat.IriFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testInvalidIriStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidIriStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid iri string is only an annotation by default final var schema = IriFormat.IriFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testInvalidIriStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = IriFormat.IriFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = IriFormat.IriFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.java index d03b045f865..6e93ea9fbd4 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class IriReferenceFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = IriReferenceFormat.IriReferenceFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = IriReferenceFormat.IriReferenceFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = IriReferenceFormat.IriReferenceFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testInvalidIriReferenceStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidIriReferenceStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid iri-reference string is only an annotation by default final var schema = IriReferenceFormat.IriReferenceFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testInvalidIriReferenceStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = IriReferenceFormat.IriReferenceFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = IriReferenceFormat.IriReferenceFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = IriReferenceFormat.IriReferenceFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.java index b02893f164c..e8a60941cbd 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -31,7 +30,7 @@ public void testMatchesItemsDoesNotMatchContainsFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -49,7 +48,7 @@ public void testMatchesNeitherItemsNorContainsFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -68,13 +67,13 @@ public void testDoesNotMatchItemsMatchesContainsFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testMatchesBothItemsAndContainsPasses() { + public void testMatchesBothItemsAndContainsPasses() throws ValidationException { // matches both items and contains final var schema = ItemsContains.ItemsContains1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.java index 9a8df4453bf..4d3ca7c8e9b 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ItemsDoesNotLookInApplicatorsValidCaseTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPrefixitemsInAllofDoesNotConstrainItemsValidCasePasses() { + public void testPrefixitemsInAllofDoesNotConstrainItemsValidCasePasses() throws ValidationException { // prefixItems in allOf does not constrain items, valid case final var schema = ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1.getInstance(); schema.validate( @@ -45,7 +44,7 @@ public void testPrefixitemsInAllofDoesNotConstrainItemsInvalidCaseFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.java index 5f08a2d94e1..3ad346560b5 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ItemsWithNullInstanceElementsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllowsNullElementsPasses() { + public void testAllowsNullElementsPasses() throws ValidationException { // allows null elements final var schema = ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java index c867562c92f..ed61871f3d4 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class JsonPointerFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testInvalidJsonPointerStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidJsonPointerStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid json-pointer string is only an annotation by default final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testInvalidJsonPointerStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -48,7 +47,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.java index fa18e2ce1ba..441a08def86 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MaxcontainsWithoutContainsIsIgnoredTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testTwoItemsStillValidAgainstLoneMaxcontainsPasses() { + public void testTwoItemsStillValidAgainstLoneMaxcontainsPasses() throws ValidationException { // two items still valid against lone maxContains final var schema = MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1.getInstance(); schema.validate( @@ -31,7 +30,7 @@ public void testTwoItemsStillValidAgainstLoneMaxcontainsPasses() { } @Test - public void testOneItemValidAgainstLoneMaxcontainsPasses() { + public void testOneItemValidAgainstLoneMaxcontainsPasses() throws ValidationException { // one item valid against lone maxContains final var schema = MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java index 060e7cbe47c..b1dff24361b 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testAboveTheMaximumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testBoundaryPointIsValidPasses() { + public void testBoundaryPointIsValidPasses() throws ValidationException { // boundary point is valid final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testBoundaryPointIsValidPasses() { } @Test - public void testBelowTheMaximumIsValidPasses() { + public void testBelowTheMaximumIsValidPasses() throws ValidationException { // below the maximum is valid final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testBelowTheMaximumIsValidPasses() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException { // ignores non-numbers final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java index 7de1376dc82..cb8878f3a0b 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testAboveTheMaximumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testBelowTheMaximumIsInvalidPasses() { + public void testBelowTheMaximumIsInvalidPasses() throws ValidationException { // below the maximum is invalid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testBelowTheMaximumIsInvalidPasses() { } @Test - public void testBoundaryPointIntegerIsValidPasses() { + public void testBoundaryPointIntegerIsValidPasses() throws ValidationException { // boundary point integer is valid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testBoundaryPointIntegerIsValidPasses() { } @Test - public void testBoundaryPointFloatIsValidPasses() { + public void testBoundaryPointFloatIsValidPasses() throws ValidationException { // boundary point float is valid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java index f44118876b0..d3f0f0840f7 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MaxitemsValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() { + public void testShorterIsValidPasses() throws ValidationException { // shorter is valid final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( @@ -30,7 +29,7 @@ public void testShorterIsValidPasses() { } @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( @@ -56,13 +55,13 @@ public void testTooLongIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresNonArraysPasses() { + public void testIgnoresNonArraysPasses() throws ValidationException { // ignores non-arrays final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java index 441f220cf30..85afd54340c 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MaxlengthValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() { + public void testShorterIsValidPasses() throws ValidationException { // shorter is valid final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testShorterIsValidPasses() { } @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -47,13 +46,13 @@ public void testTooLongIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresNonStringsPasses() { + public void testIgnoresNonStringsPasses() throws ValidationException { // ignores non-strings final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -63,7 +62,7 @@ public void testIgnoresNonStringsPasses() { } @Test - public void testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() { + public void testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() throws ValidationException { // two supplementary Unicode code points is long enough final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java index 203eab6db9a..677ee68f23c 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -32,13 +31,13 @@ public void testOnePropertyIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNoPropertiesIsValidPasses() { + public void testNoPropertiesIsValidPasses() throws ValidationException { // no properties is valid final var schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java index f0fae897e64..3dfdc1f8f4a 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MaxpropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() { + public void testShorterIsValidPasses() throws ValidationException { // shorter is valid final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testShorterIsValidPasses() { } @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -74,13 +73,13 @@ public void testTooLongIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -90,7 +89,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -104,7 +103,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException { // ignores strings final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.java index c91681b39bc..aac3d8ea3b2 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MincontainsWithoutContainsIsIgnoredTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testOneItemValidAgainstLoneMincontainsPasses() { + public void testOneItemValidAgainstLoneMincontainsPasses() throws ValidationException { // one item valid against lone minContains final var schema = MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1.getInstance(); schema.validate( @@ -30,7 +29,7 @@ public void testOneItemValidAgainstLoneMincontainsPasses() { } @Test - public void testZeroItemsStillValidAgainstLoneMincontainsPasses() { + public void testZeroItemsStillValidAgainstLoneMincontainsPasses() throws ValidationException { // zero items still valid against lone minContains final var schema = MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java index 938de6c0c23..f56d91c9459 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MinimumValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBoundaryPointIsValidPasses() { + public void testBoundaryPointIsValidPasses() throws ValidationException { // boundary point is valid final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( @@ -37,13 +36,13 @@ public void testBelowTheMinimumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException { // ignores non-numbers final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testIgnoresNonNumbersPasses() { } @Test - public void testAboveTheMinimumIsValidPasses() { + public void testAboveTheMinimumIsValidPasses() throws ValidationException { // above the minimum is valid final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java index e5252c6c48a..1f8d353e533 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MinimumValidationWithSignedIntegerTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBoundaryPointWithFloatIsValidPasses() { + public void testBoundaryPointWithFloatIsValidPasses() throws ValidationException { // boundary point with float is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testBoundaryPointWithFloatIsValidPasses() { } @Test - public void testBoundaryPointIsValidPasses() { + public void testBoundaryPointIsValidPasses() throws ValidationException { // boundary point is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -47,13 +46,13 @@ public void testIntBelowTheMinimumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testPositiveAboveTheMinimumIsValidPasses() { + public void testPositiveAboveTheMinimumIsValidPasses() throws ValidationException { // positive above the minimum is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -63,7 +62,7 @@ public void testPositiveAboveTheMinimumIsValidPasses() { } @Test - public void testNegativeAboveTheMinimumIsValidPasses() { + public void testNegativeAboveTheMinimumIsValidPasses() throws ValidationException { // negative above the minimum is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -73,7 +72,7 @@ public void testNegativeAboveTheMinimumIsValidPasses() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException { // ignores non-numbers final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -92,7 +91,7 @@ public void testFloatBelowTheMinimumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java index fe973599a5f..64106617015 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MinitemsValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( @@ -30,7 +29,7 @@ public void testExactLengthIsValidPasses() { } @Test - public void testIgnoresNonArraysPasses() { + public void testIgnoresNonArraysPasses() throws ValidationException { // ignores non-arrays final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( @@ -40,7 +39,7 @@ public void testIgnoresNonArraysPasses() { } @Test - public void testLongerIsValidPasses() { + public void testLongerIsValidPasses() throws ValidationException { // longer is valid final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( @@ -63,7 +62,7 @@ public void testTooShortIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java index 8a0b2faf8f5..07b264a5c82 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MinlengthValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testExactLengthIsValidPasses() { } @Test - public void testLongerIsValidPasses() { + public void testLongerIsValidPasses() throws ValidationException { // longer is valid final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testLongerIsValidPasses() { } @Test - public void testIgnoresNonStringsPasses() { + public void testIgnoresNonStringsPasses() throws ValidationException { // ignores non-strings final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( @@ -57,7 +56,7 @@ public void testTooShortIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -72,7 +71,7 @@ public void testOneSupplementaryUnicodeCodePointIsNotLongEnoughFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java index 109b3b7fbfd..172344eb28b 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MinpropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testExactLengthIsValidPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testLongerIsValidPasses() { + public void testLongerIsValidPasses() throws ValidationException { // longer is valid final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -62,7 +61,7 @@ public void testLongerIsValidPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -83,13 +82,13 @@ public void testTooShortIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException { // ignores strings final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.java index bb9842bf28e..c10084aa744 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MultipleDependentsRequiredTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNondependantsPasses() { + public void testNondependantsPasses() throws ValidationException { // nondependants final var schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance(); schema.validate( @@ -55,13 +54,13 @@ public void testMissingOtherDependencyFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testWithDependenciesPasses() { + public void testWithDependenciesPasses() throws ValidationException { // with dependencies final var schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance(); schema.validate( @@ -98,7 +97,7 @@ public void testMissingBothDependenciesFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -122,13 +121,13 @@ public void testMissingDependencyFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNeitherPasses() { + public void testNeitherPasses() throws ValidationException { // neither final var schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.java index 1c9e027bdf5..dfb21c061a1 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MultipleSimultaneousPatternpropertiesAreValidatedTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testASimultaneousMatchIsValidPasses() { + public void testASimultaneousMatchIsValidPasses() throws ValidationException { // a simultaneous match is valid final var schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testASimultaneousMatchIsValidPasses() { } @Test - public void testASingleValidMatchIsValidPasses() { + public void testASingleValidMatchIsValidPasses() throws ValidationException { // a single valid match is valid final var schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance(); schema.validate( @@ -62,13 +61,13 @@ public void testAnInvalidDueToTheOtherIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testMultipleMatchesIsValidPasses() { + public void testMultipleMatchesIsValidPasses() throws ValidationException { // multiple matches is valid final var schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance(); schema.validate( @@ -101,7 +100,7 @@ public void testAnInvalidDueToOneIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -125,7 +124,7 @@ public void testAnInvalidDueToBothIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.java index b50de8841f1..3fce40e3a6c 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testNullIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAnIntegerIsValidPasses() { + public void testAnIntegerIsValidPasses() throws ValidationException { // an integer is valid final var schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testAnArrayIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -68,7 +67,7 @@ public void testABooleanIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -83,13 +82,13 @@ public void testAFloatIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAStringIsValidPasses() { + public void testAStringIsValidPasses() throws ValidationException { // a string is valid final var schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance(); schema.validate( @@ -109,7 +108,7 @@ public void testAnObjectIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java index 7f0e5197f48..5495226a1ba 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NestedAllofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() { + public void testNullIsValidPasses() throws ValidationException { // null is valid final var schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testAnythingNonNullIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java index 40c68fea595..ef87267b15b 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NestedAnyofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() { + public void testNullIsValidPasses() throws ValidationException { // null is valid final var schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testAnythingNonNullIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java index a730cd66895..40475304a3d 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -56,7 +55,7 @@ public void testNestedArrayWithInvalidTypeFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -94,13 +93,13 @@ public void testNotDeepEnoughFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidNestedArrayPasses() { + public void testValidNestedArrayPasses() throws ValidationException { // valid nested array final var schema = NestedItems.NestedItems1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java index e16c8bc3373..9fe66b0503e 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NestedOneofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() { + public void testNullIsValidPasses() throws ValidationException { // null is valid final var schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testAnythingNonNullIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.java index b4ca44fbe2a..1e77b7151fc 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -32,13 +31,13 @@ public void testNotMatchingThePatternIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testMatchingThePatternIsValidPasses() { + public void testMatchingThePatternIsValidPasses() throws ValidationException { // matching the pattern is valid final var schema = NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.java index 7e1b206bd0e..aca45a9f49e 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NonInterferenceAcrossCombinedSchemasTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testValidButWouldHaveBeenInvalidThroughElsePasses() { + public void testValidButWouldHaveBeenInvalidThroughElsePasses() throws ValidationException { // valid, but would have been invalid through else final var schema = NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testValidButWouldHaveBeenInvalidThroughElsePasses() { } @Test - public void testValidButWouldHaveBeenInvalidThroughThenPasses() { + public void testValidButWouldHaveBeenInvalidThroughThenPasses() throws ValidationException { // valid, but would have been invalid through then final var schema = NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java index d3fbe75257c..bbfe9858805 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NotMoreComplexSchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testOtherMatchPasses() { + public void testOtherMatchPasses() throws ValidationException { // other match final var schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance(); schema.validate( @@ -47,13 +46,13 @@ public void testMismatchFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testMatchPasses() { + public void testMatchPasses() throws ValidationException { // match final var schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.java index 58529b886fe..25763e3b907 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testOtherMismatchFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidPasses() { + public void testValidPasses() throws ValidationException { // valid final var schema = NotMultipleTypes.NotMultipleTypes1.getInstance(); schema.validate( @@ -52,7 +51,7 @@ public void testMismatchFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java index bc2bc52984c..ab90c86cd0f 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testDisallowedFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAllowedPasses() { + public void testAllowedPasses() throws ValidationException { // allowed final var schema = Not.Not1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java index fb754a14c5f..ebb974de6e5 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NulCharactersInStringsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMatchStringWithNulPasses() { + public void testMatchStringWithNulPasses() throws ValidationException { // match string with nul final var schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testDoNotMatchStringLackingNulFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java index 637d7878b59..a45c6ec610b 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testZeroIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -43,7 +42,7 @@ public void testAnArrayIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -59,7 +58,7 @@ public void testAnObjectIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -74,7 +73,7 @@ public void testTrueIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -89,13 +88,13 @@ public void testFalseIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNullIsNullPasses() { + public void testNullIsNullPasses() throws ValidationException { // null is null final var schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance(); schema.validate( @@ -114,7 +113,7 @@ public void testAStringIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -129,7 +128,7 @@ public void testAnIntegerIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -144,7 +143,7 @@ public void testAnEmptyStringIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -159,7 +158,7 @@ public void testAFloatIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java index 7158fd026db..ff6e9d37dce 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NumberTypeMatchesNumbersTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAFloatIsANumberPasses() { + public void testAFloatIsANumberPasses() throws ValidationException { // a float is a number final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAFloatIsANumberPasses() { } @Test - public void testAnIntegerIsANumberPasses() { + public void testAnIntegerIsANumberPasses() throws ValidationException { // an integer is a number final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testAStringIsStillNotANumberEvenIfItLooksLikeOneFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -62,13 +61,13 @@ public void testABooleanIsNotANumberFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() { + public void testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() throws ValidationException { // a float with zero fractional part is a number (and an integer) final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( @@ -87,7 +86,7 @@ public void testNullIsNotANumberFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -102,7 +101,7 @@ public void testAStringIsNotANumberFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -118,7 +117,7 @@ public void testAnArrayIsNotANumberFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -134,7 +133,7 @@ public void testAnObjectIsNotANumberFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java index 46aef85c136..49a367ac58d 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ObjectPropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBothPropertiesPresentAndValidIsValidPasses() { + public void testBothPropertiesPresentAndValidIsValidPasses() throws ValidationException { // both properties present and valid is valid final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testBothPropertiesPresentAndValidIsValidPasses() { } @Test - public void testDoesnTInvalidateOtherPropertiesPasses() { + public void testDoesnTInvalidateOtherPropertiesPasses() throws ValidationException { // doesn't invalidate other properties final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testDoesnTInvalidateOtherPropertiesPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -83,13 +82,13 @@ public void testBothPropertiesInvalidIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -119,7 +118,7 @@ public void testOnePropertyInvalidIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java index 0d4f932b859..85587d1cd10 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ObjectTypeMatchesObjectsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnObjectIsAnObjectPasses() { + public void testAnObjectIsAnObjectPasses() throws ValidationException { // an object is an object final var schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance(); schema.validate( @@ -39,7 +38,7 @@ public void testAnArrayIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -54,7 +53,7 @@ public void testAnIntegerIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -69,7 +68,7 @@ public void testABooleanIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -84,7 +83,7 @@ public void testAStringIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -99,7 +98,7 @@ public void testAFloatIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -114,7 +113,7 @@ public void testNullIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java index 46cabdaf335..e94f9277dce 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class OneofComplexTypesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testSecondOneofValidComplexPasses() { + public void testSecondOneofValidComplexPasses() throws ValidationException { // second oneOf valid (complex) final var schema = OneofComplexTypes.OneofComplexTypes1.getInstance(); schema.validate( @@ -51,13 +50,13 @@ public void testBothOneofValidComplexFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testFirstOneofValidComplexPasses() { + public void testFirstOneofValidComplexPasses() throws ValidationException { // first oneOf valid (complex) final var schema = OneofComplexTypes.OneofComplexTypes1.getInstance(); schema.validate( @@ -90,7 +89,7 @@ public void testNeitherOneofValidComplexFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java index 4aafad49183..50252968f84 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testBothOneofValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -42,13 +41,13 @@ public void testNeitherOneofValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testSecondOneofValidPasses() { + public void testSecondOneofValidPasses() throws ValidationException { // second oneOf valid final var schema = Oneof.Oneof1.getInstance(); schema.validate( @@ -58,7 +57,7 @@ public void testSecondOneofValidPasses() { } @Test - public void testFirstOneofValidPasses() { + public void testFirstOneofValidPasses() throws ValidationException { // first oneOf valid final var schema = Oneof.Oneof1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java index 2dfe72cd7fa..ea57fe7c2bd 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testMismatchBaseSchemaFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testOneOneofValidPasses() { + public void testOneOneofValidPasses() throws ValidationException { // one oneOf valid final var schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance(); schema.validate( @@ -52,7 +51,7 @@ public void testBothOneofValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java index 4500ca75474..5113d359187 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class OneofWithEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testOneValidValidPasses() { + public void testOneValidValidPasses() throws ValidationException { // one valid - valid final var schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testBothValidInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java index fed6deab27e..db5b73fd386 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class OneofWithRequiredTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testFirstValidValidPasses() { + public void testFirstValidValidPasses() throws ValidationException { // first valid - valid final var schema = OneofWithRequired.OneofWithRequired1.getInstance(); schema.validate( @@ -59,13 +58,13 @@ public void testBothValidInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testSecondValidValidPasses() { + public void testSecondValidValidPasses() throws ValidationException { // second valid - valid final var schema = OneofWithRequired.OneofWithRequired1.getInstance(); schema.validate( @@ -98,7 +97,7 @@ public void testBothInvalidInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java index 70153cd7cb5..0f3306d9ed7 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PatternIsNotAnchoredTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMatchesASubstringPasses() { + public void testMatchesASubstringPasses() throws ValidationException { // matches a substring final var schema = PatternIsNotAnchored.PatternIsNotAnchored1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java index fc5ff8000e3..b9cbe91112a 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PatternValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testIgnoresBooleansPasses() { + public void testIgnoresBooleansPasses() throws ValidationException { // ignores booleans final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testIgnoresBooleansPasses() { } @Test - public void testIgnoresFloatsPasses() { + public void testIgnoresFloatsPasses() throws ValidationException { // ignores floats final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -47,13 +46,13 @@ public void testANonMatchingPatternIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresIntegersPasses() { + public void testIgnoresIntegersPasses() throws ValidationException { // ignores integers final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -63,7 +62,7 @@ public void testIgnoresIntegersPasses() { } @Test - public void testAMatchingPatternIsValidPasses() { + public void testAMatchingPatternIsValidPasses() throws ValidationException { // a matching pattern is valid final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -73,7 +72,7 @@ public void testAMatchingPatternIsValidPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -84,7 +83,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testIgnoresObjectsPasses() { + public void testIgnoresObjectsPasses() throws ValidationException { // ignores objects final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -95,7 +94,7 @@ public void testIgnoresObjectsPasses() { } @Test - public void testIgnoresNullPasses() { + public void testIgnoresNullPasses() throws ValidationException { // ignores null final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.java index 0a067911bbc..46e86960311 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,13 +35,13 @@ public void testMultipleInvalidMatchesIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testASingleValidMatchIsValidPasses() { + public void testASingleValidMatchIsValidPasses() throws ValidationException { // a single valid match is valid final var schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance(); schema.validate( @@ -57,7 +56,7 @@ public void testASingleValidMatchIsValidPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance(); schema.validate( @@ -85,13 +84,13 @@ public void testASingleInvalidMatchIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testMultipleValidMatchesIsValidPasses() { + public void testMultipleValidMatchesIsValidPasses() throws ValidationException { // multiple valid matches is valid final var schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance(); schema.validate( @@ -110,7 +109,7 @@ public void testMultipleValidMatchesIsValidPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance(); schema.validate( @@ -122,7 +121,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException { // ignores strings final var schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.java index a431b4e7e78..8dcbd5f0bf5 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PatternpropertiesWithNullValuedInstancePropertiesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllowsNullValuesPasses() { + public void testAllowsNullValuesPasses() throws ValidationException { // allows null values final var schema = PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.java index 46f31690d6f..0a3bb0b2be0 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PrefixitemsValidationAdjustsTheStartingIndexForItemsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testValidItemsPasses() { + public void testValidItemsPasses() throws ValidationException { // valid items final var schema = PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testWrongTypeOfSecondItemFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.java index 50a6ac70f42..6cd65892ebf 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PrefixitemsWithNullInstanceElementsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllowsNullElementsPasses() { + public void testAllowsNullElementsPasses() throws ValidationException { // allows null elements final var schema = PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.java index ecdcb7e6268..67849f0c820 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PropertiesPatternpropertiesAdditionalpropertiesInteractionTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyValidatesPropertyPasses() { + public void testPropertyValidatesPropertyPasses() throws ValidationException { // property validates property final var schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance(); schema.validate( @@ -36,7 +35,7 @@ public void testPropertyValidatesPropertyPasses() { } @Test - public void testAdditionalpropertyIgnoresPropertyPasses() { + public void testAdditionalpropertyIgnoresPropertyPasses() throws ValidationException { // additionalProperty ignores property final var schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance(); schema.validate( @@ -67,13 +66,13 @@ public void testPatternpropertyInvalidatesPropertyFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testPatternpropertyValidatesNonpropertyPasses() { + public void testPatternpropertyValidatesNonpropertyPasses() throws ValidationException { // patternProperty validates nonproperty final var schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance(); schema.validate( @@ -106,7 +105,7 @@ public void testPatternpropertyInvalidatesNonpropertyFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -131,7 +130,7 @@ public void testPropertyInvalidatesPropertyFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -151,13 +150,13 @@ public void testAdditionalpropertyInvalidatesOthersFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAdditionalpropertyValidatesOthersPasses() { + public void testAdditionalpropertyValidatesOthersPasses() throws ValidationException { // additionalProperty validates others final var schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java index 5ae7db6fbb5..704cd759d28 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -32,13 +31,13 @@ public void testProtoNotValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNoneOfThePropertiesMentionedPasses() { + public void testNoneOfThePropertiesMentionedPasses() throws ValidationException { // none of the properties mentioned final var schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testNoneOfThePropertiesMentionedPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testAllPresentAndValidPasses() { + public void testAllPresentAndValidPasses() throws ValidationException { // all present and valid final var schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance(); schema.validate( @@ -106,13 +105,13 @@ public void testConstructorNotValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance(); schema.validate( @@ -142,7 +141,7 @@ public void testTostringNotValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java index d394de1e6ed..9708c6d0a96 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PropertiesWithEscapedCharactersTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testObjectWithAllNumbersIsValidPasses() { + public void testObjectWithAllNumbersIsValidPasses() throws ValidationException { // object with all numbers is valid final var schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance(); schema.validate( @@ -87,7 +86,7 @@ public void testObjectWithStringsIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.java index eb959c34b43..07a7cdaa79c 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PropertiesWithNullValuedInstancePropertiesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllowsNullValuesPasses() { + public void testAllowsNullValuesPasses() throws ValidationException { // allows null values final var schema = PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java index 70412b8ca3f..3daa2b69f6f 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PropertyNamedRefThatIsNotAReferenceTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException { // property named $ref valid final var schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testPropertyNamedRefInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.java index bad349bb35b..b878c02399c 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -38,13 +37,13 @@ public void testSomePropertyNamesInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = PropertynamesValidation.PropertynamesValidation1.getInstance(); schema.validate( @@ -54,7 +53,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testAllPropertyNamesValidPasses() { + public void testAllPropertyNamesValidPasses() throws ValidationException { // all property names valid final var schema = PropertynamesValidation.PropertynamesValidation1.getInstance(); schema.validate( @@ -75,7 +74,7 @@ public void testAllPropertyNamesValidPasses() { } @Test - public void testObjectWithoutPropertiesIsValidPasses() { + public void testObjectWithoutPropertiesIsValidPasses() throws ValidationException { // object without properties is valid final var schema = PropertynamesValidation.PropertynamesValidation1.getInstance(); schema.validate( @@ -86,7 +85,7 @@ public void testObjectWithoutPropertiesIsValidPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = PropertynamesValidation.PropertynamesValidation1.getInstance(); schema.validate( @@ -101,7 +100,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException { // ignores strings final var schema = PropertynamesValidation.PropertynamesValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RegexFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RegexFormatTest.java index 60297e52c35..37ebc7e67ba 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RegexFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RegexFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RegexFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = RegexFormat.RegexFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = RegexFormat.RegexFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = RegexFormat.RegexFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testInvalidRegexStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidRegexStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid regex string is only an annotation by default final var schema = RegexFormat.RegexFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testInvalidRegexStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = RegexFormat.RegexFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = RegexFormat.RegexFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = RegexFormat.RegexFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.java index 89c540b0451..94caaa2f2bb 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testRegexesAreCaseSensitivePasses() { + public void testRegexesAreCaseSensitivePasses() throws ValidationException { // regexes are case sensitive final var schema = RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testRegexesAreCaseSensitivePasses() { } @Test - public void testNonRecognizedMembersAreIgnoredPasses() { + public void testNonRecognizedMembersAreIgnoredPasses() throws ValidationException { // non recognized members are ignored final var schema = RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1.getInstance(); schema.validate( @@ -62,7 +61,7 @@ public void testRecognizedMembersAreAccountedForFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -82,7 +81,7 @@ public void testRegexesAreCaseSensitive2Fails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.java index 021823aeab4..02cfc5fd51f 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RelativeJsonPointerFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testInvalidRelativeJsonPointerStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidRelativeJsonPointerStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid relative-json-pointer string is only an annotation by default final var schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testInvalidRelativeJsonPointerStringIsOnlyAnAnnotationByDefaultPasse } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance(); schema.validate( @@ -48,7 +47,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java index b439c59a44b..f02f348d3c7 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RequiredDefaultValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNotRequiredByDefaultPasses() { + public void testNotRequiredByDefaultPasses() throws ValidationException { // not required by default final var schema = RequiredDefaultValidation.RequiredDefaultValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java index bef2129ecee..006ab9e96c4 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -37,7 +36,7 @@ public void testTostringPresentFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -53,13 +52,13 @@ public void testNoneOfThePropertiesMentionedFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance(); schema.validate( @@ -88,13 +87,13 @@ public void testConstructorPresentFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAllPresentPasses() { + public void testAllPresentPasses() throws ValidationException { // all present final var schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance(); schema.validate( @@ -136,13 +135,13 @@ public void testProtoPresentFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java index 3757ebf8c49..6c3326cf9eb 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RequiredValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPresentRequiredPropertyIsValidPasses() { + public void testPresentRequiredPropertyIsValidPasses() throws ValidationException { // present required property is valid final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testPresentRequiredPropertyIsValidPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -54,7 +53,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException { // ignores strings final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -78,7 +77,7 @@ public void testNonPresentRequiredPropertyIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java index d6a8add1e4c..ab0c3b23704 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RequiredWithEmptyArrayTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNotRequiredPasses() { + public void testPropertyNotRequiredPasses() throws ValidationException { // property not required final var schema = RequiredWithEmptyArray.RequiredWithEmptyArray1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java index a2c05a6f22e..4d0f295d05a 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,13 +35,13 @@ public void testObjectWithSomePropertiesMissingIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testObjectWithAllPropertiesPresentIsValidPasses() { + public void testObjectWithAllPropertiesPresentIsValidPasses() throws ValidationException { // object with all properties present is valid final var schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java index 53f95f8e48e..26dda5efa38 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testSomethingElseIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testOneOfTheEnumIsValidPasses() { + public void testOneOfTheEnumIsValidPasses() throws ValidationException { // one of the enum is valid final var schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.java index 45708f65dc8..7558d84ea2e 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class SingleDependencyTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNondependantPasses() { + public void testNondependantPasses() throws ValidationException { // nondependant final var schema = SingleDependency.SingleDependency1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testNondependantPasses() { } @Test - public void testWithDependencyPasses() { + public void testWithDependencyPasses() throws ValidationException { // with dependency final var schema = SingleDependency.SingleDependency1.getInstance(); schema.validate( @@ -66,13 +65,13 @@ public void testMissingDependencyFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = SingleDependency.SingleDependency1.getInstance(); schema.validate( @@ -82,7 +81,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = SingleDependency.SingleDependency1.getInstance(); schema.validate( @@ -94,7 +93,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testNeitherPasses() { + public void testNeitherPasses() throws ValidationException { // neither final var schema = SingleDependency.SingleDependency1.getInstance(); schema.validate( @@ -105,7 +104,7 @@ public void testNeitherPasses() { } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException { // ignores strings final var schema = SingleDependency.SingleDependency1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.java index 87524c3a9bf..cf0eb86a694 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class SmallMultipleOfLargeIntegerTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnyIntegerIsAMultipleOf1E8Passes() { + public void testAnyIntegerIsAMultipleOf1E8Passes() throws ValidationException { // any integer is a multiple of 1e-8 final var schema = SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java index 226c06bc19f..af3c4c287bd 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class StringTypeMatchesStringsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() { + public void testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() throws ValidationException { // a string is still a string, even if it looks like a number final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void test1IsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -52,13 +51,13 @@ public void testABooleanIsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAnEmptyStringIsStillAStringPasses() { + public void testAnEmptyStringIsStillAStringPasses() throws ValidationException { // an empty string is still a string final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( @@ -78,7 +77,7 @@ public void testAnArrayIsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -94,7 +93,7 @@ public void testAnObjectIsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -109,13 +108,13 @@ public void testNullIsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAStringIsAStringPasses() { + public void testAStringIsAStringPasses() throws ValidationException { // a string is a string final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( @@ -134,7 +133,7 @@ public void testAFloatIsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TimeFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TimeFormatTest.java index c65029d931e..90796cbcb03 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TimeFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TimeFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class TimeFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = TimeFormat.TimeFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = TimeFormat.TimeFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = TimeFormat.TimeFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = TimeFormat.TimeFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testInvalidTimeStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidTimeStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid time string is only an annotation by default final var schema = TimeFormat.TimeFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testInvalidTimeStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = TimeFormat.TimeFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = TimeFormat.TimeFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.java index 01c47125845..ddc4912ef1f 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testNumberIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNullIsValidPasses() { + public void testNullIsValidPasses() throws ValidationException { // null is valid final var schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance(); schema.validate( @@ -52,13 +51,13 @@ public void testStringIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testArrayIsValidPasses() { + public void testArrayIsValidPasses() throws ValidationException { // array is valid final var schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance(); schema.validate( @@ -72,7 +71,7 @@ public void testArrayIsValidPasses() { } @Test - public void testObjectIsValidPasses() { + public void testObjectIsValidPasses() throws ValidationException { // object is valid final var schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.java index 9f7d0cd1bbe..2f84d222da8 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testNumberIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -42,7 +41,7 @@ public void testStringIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -57,13 +56,13 @@ public void testNullIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testArrayIsValidPasses() { + public void testArrayIsValidPasses() throws ValidationException { // array is valid final var schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance(); schema.validate( @@ -77,7 +76,7 @@ public void testArrayIsValidPasses() { } @Test - public void testObjectIsValidPasses() { + public void testObjectIsValidPasses() throws ValidationException { // object is valid final var schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.java index d705c286d13..8a4dc06bb51 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testNumberIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testStringIsValidPasses() { + public void testStringIsValidPasses() throws ValidationException { // string is valid final var schema = TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.java index 4a0003042a0..d6866eb82a2 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UnevaluateditemsAsSchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testWithValidUnevaluatedItemsPasses() { + public void testWithValidUnevaluatedItemsPasses() throws ValidationException { // with valid unevaluated items final var schema = UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1.getInstance(); schema.validate( @@ -41,13 +40,13 @@ public void testWithInvalidUnevaluatedItemsFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testWithNoUnevaluatedItemsPasses() { + public void testWithNoUnevaluatedItemsPasses() throws ValidationException { // with no unevaluated items final var schema = UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.java index 9f4d7292bfc..d594c2cc908 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -33,13 +32,13 @@ public void test7NotEvaluatedFailsUnevaluateditemsFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void test5NotEvaluatedPassesUnevaluateditemsPasses() { + public void test5NotEvaluatedPassesUnevaluateditemsPasses() throws ValidationException { // 5 not evaluated, passes unevaluatedItems final var schema = UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.java index 56d24c46e96..ecf8f79771a 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -31,13 +30,13 @@ public void testInvalidUnderItemsFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidUnderItemsPasses() { + public void testValidUnderItemsPasses() throws ValidationException { // valid under items final var schema = UnevaluateditemsWithItems.UnevaluateditemsWithItems1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java index 36e67ee7bad..5c55726383f 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UnevaluateditemsWithNullInstanceElementsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllowsNullElementsPasses() { + public void testAllowsNullElementsPasses() throws ValidationException { // allows null elements final var schema = UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.java index 2e88cbbf4e5..05efdd07b81 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UnevaluatedpropertiesNotAffectedByPropertynamesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllowsOnlyNumberPropertiesPasses() { + public void testAllowsOnlyNumberPropertiesPasses() throws ValidationException { // allows only number properties final var schema = UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testStringPropertyIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.java index d6c749cf84a..0d4c66818be 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -32,13 +31,13 @@ public void testWithInvalidUnevaluatedPropertiesFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testWithNoUnevaluatedPropertiesPasses() { + public void testWithNoUnevaluatedPropertiesPasses() throws ValidationException { // with no unevaluated properties final var schema = UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testWithNoUnevaluatedPropertiesPasses() { } @Test - public void testWithValidUnevaluatedPropertiesPasses() { + public void testWithValidUnevaluatedPropertiesPasses() throws ValidationException { // with valid unevaluated properties final var schema = UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.java index 93a72833e93..13972401d0f 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testWithAdditionalPropertiesPasses() { + public void testWithAdditionalPropertiesPasses() throws ValidationException { // with additional properties final var schema = UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testWithAdditionalPropertiesPasses() { } @Test - public void testWithNoAdditionalPropertiesPasses() { + public void testWithNoAdditionalPropertiesPasses() throws ValidationException { // with no additional properties final var schema = UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.java index de7d96f4e91..410fa197289 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UnevaluatedpropertiesWithNullValuedInstancePropertiesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllowsNullValuedPropertiesPasses() { + public void testAllowsNullValuedPropertiesPasses() throws ValidationException { // allows null valued properties final var schema = UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java index 5c0b5aaaeea..ec0b6a01bd8 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UniqueitemsFalseValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNumbersAreUniqueIfMathematicallyUnequalPasses() { + public void testNumbersAreUniqueIfMathematicallyUnequalPasses() throws ValidationException { // numbers are unique if mathematically unequal final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -32,7 +31,7 @@ public void testNumbersAreUniqueIfMathematicallyUnequalPasses() { } @Test - public void testNonUniqueArrayOfIntegersIsValidPasses() { + public void testNonUniqueArrayOfIntegersIsValidPasses() throws ValidationException { // non-unique array of integers is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -45,7 +44,7 @@ public void testNonUniqueArrayOfIntegersIsValidPasses() { } @Test - public void testNonUniqueArrayOfObjectsIsValidPasses() { + public void testNonUniqueArrayOfObjectsIsValidPasses() throws ValidationException { // non-unique array of objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -68,7 +67,7 @@ public void testNonUniqueArrayOfObjectsIsValidPasses() { } @Test - public void testNonUniqueArrayOfArraysIsValidPasses() { + public void testNonUniqueArrayOfArraysIsValidPasses() throws ValidationException { // non-unique array of arrays is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -85,7 +84,7 @@ public void testNonUniqueArrayOfArraysIsValidPasses() { } @Test - public void test1AndTrueAreUniquePasses() { + public void test1AndTrueAreUniquePasses() throws ValidationException { // 1 and true are unique final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -98,7 +97,7 @@ public void test1AndTrueAreUniquePasses() { } @Test - public void testUniqueArrayOfNestedObjectsIsValidPasses() { + public void testUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException { // unique array of nested objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -141,7 +140,7 @@ public void testUniqueArrayOfNestedObjectsIsValidPasses() { } @Test - public void testUniqueArrayOfArraysIsValidPasses() { + public void testUniqueArrayOfArraysIsValidPasses() throws ValidationException { // unique array of arrays is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -158,7 +157,7 @@ public void testUniqueArrayOfArraysIsValidPasses() { } @Test - public void testTrueIsNotEqualToOnePasses() { + public void testTrueIsNotEqualToOnePasses() throws ValidationException { // true is not equal to one final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -171,7 +170,7 @@ public void testTrueIsNotEqualToOnePasses() { } @Test - public void testNonUniqueHeterogeneousTypesAreValidPasses() { + public void testNonUniqueHeterogeneousTypesAreValidPasses() throws ValidationException { // non-unique heterogeneous types are valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -192,7 +191,7 @@ public void testNonUniqueHeterogeneousTypesAreValidPasses() { } @Test - public void testFalseIsNotEqualToZeroPasses() { + public void testFalseIsNotEqualToZeroPasses() throws ValidationException { // false is not equal to zero final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -205,7 +204,7 @@ public void testFalseIsNotEqualToZeroPasses() { } @Test - public void testUniqueArrayOfIntegersIsValidPasses() { + public void testUniqueArrayOfIntegersIsValidPasses() throws ValidationException { // unique array of integers is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -218,7 +217,7 @@ public void testUniqueArrayOfIntegersIsValidPasses() { } @Test - public void test0AndFalseAreUniquePasses() { + public void test0AndFalseAreUniquePasses() throws ValidationException { // 0 and false are unique final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -231,7 +230,7 @@ public void test0AndFalseAreUniquePasses() { } @Test - public void testUniqueHeterogeneousTypesAreValidPasses() { + public void testUniqueHeterogeneousTypesAreValidPasses() throws ValidationException { // unique heterogeneous types are valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -250,7 +249,7 @@ public void testUniqueHeterogeneousTypesAreValidPasses() { } @Test - public void testUniqueArrayOfObjectsIsValidPasses() { + public void testUniqueArrayOfObjectsIsValidPasses() throws ValidationException { // unique array of objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -273,7 +272,7 @@ public void testUniqueArrayOfObjectsIsValidPasses() { } @Test - public void testNonUniqueArrayOfNestedObjectsIsValidPasses() { + public void testNonUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException { // non-unique array of nested objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.java index f8354dbe7f9..4fb621b2bc1 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UniqueitemsFalseWithAnArrayOfItemsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testFalseFalseFromItemsArrayIsValidPasses() { + public void testFalseFalseFromItemsArrayIsValidPasses() throws ValidationException { // [false, false] from items array is valid final var schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testFalseFalseFromItemsArrayIsValidPasses() { } @Test - public void testNonUniqueArrayExtendedFromFalseTrueIsValidPasses() { + public void testNonUniqueArrayExtendedFromFalseTrueIsValidPasses() throws ValidationException { // non-unique array extended from [false, true] is valid final var schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance(); schema.validate( @@ -52,7 +51,7 @@ public void testNonUniqueArrayExtendedFromFalseTrueIsValidPasses() { } @Test - public void testTrueTrueFromItemsArrayIsValidPasses() { + public void testTrueTrueFromItemsArrayIsValidPasses() throws ValidationException { // [true, true] from items array is valid final var schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance(); schema.validate( @@ -67,7 +66,7 @@ public void testTrueTrueFromItemsArrayIsValidPasses() { } @Test - public void testUniqueArrayExtendedFromFalseTrueIsValidPasses() { + public void testUniqueArrayExtendedFromFalseTrueIsValidPasses() throws ValidationException { // unique array extended from [false, true] is valid final var schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance(); schema.validate( @@ -86,7 +85,7 @@ public void testUniqueArrayExtendedFromFalseTrueIsValidPasses() { } @Test - public void testUniqueArrayExtendedFromTrueFalseIsValidPasses() { + public void testUniqueArrayExtendedFromTrueFalseIsValidPasses() throws ValidationException { // unique array extended from [true, false] is valid final var schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance(); schema.validate( @@ -105,7 +104,7 @@ public void testUniqueArrayExtendedFromTrueFalseIsValidPasses() { } @Test - public void testFalseTrueFromItemsArrayIsValidPasses() { + public void testFalseTrueFromItemsArrayIsValidPasses() throws ValidationException { // [false, true] from items array is valid final var schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance(); schema.validate( @@ -120,7 +119,7 @@ public void testFalseTrueFromItemsArrayIsValidPasses() { } @Test - public void testTrueFalseFromItemsArrayIsValidPasses() { + public void testTrueFalseFromItemsArrayIsValidPasses() throws ValidationException { // [true, false] from items array is valid final var schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance(); schema.validate( @@ -135,7 +134,7 @@ public void testTrueFalseFromItemsArrayIsValidPasses() { } @Test - public void testNonUniqueArrayExtendedFromTrueFalseIsValidPasses() { + public void testNonUniqueArrayExtendedFromTrueFalseIsValidPasses() throws ValidationException { // non-unique array extended from [true, false] is valid final var schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java index 25a6c9e4012..03ba6533f13 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -31,7 +30,7 @@ public void testNonUniqueArrayOfMoreThanTwoIntegersIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -59,7 +58,7 @@ public void testNonUniqueArrayOfObjectsIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -95,13 +94,13 @@ public void testPropertyOrderOfArrayOfObjectsIsIgnoredFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testATrueAndA1AreUniquePasses() { + public void testATrueAndA1AreUniquePasses() throws ValidationException { // {\\\"a\\\": true} and {\\\"a\\\": 1} are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -124,7 +123,7 @@ public void testATrueAndA1AreUniquePasses() { } @Test - public void test1AndTrueAreUniquePasses() { + public void test1AndTrueAreUniquePasses() throws ValidationException { // [1] and [true] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -153,13 +152,13 @@ public void testNonUniqueArrayOfIntegersIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNested0AndFalseAreUniquePasses() { + public void testNested0AndFalseAreUniquePasses() throws ValidationException { // nested [0] and [false] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -212,7 +211,7 @@ public void testObjectsAreNonUniqueDespiteKeyOrderFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -234,13 +233,13 @@ public void testNonUniqueArrayOfArraysIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAFalseAndA0AreUniquePasses() { + public void testAFalseAndA0AreUniquePasses() throws ValidationException { // {\\\"a\\\": false} and {\\\"a\\\": 0} are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -282,13 +281,13 @@ public void testNonUniqueArrayOfMoreThanTwoArraysIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void test0AndFalseAreUniquePasses() { + public void test0AndFalseAreUniquePasses() throws ValidationException { // [0] and [false] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -347,7 +346,7 @@ public void testNonUniqueArrayOfNestedObjectsIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -366,7 +365,7 @@ public void testNumbersAreUniqueIfMathematicallyUnequalFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -385,13 +384,13 @@ public void testNonUniqueArrayOfStringsIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testUniqueArrayOfNestedObjectsIsValidPasses() { + public void testUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException { // unique array of nested objects is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -434,7 +433,7 @@ public void testUniqueArrayOfNestedObjectsIsValidPasses() { } @Test - public void testUniqueArrayOfArraysIsValidPasses() { + public void testUniqueArrayOfArraysIsValidPasses() throws ValidationException { // unique array of arrays is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -451,7 +450,7 @@ public void testUniqueArrayOfArraysIsValidPasses() { } @Test - public void testTrueIsNotEqualToOnePasses() { + public void testTrueIsNotEqualToOnePasses() throws ValidationException { // true is not equal to one final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -464,7 +463,7 @@ public void testTrueIsNotEqualToOnePasses() { } @Test - public void testNested1AndTrueAreUniquePasses() { + public void testNested1AndTrueAreUniquePasses() throws ValidationException { // nested [1] and [true] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -487,7 +486,7 @@ public void testNested1AndTrueAreUniquePasses() { } @Test - public void testUniqueArrayOfStringsIsValidPasses() { + public void testUniqueArrayOfStringsIsValidPasses() throws ValidationException { // unique array of strings is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -501,7 +500,7 @@ public void testUniqueArrayOfStringsIsValidPasses() { } @Test - public void testFalseIsNotEqualToZeroPasses() { + public void testFalseIsNotEqualToZeroPasses() throws ValidationException { // false is not equal to zero final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -514,7 +513,7 @@ public void testFalseIsNotEqualToZeroPasses() { } @Test - public void testUniqueArrayOfIntegersIsValidPasses() { + public void testUniqueArrayOfIntegersIsValidPasses() throws ValidationException { // unique array of integers is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -527,7 +526,7 @@ public void testUniqueArrayOfIntegersIsValidPasses() { } @Test - public void testDifferentObjectsAreUniquePasses() { + public void testDifferentObjectsAreUniquePasses() throws ValidationException { // different objects are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -558,7 +557,7 @@ public void testDifferentObjectsAreUniquePasses() { } @Test - public void testUniqueHeterogeneousTypesAreValidPasses() { + public void testUniqueHeterogeneousTypesAreValidPasses() throws ValidationException { // unique heterogeneous types are valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -578,7 +577,7 @@ public void testUniqueHeterogeneousTypesAreValidPasses() { } @Test - public void testUniqueArrayOfObjectsIsValidPasses() { + public void testUniqueArrayOfObjectsIsValidPasses() throws ValidationException { // unique array of objects is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -621,7 +620,7 @@ public void testNonUniqueHeterogeneousTypesAreInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.java index 3c89da2ab31..cb31e897af8 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -30,13 +29,13 @@ public void testTrueTrueFromItemsArrayIsNotValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testUniqueArrayExtendedFromFalseTrueIsValidPasses() { + public void testUniqueArrayExtendedFromFalseTrueIsValidPasses() throws ValidationException { // unique array extended from [false, true] is valid final var schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance(); schema.validate( @@ -67,13 +66,13 @@ public void testFalseFalseFromItemsArrayIsNotValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testUniqueArrayExtendedFromTrueFalseIsValidPasses() { + public void testUniqueArrayExtendedFromTrueFalseIsValidPasses() throws ValidationException { // unique array extended from [true, false] is valid final var schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance(); schema.validate( @@ -106,7 +105,7 @@ public void testNonUniqueArrayExtendedFromFalseTrueIsNotValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -126,13 +125,13 @@ public void testNonUniqueArrayExtendedFromTrueFalseIsNotValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testFalseTrueFromItemsArrayIsValidPasses() { + public void testFalseTrueFromItemsArrayIsValidPasses() throws ValidationException { // [false, true] from items array is valid final var schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance(); schema.validate( @@ -147,7 +146,7 @@ public void testFalseTrueFromItemsArrayIsValidPasses() { } @Test - public void testTrueFalseFromItemsArrayIsValidPasses() { + public void testTrueFalseFromItemsArrayIsValidPasses() throws ValidationException { // [true, false] from items array is valid final var schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java index de91acb3019..abb3604960d 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UriFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testInvalidUriStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidUriStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid uri string is only an annotation by default final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testInvalidUriStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java index 4e36e84ff7a..ba47ee8e61f 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UriReferenceFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testInvalidUriReferenceStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidUriReferenceStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid uri-reference string is only an annotation by default final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -69,7 +68,7 @@ public void testInvalidUriReferenceStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java index b8914a00c53..a55ae7d86aa 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UriTemplateFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -70,7 +69,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testAllStringFormatsIgnoreBooleansPasses() { } @Test - public void testInvalidUriTemplateStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidUriTemplateStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid uri-template string is only an annotation by default final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UuidFormatTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UuidFormatTest.java index 5b5594674c8..e3c5341617b 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UuidFormatTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UuidFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UuidFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = UuidFormat.UuidFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = UuidFormat.UuidFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = UuidFormat.UuidFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = UuidFormat.UuidFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = UuidFormat.UuidFormat1.getInstance(); schema.validate( @@ -70,7 +69,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testInvalidUuidStringIsOnlyAnAnnotationByDefaultPasses() { + public void testInvalidUuidStringIsOnlyAnAnnotationByDefaultPasses() throws ValidationException { // invalid uuid string is only an annotation by default final var schema = UuidFormat.UuidFormat1.getInstance(); schema.validate( @@ -80,7 +79,7 @@ public void testInvalidUuidStringIsOnlyAnAnnotationByDefaultPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = UuidFormat.UuidFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.java index b7d19ab6ebe..186895289c3 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ValidateAgainstCorrectBranchThenVsElseTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testValidThroughThenPasses() { + public void testValidThroughThenPasses() throws ValidationException { // valid through then final var schema = ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1.getInstance(); schema.validate( @@ -37,13 +36,13 @@ public void testInvalidThroughThenFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidThroughElsePasses() { + public void testValidThroughElsePasses() throws ValidationException { // valid through else final var schema = ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1.getInstance(); schema.validate( @@ -62,7 +61,7 @@ public void testInvalidThroughElseFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java index 990f21a1148..476dab2c3da 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java @@ -5,10 +5,13 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.net.http.HttpHeaders; +import java.util.AbstractMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -22,7 +25,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -100,7 +103,7 @@ public Void encoding() { return null; } } - Map> content = Map.of( + AbstractMap.SimpleEntry> content = new AbstractMap.SimpleEntry<>( "application/json", new ApplicationJsonMediaType() ); for (ParamTestCase testCase: testCases) { diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java index b0eaf780b2e..b1dc30975ab 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java @@ -5,7 +5,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.ListJsonSchema; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -28,7 +29,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -105,7 +106,7 @@ public void testSerialization() { ); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value, "color", false, configuration) ); } @@ -126,7 +127,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserialization() { + public void testDeserialization() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java index a19ea8c1007..a46f7fbb5f7 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +33,7 @@ protected CookieParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java index 63f3159bf0a..2a9acf14219 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -33,7 +34,7 @@ protected HeaderParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java index bef110af08d..3ff2ac5ed88 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +33,7 @@ protected PathParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java index ed5aae7e580..7cb559fef3c 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +33,7 @@ protected QueryParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java index 871d4f073f3..4d799c14c72 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java @@ -3,7 +3,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +26,7 @@ public HeaderParameter(@Nullable Boolean explode) { } @Test - public void testHeaderSerialization() { + public void testHeaderSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -91,7 +91,7 @@ public void testHeaderSerialization() { var boolHeader = new HeaderParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value) ); } @@ -104,7 +104,7 @@ public PathParameter(@Nullable Boolean explode) { } @Test - public void testPathSerialization() { + public void testPathSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -169,7 +169,7 @@ public void testPathSerialization() { var pathParameter = new PathParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> pathParameter.serialize(value) ); } @@ -182,7 +182,7 @@ public CookieParameter(@Nullable Boolean explode) { } @Test - public void testCookieSerialization() { + public void testCookieSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -247,7 +247,7 @@ public void testCookieSerialization() { var cookieParameter = new CookieParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> cookieParameter.serialize(value) ); } @@ -260,7 +260,7 @@ public PathMatrixParameter(@Nullable Boolean explode) { } @Test - public void testPathMatrixSerialization() { + public void testPathMatrixSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -331,7 +331,7 @@ public PathLabelParameter(@Nullable Boolean explode) { } @Test - public void testPathLabelSerialization() { + public void testPathLabelSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java index f4ea29fccb3..413b092634f 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java @@ -3,7 +3,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +26,7 @@ public QueryParameterNoStyle(@Nullable Boolean explode) { } @Test - public void testQueryParameterNoStyleSerialization() { + public void testQueryParameterNoStyleSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -91,7 +91,7 @@ public void testQueryParameterNoStyleSerialization() { var parameter = new QueryParameterNoStyle(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> parameter.serialize(value) ); } @@ -104,7 +104,7 @@ public QueryParameterSpaceDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterSpaceDelimitedSerialization() { + public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -151,7 +151,7 @@ public QueryParameterPipeDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterPipeDelimitedSerialization() { + public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java index 9f0c86ec5c4..93a5adb916a 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -47,7 +49,7 @@ public MyRequestBodySerializer() { true); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { @@ -93,7 +95,7 @@ private String getJsonBody(SerializedRequestBody requestBody) { } @Test - public void testSerializeApplicationJson() { + public void testSerializeApplicationJson() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); String jsonBody; @@ -164,7 +166,7 @@ public void testSerializeApplicationJson() { } @Test - public void testSerializeTextPlain() { + public void testSerializeTextPlain() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); SerializedRequestBody requestBody = serializer.serialize( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java index 408f04582a8..e4656ecbbc3 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java @@ -8,6 +8,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -64,11 +67,7 @@ public MyResponseDeserializer() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + 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); @@ -152,7 +151,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserializeApplicationJsonNull() { + 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"); @@ -168,7 +167,7 @@ public void testDeserializeApplicationJsonNull() { } @Test - public void testDeserializeApplicationJsonTrue() { + 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"); @@ -184,7 +183,7 @@ public void testDeserializeApplicationJsonTrue() { } @Test - public void testDeserializeApplicationJsonFalse() { + 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"); @@ -200,7 +199,7 @@ public void testDeserializeApplicationJsonFalse() { } @Test - public void testDeserializeApplicationJsonInt() { + 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"); @@ -216,7 +215,7 @@ public void testDeserializeApplicationJsonInt() { } @Test - public void testDeserializeApplicationJsonFloat() { + 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"); @@ -232,7 +231,7 @@ public void testDeserializeApplicationJsonFloat() { } @Test - public void testDeserializeApplicationJsonString() { + 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"); diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java index 9b76ff56c45..206c683cd50 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java @@ -5,6 +5,7 @@ import org.junit.Test; 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; @@ -26,13 +27,13 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testValidateNull() { + public void testValidateNull() throws ValidationException { Void validatedValue = schema.validate((Void) null, configuration); assertNull(validatedValue); } @Test - public void testValidateBoolean() { + public void testValidateBoolean() throws ValidationException { boolean trueValue = schema.validate(true, configuration); Assert.assertTrue(trueValue); @@ -41,49 +42,49 @@ public void testValidateBoolean() { } @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException { int validatedValue = schema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException { long validatedValue = schema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException { float validatedValue = schema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException { double validatedValue = schema.validate(70.6458763d, configuration); Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); } @Test - public void testValidateString() { + public void testValidateString() throws ValidationException { String validatedValue = schema.validate("a", configuration); Assert.assertEquals(validatedValue, "a"); } @Test - public void testValidateZonedDateTime() { + public void testValidateZonedDateTime() throws ValidationException { String validatedValue = schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration); Assert.assertEquals(validatedValue, "2017-07-21T17:32:28Z"); } @Test - public void testValidateLocalDate() { + public void testValidateLocalDate() throws ValidationException { String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); Assert.assertEquals(validatedValue, "2017-07-21"); } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException { LinkedHashMap inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap validatedValue = schema.validate(inMap, configuration); @@ -93,7 +94,7 @@ public void testValidateMap() { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException { ArrayList inList = new ArrayList<>(); inList.add(LocalDate.of(2017, 7, 21)); FrozenList validatedValue = schema.validate(inList, configuration); diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index 42dfcabf0d0..0ca5e56ecd2 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -5,13 +5,12 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -53,12 +52,12 @@ public FrozenList getNewInstance(List arg, List pathToItem, P itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -66,7 +65,7 @@ public FrozenList getNewInstance(List arg, List pathToItem, P return new FrozenList<>(items); } - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -77,7 +76,7 @@ public FrozenList validate(List arg, SchemaConfiguration configuratio } @Override - public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithItemsSchemaBoxedList(validate(arg, configuration)); } @@ -86,23 +85,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return new ArrayWithItemsSchemaBoxedList(validate(listArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -111,7 +110,7 @@ protected ArrayWithOutputClsSchemaList(FrozenList m) { super(m); } - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) { + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithOutputClsSchema().validate(arg, configuration); } } @@ -138,12 +137,12 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -152,7 +151,7 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat return new ArrayWithOutputClsSchemaList(newInstanceItems); } - public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,7 +162,7 @@ public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration co } @Override - public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)); } @@ -172,23 +171,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return new ArrayWithOutputClsSchemaBoxedList(validate(listArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -202,7 +201,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateArrayWithItemsSchema() { + public void testValidateArrayWithItemsSchema() throws ValidationException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); @@ -227,7 +226,7 @@ public void testValidateArrayWithItemsSchema() { } @Test - public void testValidateArrayWithOutputClsSchema() { + public void testValidateArrayWithOutputClsSchema() throws ValidationException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java index 0b4261a7ef0..7ac24fbeaa2 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java @@ -4,9 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; 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; @@ -24,13 +23,13 @@ public class BooleanSchemaTest { ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException { boolean validatedValue = booleanJsonSchema.validate(true, configuration); Assert.assertTrue(validatedValue); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException { boolean validatedValue = booleanJsonSchema.validate(false, configuration); Assert.assertFalse(validatedValue); } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java index cb4aa60f4a8..17d5f35dcbe 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java @@ -5,9 +5,9 @@ import org.junit.Test; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -35,7 +35,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException { List inList = new ArrayList<>(); inList.add("today"); FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java index 85afb15a068..5b03fec8609 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java @@ -5,9 +5,9 @@ import org.junit.Test; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -37,7 +37,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException { Map inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap<@Nullable Object> validatedValue = mapJsonSchema.validate(inMap, configuration); diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java index d566f15a69e..eb1c70ef049 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java @@ -4,9 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; 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; @@ -26,7 +25,7 @@ public class NullSchemaTest { @Test @SuppressWarnings("nullness") - public void testValidateNull() { + public void testValidateNull() throws ValidationException { Void validatedValue = nullJsonSchema.validate(null, configuration); Assert.assertNull(validatedValue); } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java index 2ab8d8a8121..fcde27495e3 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java @@ -4,8 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; 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; @@ -23,25 +23,25 @@ public class NumberSchemaTest { ); @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException { int validatedValue = numberJsonSchema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException { long validatedValue = numberJsonSchema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException { float validatedValue = numberJsonSchema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException { double validatedValue = numberJsonSchema.validate(3.14d, configuration); Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index 02729b0f046..fad3d574369 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -5,14 +5,13 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.PropertyEntry; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -62,7 +61,7 @@ public static ObjectWithPropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -70,7 +69,7 @@ public static ObjectWithPropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -79,7 +78,7 @@ public static ObjectWithPropsSchema getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,7 +89,7 @@ public static ObjectWithPropsSchema getInstance() { } @Override - public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)); } @@ -99,23 +98,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -146,7 +145,7 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -154,19 +153,19 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(castValue instanceof String)) { - throw new InvalidTypeException("Invalid type for property value"); + throw new RuntimeException("Invalid type for property value"); } properties.put(propertyName, (String) castValue); } return new FrozenMap<>(properties); } - public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,24 +176,24 @@ public FrozenMap validate(Map arg, SchemaConfiguration configurati } @Override - public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -202,7 +201,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -235,7 +234,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -243,7 +242,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -252,7 +251,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -263,24 +262,24 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { } @Override - public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -288,7 +287,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -297,7 +296,7 @@ protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { super(m); } - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) { + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); } } @@ -330,7 +329,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -338,7 +337,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -347,7 +346,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); } - public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -358,24 +357,24 @@ public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration } @Override - public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithOutputTypeSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -383,7 +382,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -398,7 +397,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateObjectWithPropsSchema() { + public void testValidateObjectWithPropsSchema() throws ValidationException { ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); // map with only property works @@ -429,7 +428,7 @@ public void testValidateObjectWithPropsSchema() { } @Test - public void testValidateObjectWithAddpropsSchema() { + public void testValidateObjectWithAddpropsSchema() throws ValidationException { ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); // map with only property works @@ -460,7 +459,7 @@ public void testValidateObjectWithAddpropsSchema() { } @Test - public void testValidateObjectWithPropsAndAddpropsSchema() { + public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException { ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); // map with only property works @@ -499,7 +498,7 @@ public void testValidateObjectWithPropsAndAddpropsSchema() { } @Test - public void testValidateObjectWithOutputTypeSchema() { + public void testValidateObjectWithOutputTypeSchema() throws ValidationException { ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); // map with only property works diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java index c8079ef632a..d3cba69fb20 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java @@ -4,9 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; 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; @@ -28,13 +27,13 @@ public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchem ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException { Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); Assert.assertEquals(validatedValue, Boolean.TRUE); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException { Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); Assert.assertEquals(validatedValue, Boolean.FALSE); } diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java index 40a01c9983d..ea3ec6ae8c3 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java @@ -5,7 +5,7 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; @@ -46,19 +46,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } @@ -70,7 +70,7 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -105,7 +105,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java index 1481f312f6a..cb03bcf8f5b 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java @@ -34,7 +34,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testIntFormatSucceedsWithFloat() { + public void testIntFormatSucceedsWithFloat() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -59,7 +59,7 @@ public void testIntFormatFailsWithFloat() { } @Test - public void testIntFormatSucceedsWithInt() { + public void testIntFormatSucceedsWithInt() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -84,7 +84,7 @@ public void testInt32UnderMinFails() { } @Test - public void testInt32InclusiveMinSucceeds() { + public void testInt32InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -97,7 +97,7 @@ public void testInt32InclusiveMinSucceeds() { } @Test - public void testInt32InclusiveMaxSucceeds() { + public void testInt32InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -135,7 +135,7 @@ public void testInt64UnderMinFails() { } @Test - public void testInt64InclusiveMinSucceeds() { + public void testInt64InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -148,7 +148,7 @@ public void testInt64InclusiveMinSucceeds() { } @Test - public void testInt64InclusiveMaxSucceeds() { + public void testInt64InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -186,7 +186,7 @@ public void testFloatUnderMinFails() { } @Test - public void testFloatInclusiveMinSucceeds() { + public void testFloatInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -199,7 +199,7 @@ public void testFloatInclusiveMinSucceeds() { } @Test - public void testFloatInclusiveMaxSucceeds() { + public void testFloatInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -236,7 +236,7 @@ public void testDoubleUnderMinFails() { } @Test - public void testDoubleInclusiveMinSucceeds() { + public void testDoubleInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -249,7 +249,7 @@ public void testDoubleInclusiveMinSucceeds() { } @Test - public void testDoubleInclusiveMaxSucceeds() { + public void testDoubleInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -286,7 +286,7 @@ public void testInvalidNumberStringFails() { } @Test - public void testValidFloatNumberStringSucceeds() { + public void testValidFloatNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -299,7 +299,7 @@ public void testValidFloatNumberStringSucceeds() { } @Test - public void testValidIntNumberStringSucceeds() { + public void testValidIntNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -324,7 +324,7 @@ public void testInvalidDateStringFails() { } @Test - public void testValidDateStringSucceeds() { + public void testValidDateStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -349,7 +349,7 @@ public void testInvalidDateTimeStringFails() { } @Test - public void testValidDateTimeStringSucceeds() { + public void testValidDateTimeStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java index e0e4a0c859e..5b70aada50c 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java @@ -6,7 +6,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; @@ -37,25 +36,25 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List listArg) { return getNewInstance(listArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return validate(listArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithItemsSchemaBoxedList(); } } @Test - public void testCorrectItemsSucceeds() { + public void testCorrectItemsSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -89,7 +88,7 @@ public void testCorrectItemsSucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java index 8a14df7edd6..c1cc4c84e9e 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -40,25 +39,25 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof String) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new SomeSchemaBoxedString(); } } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java index 492f45af0c7..e35b145e721 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java @@ -5,9 +5,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.StringJsonSchema; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -36,19 +35,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } @@ -59,7 +58,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( @@ -92,7 +91,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java index 65ff030d74b..58c160a0499 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -32,19 +31,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithRequiredSchemaBoxedMap(); } } @@ -55,7 +54,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -78,7 +77,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java index ebc8bbff1f5..c31855af4ff 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java @@ -18,7 +18,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { final TypeValidator validator = new TypeValidator(); ValidationMetadata validationMetadata = new ValidationMetadata( new ArrayList<>(), diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_a_schema_given_for_prefixitems_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_a_schema_given_for_prefixitems_request_body/post/request_body/content/application_json/schema.md index 07162fcb5fa..546cbadff04 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_a_schema_given_for_prefixitems_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_a_schema_given_for_prefixitems_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**a_schema_given_for_prefixitems.ASchemaGivenForPrefixitems**](../../../../../../../components/schema/a_schema_given_for_prefixitems.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, [a_schema_given_for_prefixitems.ASchemaGivenForPrefixitemsTupleInput](../../../../../../../components/schema/a_schema_given_for_prefixitems.md#aschemagivenforprefixitemstupleinput), [a_schema_given_for_prefixitems.ASchemaGivenForPrefixitemsTuple](../../../../../../../components/schema/a_schema_given_for_prefixitems.md#aschemagivenforprefixitemstuple), bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, [a_schema_given_for_prefixitems.ASchemaGivenForPrefixitemsTuple](../../../../../../../components/schema/a_schema_given_for_prefixitems.md#aschemagivenforprefixitemstuple), bytes, io.FileIO +[**a_schema_given_for_prefixitems.ASchemaGivenForPrefixitems**](../../../../../../components/schema/a_schema_given_for_prefixitems.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, [a_schema_given_for_prefixitems.ASchemaGivenForPrefixitemsTupleInput](../../../../../../components/schema/a_schema_given_for_prefixitems.md#aschemagivenforprefixitemstupleinput), [a_schema_given_for_prefixitems.ASchemaGivenForPrefixitemsTuple](../../../../../../components/schema/a_schema_given_for_prefixitems.md#aschemagivenforprefixitemstuple), bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, [a_schema_given_for_prefixitems.ASchemaGivenForPrefixitemsTuple](../../../../../../components/schema/a_schema_given_for_prefixitems.md#aschemagivenforprefixitemstuple), bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additional_items_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additional_items_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md index 8cb14e77d6d..7507e21423d 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additional_items_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additional_items_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**additional_items_are_allowed_by_default.AdditionalItemsAreAllowedByDefault**](../../../../../../../components/schema/additional_items_are_allowed_by_default.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, [additional_items_are_allowed_by_default.AdditionalItemsAreAllowedByDefaultTupleInput](../../../../../../../components/schema/additional_items_are_allowed_by_default.md#additionalitemsareallowedbydefaulttupleinput), [additional_items_are_allowed_by_default.AdditionalItemsAreAllowedByDefaultTuple](../../../../../../../components/schema/additional_items_are_allowed_by_default.md#additionalitemsareallowedbydefaulttuple), bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, [additional_items_are_allowed_by_default.AdditionalItemsAreAllowedByDefaultTuple](../../../../../../../components/schema/additional_items_are_allowed_by_default.md#additionalitemsareallowedbydefaulttuple), bytes, io.FileIO +[**additional_items_are_allowed_by_default.AdditionalItemsAreAllowedByDefault**](../../../../../../components/schema/additional_items_are_allowed_by_default.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, [additional_items_are_allowed_by_default.AdditionalItemsAreAllowedByDefaultTupleInput](../../../../../../components/schema/additional_items_are_allowed_by_default.md#additionalitemsareallowedbydefaulttupleinput), [additional_items_are_allowed_by_default.AdditionalItemsAreAllowedByDefaultTuple](../../../../../../components/schema/additional_items_are_allowed_by_default.md#additionalitemsareallowedbydefaulttuple), bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, [additional_items_are_allowed_by_default.AdditionalItemsAreAllowedByDefaultTuple](../../../../../../components/schema/additional_items_are_allowed_by_default.md#additionalitemsareallowedbydefaulttuple), bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md index cd7af129545..a345717d5e3 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefault**](../../../../../../../components/schema/additionalproperties_are_allowed_by_default.md) | [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDictInput](../../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdictinput), [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDict](../../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDict](../../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefault**](../../../../../../components/schema/additionalproperties_are_allowed_by_default.md) | [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDictInput](../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdictinput), [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDict](../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [additionalproperties_are_allowed_by_default.AdditionalpropertiesAreAllowedByDefaultDict](../../../../../../components/schema/additionalproperties_are_allowed_by_default.md#additionalpropertiesareallowedbydefaultdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/request_body/content/application_json/schema.md index a1511fc50f9..3a8a8a95fd7 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItself**](../../../../../../../components/schema/additionalproperties_can_exist_by_itself.md) | [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDictInput](../../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdictinput), [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDict](../../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdict) | [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDict](../../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdict) +[**additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItself**](../../../../../../components/schema/additionalproperties_can_exist_by_itself.md) | [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDictInput](../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdictinput), [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDict](../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdict) | [additionalproperties_can_exist_by_itself.AdditionalpropertiesCanExistByItselfDict](../../../../../../components/schema/additionalproperties_can_exist_by_itself.md#additionalpropertiescanexistbyitselfdict) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_does_not_look_in_applicators_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_does_not_look_in_applicators_request_body/post/request_body/content/application_json/schema.md index 14f9c246c5a..06072d2849d 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_does_not_look_in_applicators_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_does_not_look_in_applicators_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**additionalproperties_does_not_look_in_applicators.AdditionalpropertiesDoesNotLookInApplicators**](../../../../../../../components/schema/additionalproperties_does_not_look_in_applicators.md) | [additionalproperties_does_not_look_in_applicators.AdditionalpropertiesDoesNotLookInApplicatorsDictInput](../../../../../../../components/schema/additionalproperties_does_not_look_in_applicators.md#additionalpropertiesdoesnotlookinapplicatorsdictinput), [additionalproperties_does_not_look_in_applicators.AdditionalpropertiesDoesNotLookInApplicatorsDict](../../../../../../../components/schema/additionalproperties_does_not_look_in_applicators.md#additionalpropertiesdoesnotlookinapplicatorsdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [additionalproperties_does_not_look_in_applicators.AdditionalpropertiesDoesNotLookInApplicatorsDict](../../../../../../../components/schema/additionalproperties_does_not_look_in_applicators.md#additionalpropertiesdoesnotlookinapplicatorsdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**additionalproperties_does_not_look_in_applicators.AdditionalpropertiesDoesNotLookInApplicators**](../../../../../../components/schema/additionalproperties_does_not_look_in_applicators.md) | [additionalproperties_does_not_look_in_applicators.AdditionalpropertiesDoesNotLookInApplicatorsDictInput](../../../../../../components/schema/additionalproperties_does_not_look_in_applicators.md#additionalpropertiesdoesnotlookinapplicatorsdictinput), [additionalproperties_does_not_look_in_applicators.AdditionalpropertiesDoesNotLookInApplicatorsDict](../../../../../../components/schema/additionalproperties_does_not_look_in_applicators.md#additionalpropertiesdoesnotlookinapplicatorsdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [additionalproperties_does_not_look_in_applicators.AdditionalpropertiesDoesNotLookInApplicatorsDict](../../../../../../components/schema/additionalproperties_does_not_look_in_applicators.md#additionalpropertiesdoesnotlookinapplicatorsdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md index fda8426997e..da665d643d5 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**additionalproperties_with_null_valued_instance_properties.AdditionalpropertiesWithNullValuedInstanceProperties**](../../../../../../../components/schema/additionalproperties_with_null_valued_instance_properties.md) | [additionalproperties_with_null_valued_instance_properties.AdditionalpropertiesWithNullValuedInstancePropertiesDictInput](../../../../../../../components/schema/additionalproperties_with_null_valued_instance_properties.md#additionalpropertieswithnullvaluedinstancepropertiesdictinput), [additionalproperties_with_null_valued_instance_properties.AdditionalpropertiesWithNullValuedInstancePropertiesDict](../../../../../../../components/schema/additionalproperties_with_null_valued_instance_properties.md#additionalpropertieswithnullvaluedinstancepropertiesdict) | [additionalproperties_with_null_valued_instance_properties.AdditionalpropertiesWithNullValuedInstancePropertiesDict](../../../../../../../components/schema/additionalproperties_with_null_valued_instance_properties.md#additionalpropertieswithnullvaluedinstancepropertiesdict) +[**additionalproperties_with_null_valued_instance_properties.AdditionalpropertiesWithNullValuedInstanceProperties**](../../../../../../components/schema/additionalproperties_with_null_valued_instance_properties.md) | [additionalproperties_with_null_valued_instance_properties.AdditionalpropertiesWithNullValuedInstancePropertiesDictInput](../../../../../../components/schema/additionalproperties_with_null_valued_instance_properties.md#additionalpropertieswithnullvaluedinstancepropertiesdictinput), [additionalproperties_with_null_valued_instance_properties.AdditionalpropertiesWithNullValuedInstancePropertiesDict](../../../../../../components/schema/additionalproperties_with_null_valued_instance_properties.md#additionalpropertieswithnullvaluedinstancepropertiesdict) | [additionalproperties_with_null_valued_instance_properties.AdditionalpropertiesWithNullValuedInstancePropertiesDict](../../../../../../components/schema/additionalproperties_with_null_valued_instance_properties.md#additionalpropertieswithnullvaluedinstancepropertiesdict) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_with_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_with_schema_request_body/post/request_body/content/application_json/schema.md index bddde9449a0..792ecccb3de 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_with_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_additionalproperties_with_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**additionalproperties_with_schema.AdditionalpropertiesWithSchema**](../../../../../../../components/schema/additionalproperties_with_schema.md) | [additionalproperties_with_schema.AdditionalpropertiesWithSchemaDictInput](../../../../../../../components/schema/additionalproperties_with_schema.md#additionalpropertieswithschemadictinput), [additionalproperties_with_schema.AdditionalpropertiesWithSchemaDict](../../../../../../../components/schema/additionalproperties_with_schema.md#additionalpropertieswithschemadict) | [additionalproperties_with_schema.AdditionalpropertiesWithSchemaDict](../../../../../../../components/schema/additionalproperties_with_schema.md#additionalpropertieswithschemadict) +[**additionalproperties_with_schema.AdditionalpropertiesWithSchema**](../../../../../../components/schema/additionalproperties_with_schema.md) | [additionalproperties_with_schema.AdditionalpropertiesWithSchemaDictInput](../../../../../../components/schema/additionalproperties_with_schema.md#additionalpropertieswithschemadictinput), [additionalproperties_with_schema.AdditionalpropertiesWithSchemaDict](../../../../../../components/schema/additionalproperties_with_schema.md#additionalpropertieswithschemadict) | [additionalproperties_with_schema.AdditionalpropertiesWithSchemaDict](../../../../../../components/schema/additionalproperties_with_schema.md#additionalpropertieswithschemadict) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/request_body/content/application_json/schema.md index 8cb8214d9e4..788f254d67d 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_combined_with_anyof_oneof.AllofCombinedWithAnyofOneof**](../../../../../../../components/schema/allof_combined_with_anyof_oneof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_combined_with_anyof_oneof.AllofCombinedWithAnyofOneof**](../../../../../../components/schema/allof_combined_with_anyof_oneof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_request_body/post/request_body/content/application_json/schema.md index 80c0381d942..670c25418a9 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof.Allof**](../../../../../../../components/schema/allof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof.Allof**](../../../../../../components/schema/allof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_simple_types_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_simple_types_request_body/post/request_body/content/application_json/schema.md index 80d2c2a44c5..b262bff9176 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_simple_types_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_simple_types_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_simple_types.AllofSimpleTypes**](../../../../../../../components/schema/allof_simple_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_simple_types.AllofSimpleTypes**](../../../../../../components/schema/allof_simple_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_base_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_base_schema_request_body/post/request_body/content/application_json/schema.md index d43ae5e7d8c..cac90455af2 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_base_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_base_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_with_base_schema.AllofWithBaseSchema**](../../../../../../../components/schema/allof_with_base_schema.md) | [allof_with_base_schema.AllofWithBaseSchemaDictInput](../../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadictinput), [allof_with_base_schema.AllofWithBaseSchemaDict](../../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [allof_with_base_schema.AllofWithBaseSchemaDict](../../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_with_base_schema.AllofWithBaseSchema**](../../../../../../components/schema/allof_with_base_schema.md) | [allof_with_base_schema.AllofWithBaseSchemaDictInput](../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadictinput), [allof_with_base_schema.AllofWithBaseSchemaDict](../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [allof_with_base_schema.AllofWithBaseSchemaDict](../../../../../../components/schema/allof_with_base_schema.md#allofwithbaseschemadict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md index 8314f88a577..d219913def3 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_with_one_empty_schema.AllofWithOneEmptySchema**](../../../../../../../components/schema/allof_with_one_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_with_one_empty_schema.AllofWithOneEmptySchema**](../../../../../../components/schema/allof_with_one_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/request_body/content/application_json/schema.md index da3a1d2c9ee..8dd4b6fd982 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_with_the_first_empty_schema.AllofWithTheFirstEmptySchema**](../../../../../../../components/schema/allof_with_the_first_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_with_the_first_empty_schema.AllofWithTheFirstEmptySchema**](../../../../../../components/schema/allof_with_the_first_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/request_body/content/application_json/schema.md index 6be962b0182..304d89966b6 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_with_the_last_empty_schema.AllofWithTheLastEmptySchema**](../../../../../../../components/schema/allof_with_the_last_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_with_the_last_empty_schema.AllofWithTheLastEmptySchema**](../../../../../../components/schema/allof_with_the_last_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/request_body/content/application_json/schema.md index c57f1477a78..4a002f16997 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**allof_with_two_empty_schemas.AllofWithTwoEmptySchemas**](../../../../../../../components/schema/allof_with_two_empty_schemas.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**allof_with_two_empty_schemas.AllofWithTwoEmptySchemas**](../../../../../../components/schema/allof_with_two_empty_schemas.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_complex_types_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_complex_types_request_body/post/request_body/content/application_json/schema.md index 508ec31d240..00d14ecd41c 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_complex_types_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_complex_types_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**anyof_complex_types.AnyofComplexTypes**](../../../../../../../components/schema/anyof_complex_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**anyof_complex_types.AnyofComplexTypes**](../../../../../../components/schema/anyof_complex_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_request_body/post/request_body/content/application_json/schema.md index f9957405abd..30fcd54b0d6 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**anyof.Anyof**](../../../../../../../components/schema/anyof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**anyof.Anyof**](../../../../../../components/schema/anyof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_with_base_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_with_base_schema_request_body/post/request_body/content/application_json/schema.md index b763a336df9..3a1194a0057 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_with_base_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_with_base_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**anyof_with_base_schema.AnyofWithBaseSchema**](../../../../../../../components/schema/anyof_with_base_schema.md) | str | str +[**anyof_with_base_schema.AnyofWithBaseSchema**](../../../../../../components/schema/anyof_with_base_schema.md) | str | str diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md index ffe117b0a89..fd29330d5e6 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**anyof_with_one_empty_schema.AnyofWithOneEmptySchema**](../../../../../../../components/schema/anyof_with_one_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**anyof_with_one_empty_schema.AnyofWithOneEmptySchema**](../../../../../../components/schema/anyof_with_one_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_array_type_matches_arrays_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_array_type_matches_arrays_request_body/post/request_body/content/application_json/schema.md index a736ec47156..4ac52209aa7 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_array_type_matches_arrays_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_array_type_matches_arrays_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**array_type_matches_arrays.ArrayTypeMatchesArrays**](../../../../../../../components/schema/array_type_matches_arrays.md) | list, tuple | tuple +[**array_type_matches_arrays.ArrayTypeMatchesArrays**](../../../../../../components/schema/array_type_matches_arrays.md) | list, tuple | tuple diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_boolean_type_matches_booleans_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_boolean_type_matches_booleans_request_body/post/request_body/content/application_json/schema.md index d5ae0f44820..221417e6447 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_boolean_type_matches_booleans_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_boolean_type_matches_booleans_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**boolean_type_matches_booleans.BooleanTypeMatchesBooleans**](../../../../../../../components/schema/boolean_type_matches_booleans.md) | bool | bool +[**boolean_type_matches_booleans.BooleanTypeMatchesBooleans**](../../../../../../components/schema/boolean_type_matches_booleans.md) | bool | bool diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_int_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_int_request_body/post/request_body/content/application_json/schema.md index 1e1bc278952..70150b0e71d 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_int_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_int_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**by_int.ByInt**](../../../../../../../components/schema/by_int.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**by_int.ByInt**](../../../../../../components/schema/by_int.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_number_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_number_request_body/post/request_body/content/application_json/schema.md index a8812333875..8bac3e68d7f 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_number_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_number_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**by_number.ByNumber**](../../../../../../../components/schema/by_number.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**by_number.ByNumber**](../../../../../../components/schema/by_number.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_small_number_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_small_number_request_body/post/request_body/content/application_json/schema.md index 00f19b0377f..c28f6cd81ee 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_small_number_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_by_small_number_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**by_small_number.BySmallNumber**](../../../../../../../components/schema/by_small_number.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**by_small_number.BySmallNumber**](../../../../../../components/schema/by_small_number.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_const_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_const_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md index e50b2cdf758..30d0d056e34 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_const_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_const_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**const_nul_characters_in_strings.ConstNulCharactersInStrings**](../../../../../../../components/schema/const_nul_characters_in_strings.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**const_nul_characters_in_strings.ConstNulCharactersInStrings**](../../../../../../components/schema/const_nul_characters_in_strings.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_contains_keyword_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_contains_keyword_validation_request_body/post/request_body/content/application_json/schema.md index 7ce4455d91d..8f336d13389 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_contains_keyword_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_contains_keyword_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**contains_keyword_validation.ContainsKeywordValidation**](../../../../../../../components/schema/contains_keyword_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**contains_keyword_validation.ContainsKeywordValidation**](../../../../../../components/schema/contains_keyword_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_contains_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_contains_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md index d9def508342..ffd97f6ebd0 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_contains_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_contains_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**contains_with_null_instance_elements.ContainsWithNullInstanceElements**](../../../../../../../components/schema/contains_with_null_instance_elements.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**contains_with_null_instance_elements.ContainsWithNullInstanceElements**](../../../../../../components/schema/contains_with_null_instance_elements.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_date_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_date_format_request_body/post/request_body/content/application_json/schema.md index 7722db56270..5e85e60eb25 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_date_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_date_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**date_format.DateFormat**](../../../../../../../components/schema/date_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**date_format.DateFormat**](../../../../../../components/schema/date_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_date_time_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_date_time_format_request_body/post/request_body/content/application_json/schema.md index 5d3e37ea7aa..4ee030b8fde 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_date_time_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_date_time_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**date_time_format.DateTimeFormat**](../../../../../../../components/schema/date_time_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**date_time_format.DateTimeFormat**](../../../../../../components/schema/date_time_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_dependencies_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_dependencies_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md index b469db081c2..e550f22bab1 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_dependencies_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_dependencies_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**dependent_schemas_dependencies_with_escaped_characters.DependentSchemasDependenciesWithEscapedCharacters**](../../../../../../../components/schema/dependent_schemas_dependencies_with_escaped_characters.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**dependent_schemas_dependencies_with_escaped_characters.DependentSchemasDependenciesWithEscapedCharacters**](../../../../../../components/schema/dependent_schemas_dependencies_with_escaped_characters.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_dependent_subschema_incompatible_with_root_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_dependent_subschema_incompatible_with_root_request_body/post/request_body/content/application_json/schema.md index a15cc44b17c..8071da69ce8 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_dependent_subschema_incompatible_with_root_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_dependent_subschema_incompatible_with_root_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**dependent_schemas_dependent_subschema_incompatible_with_root.DependentSchemasDependentSubschemaIncompatibleWithRoot**](../../../../../../../components/schema/dependent_schemas_dependent_subschema_incompatible_with_root.md) | [dependent_schemas_dependent_subschema_incompatible_with_root.DependentSchemasDependentSubschemaIncompatibleWithRootDictInput](../../../../../../../components/schema/dependent_schemas_dependent_subschema_incompatible_with_root.md#dependentschemasdependentsubschemaincompatiblewithrootdictinput), [dependent_schemas_dependent_subschema_incompatible_with_root.DependentSchemasDependentSubschemaIncompatibleWithRootDict](../../../../../../../components/schema/dependent_schemas_dependent_subschema_incompatible_with_root.md#dependentschemasdependentsubschemaincompatiblewithrootdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [dependent_schemas_dependent_subschema_incompatible_with_root.DependentSchemasDependentSubschemaIncompatibleWithRootDict](../../../../../../../components/schema/dependent_schemas_dependent_subschema_incompatible_with_root.md#dependentschemasdependentsubschemaincompatiblewithrootdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**dependent_schemas_dependent_subschema_incompatible_with_root.DependentSchemasDependentSubschemaIncompatibleWithRoot**](../../../../../../components/schema/dependent_schemas_dependent_subschema_incompatible_with_root.md) | [dependent_schemas_dependent_subschema_incompatible_with_root.DependentSchemasDependentSubschemaIncompatibleWithRootDictInput](../../../../../../components/schema/dependent_schemas_dependent_subschema_incompatible_with_root.md#dependentschemasdependentsubschemaincompatiblewithrootdictinput), [dependent_schemas_dependent_subschema_incompatible_with_root.DependentSchemasDependentSubschemaIncompatibleWithRootDict](../../../../../../components/schema/dependent_schemas_dependent_subschema_incompatible_with_root.md#dependentschemasdependentsubschemaincompatiblewithrootdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [dependent_schemas_dependent_subschema_incompatible_with_root.DependentSchemasDependentSubschemaIncompatibleWithRootDict](../../../../../../components/schema/dependent_schemas_dependent_subschema_incompatible_with_root.md#dependentschemasdependentsubschemaincompatiblewithrootdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_single_dependency_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_single_dependency_request_body/post/request_body/content/application_json/schema.md index b1bb79135b5..7dadeac4844 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_single_dependency_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_dependent_schemas_single_dependency_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**dependent_schemas_single_dependency.DependentSchemasSingleDependency**](../../../../../../../components/schema/dependent_schemas_single_dependency.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**dependent_schemas_single_dependency.DependentSchemasSingleDependency**](../../../../../../components/schema/dependent_schemas_single_dependency.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_duration_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_duration_format_request_body/post/request_body/content/application_json/schema.md index 880c1a0cbfc..fb47b81d133 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_duration_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_duration_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**duration_format.DurationFormat**](../../../../../../../components/schema/duration_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**duration_format.DurationFormat**](../../../../../../components/schema/duration_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_email_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_email_format_request_body/post/request_body/content/application_json/schema.md index fb1e8b62280..974937db72e 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_email_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_email_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**email_format.EmailFormat**](../../../../../../../components/schema/email_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**email_format.EmailFormat**](../../../../../../components/schema/email_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_empty_dependents_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_empty_dependents_request_body/post/request_body/content/application_json/schema.md index 12c2ceb2089..23dfe4525f4 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_empty_dependents_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_empty_dependents_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**empty_dependents.EmptyDependents**](../../../../../../../components/schema/empty_dependents.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**empty_dependents.EmptyDependents**](../../../../../../components/schema/empty_dependents.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/request_body/content/application_json/schema.md index de8ba85d69d..b1c22126c5c 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enum_with0_does_not_match_false.EnumWith0DoesNotMatchFalse**](../../../../../../../components/schema/enum_with0_does_not_match_false.md) | float, int | float, int +[**enum_with0_does_not_match_false.EnumWith0DoesNotMatchFalse**](../../../../../../components/schema/enum_with0_does_not_match_false.md) | float, int | float, int diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/request_body/content/application_json/schema.md index c33ae5f4ef3..ae0582b30ae 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enum_with1_does_not_match_true.EnumWith1DoesNotMatchTrue**](../../../../../../../components/schema/enum_with1_does_not_match_true.md) | float, int | float, int +[**enum_with1_does_not_match_true.EnumWith1DoesNotMatchTrue**](../../../../../../components/schema/enum_with1_does_not_match_true.md) | float, int | float, int diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md index 3b6d9990185..78f2317fd16 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enum_with_escaped_characters.EnumWithEscapedCharacters**](../../../../../../../components/schema/enum_with_escaped_characters.md) | typing.Literal["foo\nbar", "foo\rbar"] | typing.Literal["foo\nbar", "foo\rbar"] +[**enum_with_escaped_characters.EnumWithEscapedCharacters**](../../../../../../components/schema/enum_with_escaped_characters.md) | typing.Literal["foo\nbar", "foo\rbar"] | typing.Literal["foo\nbar", "foo\rbar"] diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/request_body/content/application_json/schema.md index 4003cf8b89a..47d26f0447e 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enum_with_false_does_not_match0.EnumWithFalseDoesNotMatch0**](../../../../../../../components/schema/enum_with_false_does_not_match0.md) | typing.Literal[False] | typing.Literal[False] +[**enum_with_false_does_not_match0.EnumWithFalseDoesNotMatch0**](../../../../../../components/schema/enum_with_false_does_not_match0.md) | typing.Literal[False] | typing.Literal[False] diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/request_body/content/application_json/schema.md index 9855ad78737..61dec2ef327 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enum_with_true_does_not_match1.EnumWithTrueDoesNotMatch1**](../../../../../../../components/schema/enum_with_true_does_not_match1.md) | typing.Literal[True] | typing.Literal[True] +[**enum_with_true_does_not_match1.EnumWithTrueDoesNotMatch1**](../../../../../../components/schema/enum_with_true_does_not_match1.md) | typing.Literal[True] | typing.Literal[True] diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enums_in_properties_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enums_in_properties_request_body/post/request_body/content/application_json/schema.md index 5c74189a5d1..24bdfbe832e 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enums_in_properties_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_enums_in_properties_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**enums_in_properties.EnumsInProperties**](../../../../../../../components/schema/enums_in_properties.md) | [enums_in_properties.EnumsInPropertiesDictInput](../../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdictinput), [enums_in_properties.EnumsInPropertiesDict](../../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdict) | [enums_in_properties.EnumsInPropertiesDict](../../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdict) +[**enums_in_properties.EnumsInProperties**](../../../../../../components/schema/enums_in_properties.md) | [enums_in_properties.EnumsInPropertiesDictInput](../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdictinput), [enums_in_properties.EnumsInPropertiesDict](../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdict) | [enums_in_properties.EnumsInPropertiesDict](../../../../../../components/schema/enums_in_properties.md#enumsinpropertiesdict) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_exclusivemaximum_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_exclusivemaximum_validation_request_body/post/request_body/content/application_json/schema.md index 02ce4295931..7d3302e6fa0 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_exclusivemaximum_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_exclusivemaximum_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**exclusivemaximum_validation.ExclusivemaximumValidation**](../../../../../../../components/schema/exclusivemaximum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**exclusivemaximum_validation.ExclusivemaximumValidation**](../../../../../../components/schema/exclusivemaximum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_exclusiveminimum_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_exclusiveminimum_validation_request_body/post/request_body/content/application_json/schema.md index b579055eb9a..1f5f85f291d 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_exclusiveminimum_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_exclusiveminimum_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**exclusiveminimum_validation.ExclusiveminimumValidation**](../../../../../../../components/schema/exclusiveminimum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**exclusiveminimum_validation.ExclusiveminimumValidation**](../../../../../../components/schema/exclusiveminimum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_float_division_inf_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_float_division_inf_request_body/post/request_body/content/application_json/schema.md index d2d80969f3d..d247a078dde 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_float_division_inf_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_float_division_inf_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**float_division_inf.FloatDivisionInf**](../../../../../../../components/schema/float_division_inf.md) | int | int +[**float_division_inf.FloatDivisionInf**](../../../../../../components/schema/float_division_inf.md) | int | int diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_forbidden_property_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_forbidden_property_request_body/post/request_body/content/application_json/schema.md index 35de71070ad..1cea2248aca 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_forbidden_property_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_forbidden_property_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**forbidden_property.ForbiddenProperty**](../../../../../../../components/schema/forbidden_property.md) | [forbidden_property.ForbiddenPropertyDictInput](../../../../../../../components/schema/forbidden_property.md#forbiddenpropertydictinput), [forbidden_property.ForbiddenPropertyDict](../../../../../../../components/schema/forbidden_property.md#forbiddenpropertydict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [forbidden_property.ForbiddenPropertyDict](../../../../../../../components/schema/forbidden_property.md#forbiddenpropertydict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**forbidden_property.ForbiddenProperty**](../../../../../../components/schema/forbidden_property.md) | [forbidden_property.ForbiddenPropertyDictInput](../../../../../../components/schema/forbidden_property.md#forbiddenpropertydictinput), [forbidden_property.ForbiddenPropertyDict](../../../../../../components/schema/forbidden_property.md#forbiddenpropertydict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [forbidden_property.ForbiddenPropertyDict](../../../../../../components/schema/forbidden_property.md#forbiddenpropertydict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_hostname_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_hostname_format_request_body/post/request_body/content/application_json/schema.md index 506fa5ff35e..f20255c1d69 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_hostname_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_hostname_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**hostname_format.HostnameFormat**](../../../../../../../components/schema/hostname_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**hostname_format.HostnameFormat**](../../../../../../components/schema/hostname_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_idn_email_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_idn_email_format_request_body/post/request_body/content/application_json/schema.md index 335333f4dc6..3066c211b67 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_idn_email_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_idn_email_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**idn_email_format.IdnEmailFormat**](../../../../../../../components/schema/idn_email_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**idn_email_format.IdnEmailFormat**](../../../../../../components/schema/idn_email_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_idn_hostname_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_idn_hostname_format_request_body/post/request_body/content/application_json/schema.md index 1acff87c1ee..bc59f74ccb6 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_idn_hostname_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_idn_hostname_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**idn_hostname_format.IdnHostnameFormat**](../../../../../../../components/schema/idn_hostname_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**idn_hostname_format.IdnHostnameFormat**](../../../../../../components/schema/idn_hostname_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_and_else_without_then_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_and_else_without_then_request_body/post/request_body/content/application_json/schema.md index ba90f5fd910..98d7142e712 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_and_else_without_then_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_and_else_without_then_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**if_and_else_without_then.IfAndElseWithoutThen**](../../../../../../../components/schema/if_and_else_without_then.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**if_and_else_without_then.IfAndElseWithoutThen**](../../../../../../components/schema/if_and_else_without_then.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_and_then_without_else_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_and_then_without_else_request_body/post/request_body/content/application_json/schema.md index fc91ef8a43a..b3399100625 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_and_then_without_else_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_and_then_without_else_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**if_and_then_without_else.IfAndThenWithoutElse**](../../../../../../../components/schema/if_and_then_without_else.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**if_and_then_without_else.IfAndThenWithoutElse**](../../../../../../components/schema/if_and_then_without_else.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_appears_at_the_end_when_serialized_keyword_processing_sequence_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_appears_at_the_end_when_serialized_keyword_processing_sequence_request_body/post/request_body/content/application_json/schema.md index 1fcbc9b786a..32b4a344c6f 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_appears_at_the_end_when_serialized_keyword_processing_sequence_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_if_appears_at_the_end_when_serialized_keyword_processing_sequence_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**if_appears_at_the_end_when_serialized_keyword_processing_sequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence**](../../../../../../../components/schema/if_appears_at_the_end_when_serialized_keyword_processing_sequence.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**if_appears_at_the_end_when_serialized_keyword_processing_sequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence**](../../../../../../components/schema/if_appears_at_the_end_when_serialized_keyword_processing_sequence.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_else_without_if_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_else_without_if_request_body/post/request_body/content/application_json/schema.md index fad10853af5..bc57c8885fb 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_else_without_if_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_else_without_if_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ignore_else_without_if.IgnoreElseWithoutIf**](../../../../../../../components/schema/ignore_else_without_if.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**ignore_else_without_if.IgnoreElseWithoutIf**](../../../../../../components/schema/ignore_else_without_if.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_if_without_then_or_else_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_if_without_then_or_else_request_body/post/request_body/content/application_json/schema.md index 69f4b14b73a..e7792808593 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_if_without_then_or_else_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_if_without_then_or_else_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ignore_if_without_then_or_else.IgnoreIfWithoutThenOrElse**](../../../../../../../components/schema/ignore_if_without_then_or_else.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**ignore_if_without_then_or_else.IgnoreIfWithoutThenOrElse**](../../../../../../components/schema/ignore_if_without_then_or_else.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_then_without_if_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_then_without_if_request_body/post/request_body/content/application_json/schema.md index fd2f743c262..18b79f7527d 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_then_without_if_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ignore_then_without_if_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ignore_then_without_if.IgnoreThenWithoutIf**](../../../../../../../components/schema/ignore_then_without_if.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**ignore_then_without_if.IgnoreThenWithoutIf**](../../../../../../components/schema/ignore_then_without_if.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_integer_type_matches_integers_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_integer_type_matches_integers_request_body/post/request_body/content/application_json/schema.md index 792ecefa878..60d32ee904d 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_integer_type_matches_integers_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_integer_type_matches_integers_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**integer_type_matches_integers.IntegerTypeMatchesIntegers**](../../../../../../../components/schema/integer_type_matches_integers.md) | int | int +[**integer_type_matches_integers.IntegerTypeMatchesIntegers**](../../../../../../components/schema/integer_type_matches_integers.md) | int | int diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ipv4_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ipv4_format_request_body/post/request_body/content/application_json/schema.md index 0cb5e8d784a..ca004a2d750 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ipv4_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ipv4_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ipv4_format.Ipv4Format**](../../../../../../../components/schema/ipv4_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**ipv4_format.Ipv4Format**](../../../../../../components/schema/ipv4_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ipv6_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ipv6_format_request_body/post/request_body/content/application_json/schema.md index 6309b9ef444..3d261734f81 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ipv6_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_ipv6_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**ipv6_format.Ipv6Format**](../../../../../../../components/schema/ipv6_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**ipv6_format.Ipv6Format**](../../../../../../components/schema/ipv6_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_iri_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_iri_format_request_body/post/request_body/content/application_json/schema.md index 063da90b553..830f3d190c2 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_iri_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_iri_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**iri_format.IriFormat**](../../../../../../../components/schema/iri_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**iri_format.IriFormat**](../../../../../../components/schema/iri_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_iri_reference_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_iri_reference_format_request_body/post/request_body/content/application_json/schema.md index 88d64d3d3c2..4330ce19551 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_iri_reference_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_iri_reference_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**iri_reference_format.IriReferenceFormat**](../../../../../../../components/schema/iri_reference_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**iri_reference_format.IriReferenceFormat**](../../../../../../components/schema/iri_reference_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_contains_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_contains_request_body/post/request_body/content/application_json/schema.md index 3011a414e1f..5eb79b9c1e5 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_contains_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_contains_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**items_contains.ItemsContains**](../../../../../../../components/schema/items_contains.md) | [items_contains.ItemsContainsTupleInput](../../../../../../../components/schema/items_contains.md#itemscontainstupleinput), [items_contains.ItemsContainsTuple](../../../../../../../components/schema/items_contains.md#itemscontainstuple) | [items_contains.ItemsContainsTuple](../../../../../../../components/schema/items_contains.md#itemscontainstuple) +[**items_contains.ItemsContains**](../../../../../../components/schema/items_contains.md) | [items_contains.ItemsContainsTupleInput](../../../../../../components/schema/items_contains.md#itemscontainstupleinput), [items_contains.ItemsContainsTuple](../../../../../../components/schema/items_contains.md#itemscontainstuple) | [items_contains.ItemsContainsTuple](../../../../../../components/schema/items_contains.md#itemscontainstuple) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_does_not_look_in_applicators_valid_case_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_does_not_look_in_applicators_valid_case_request_body/post/request_body/content/application_json/schema.md index c3769df85b2..4fb8ee44bd3 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_does_not_look_in_applicators_valid_case_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_does_not_look_in_applicators_valid_case_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**items_does_not_look_in_applicators_valid_case.ItemsDoesNotLookInApplicatorsValidCase**](../../../../../../../components/schema/items_does_not_look_in_applicators_valid_case.md) | [items_does_not_look_in_applicators_valid_case.ItemsDoesNotLookInApplicatorsValidCaseTupleInput](../../../../../../../components/schema/items_does_not_look_in_applicators_valid_case.md#itemsdoesnotlookinapplicatorsvalidcasetupleinput), [items_does_not_look_in_applicators_valid_case.ItemsDoesNotLookInApplicatorsValidCaseTuple](../../../../../../../components/schema/items_does_not_look_in_applicators_valid_case.md#itemsdoesnotlookinapplicatorsvalidcasetuple) | [items_does_not_look_in_applicators_valid_case.ItemsDoesNotLookInApplicatorsValidCaseTuple](../../../../../../../components/schema/items_does_not_look_in_applicators_valid_case.md#itemsdoesnotlookinapplicatorsvalidcasetuple) +[**items_does_not_look_in_applicators_valid_case.ItemsDoesNotLookInApplicatorsValidCase**](../../../../../../components/schema/items_does_not_look_in_applicators_valid_case.md) | [items_does_not_look_in_applicators_valid_case.ItemsDoesNotLookInApplicatorsValidCaseTupleInput](../../../../../../components/schema/items_does_not_look_in_applicators_valid_case.md#itemsdoesnotlookinapplicatorsvalidcasetupleinput), [items_does_not_look_in_applicators_valid_case.ItemsDoesNotLookInApplicatorsValidCaseTuple](../../../../../../components/schema/items_does_not_look_in_applicators_valid_case.md#itemsdoesnotlookinapplicatorsvalidcasetuple) | [items_does_not_look_in_applicators_valid_case.ItemsDoesNotLookInApplicatorsValidCaseTuple](../../../../../../components/schema/items_does_not_look_in_applicators_valid_case.md#itemsdoesnotlookinapplicatorsvalidcasetuple) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md index dc4bb5c4fb2..7a3f112819d 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_items_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**items_with_null_instance_elements.ItemsWithNullInstanceElements**](../../../../../../../components/schema/items_with_null_instance_elements.md) | [items_with_null_instance_elements.ItemsWithNullInstanceElementsTupleInput](../../../../../../../components/schema/items_with_null_instance_elements.md#itemswithnullinstanceelementstupleinput), [items_with_null_instance_elements.ItemsWithNullInstanceElementsTuple](../../../../../../../components/schema/items_with_null_instance_elements.md#itemswithnullinstanceelementstuple) | [items_with_null_instance_elements.ItemsWithNullInstanceElementsTuple](../../../../../../../components/schema/items_with_null_instance_elements.md#itemswithnullinstanceelementstuple) +[**items_with_null_instance_elements.ItemsWithNullInstanceElements**](../../../../../../components/schema/items_with_null_instance_elements.md) | [items_with_null_instance_elements.ItemsWithNullInstanceElementsTupleInput](../../../../../../components/schema/items_with_null_instance_elements.md#itemswithnullinstanceelementstupleinput), [items_with_null_instance_elements.ItemsWithNullInstanceElementsTuple](../../../../../../components/schema/items_with_null_instance_elements.md#itemswithnullinstanceelementstuple) | [items_with_null_instance_elements.ItemsWithNullInstanceElementsTuple](../../../../../../components/schema/items_with_null_instance_elements.md#itemswithnullinstanceelementstuple) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_json_pointer_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_json_pointer_format_request_body/post/request_body/content/application_json/schema.md index 931e9f2492e..e9f4c9af94e 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_json_pointer_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_json_pointer_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**json_pointer_format.JsonPointerFormat**](../../../../../../../components/schema/json_pointer_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**json_pointer_format.JsonPointerFormat**](../../../../../../components/schema/json_pointer_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxcontains_without_contains_is_ignored_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxcontains_without_contains_is_ignored_request_body/post/request_body/content/application_json/schema.md index 824af8403b0..82665d62e06 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxcontains_without_contains_is_ignored_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxcontains_without_contains_is_ignored_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maxcontains_without_contains_is_ignored.MaxcontainsWithoutContainsIsIgnored**](../../../../../../../components/schema/maxcontains_without_contains_is_ignored.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maxcontains_without_contains_is_ignored.MaxcontainsWithoutContainsIsIgnored**](../../../../../../components/schema/maxcontains_without_contains_is_ignored.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maximum_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maximum_validation_request_body/post/request_body/content/application_json/schema.md index 41cf8410efe..d15afc41ca0 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maximum_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maximum_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maximum_validation.MaximumValidation**](../../../../../../../components/schema/maximum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maximum_validation.MaximumValidation**](../../../../../../components/schema/maximum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/request_body/content/application_json/schema.md index ae379cdb520..09608e97f83 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maximum_validation_with_unsigned_integer.MaximumValidationWithUnsignedInteger**](../../../../../../../components/schema/maximum_validation_with_unsigned_integer.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maximum_validation_with_unsigned_integer.MaximumValidationWithUnsignedInteger**](../../../../../../components/schema/maximum_validation_with_unsigned_integer.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxitems_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxitems_validation_request_body/post/request_body/content/application_json/schema.md index b0d4ed03ef1..0545b03b8bb 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxitems_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxitems_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maxitems_validation.MaxitemsValidation**](../../../../../../../components/schema/maxitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maxitems_validation.MaxitemsValidation**](../../../../../../components/schema/maxitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxlength_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxlength_validation_request_body/post/request_body/content/application_json/schema.md index 97d88c0751f..8490f77167e 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxlength_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxlength_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maxlength_validation.MaxlengthValidation**](../../../../../../../components/schema/maxlength_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maxlength_validation.MaxlengthValidation**](../../../../../../components/schema/maxlength_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/request_body/content/application_json/schema.md index 2b782d611af..23491da0895 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maxproperties0_means_the_object_is_empty.Maxproperties0MeansTheObjectIsEmpty**](../../../../../../../components/schema/maxproperties0_means_the_object_is_empty.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maxproperties0_means_the_object_is_empty.Maxproperties0MeansTheObjectIsEmpty**](../../../../../../components/schema/maxproperties0_means_the_object_is_empty.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxproperties_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxproperties_validation_request_body/post/request_body/content/application_json/schema.md index 9e6efd826c1..e8d6c7b63aa 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxproperties_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_maxproperties_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**maxproperties_validation.MaxpropertiesValidation**](../../../../../../../components/schema/maxproperties_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**maxproperties_validation.MaxpropertiesValidation**](../../../../../../components/schema/maxproperties_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_mincontains_without_contains_is_ignored_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_mincontains_without_contains_is_ignored_request_body/post/request_body/content/application_json/schema.md index cc5fecd9fa4..536f178d8f8 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_mincontains_without_contains_is_ignored_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_mincontains_without_contains_is_ignored_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**mincontains_without_contains_is_ignored.MincontainsWithoutContainsIsIgnored**](../../../../../../../components/schema/mincontains_without_contains_is_ignored.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**mincontains_without_contains_is_ignored.MincontainsWithoutContainsIsIgnored**](../../../../../../components/schema/mincontains_without_contains_is_ignored.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minimum_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minimum_validation_request_body/post/request_body/content/application_json/schema.md index 1d8afa07caf..97bc3971f28 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minimum_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minimum_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**minimum_validation.MinimumValidation**](../../../../../../../components/schema/minimum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**minimum_validation.MinimumValidation**](../../../../../../components/schema/minimum_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/request_body/content/application_json/schema.md index 5c9e480067d..99e7aac0d11 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**minimum_validation_with_signed_integer.MinimumValidationWithSignedInteger**](../../../../../../../components/schema/minimum_validation_with_signed_integer.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**minimum_validation_with_signed_integer.MinimumValidationWithSignedInteger**](../../../../../../components/schema/minimum_validation_with_signed_integer.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minitems_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minitems_validation_request_body/post/request_body/content/application_json/schema.md index e704c3bd59e..4e3e90e85b6 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minitems_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minitems_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**minitems_validation.MinitemsValidation**](../../../../../../../components/schema/minitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**minitems_validation.MinitemsValidation**](../../../../../../components/schema/minitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minlength_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minlength_validation_request_body/post/request_body/content/application_json/schema.md index a9b7ba877b6..99cf03afd28 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minlength_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minlength_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**minlength_validation.MinlengthValidation**](../../../../../../../components/schema/minlength_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**minlength_validation.MinlengthValidation**](../../../../../../components/schema/minlength_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minproperties_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minproperties_validation_request_body/post/request_body/content/application_json/schema.md index 3071db209c8..8b19010bb58 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minproperties_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_minproperties_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**minproperties_validation.MinpropertiesValidation**](../../../../../../../components/schema/minproperties_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**minproperties_validation.MinpropertiesValidation**](../../../../../../components/schema/minproperties_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_dependents_required_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_dependents_required_request_body/post/request_body/content/application_json/schema.md index 9702bed8360..95573cd179c 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_dependents_required_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_dependents_required_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**multiple_dependents_required.MultipleDependentsRequired**](../../../../../../../components/schema/multiple_dependents_required.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**multiple_dependents_required.MultipleDependentsRequired**](../../../../../../components/schema/multiple_dependents_required.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_simultaneous_patternproperties_are_validated_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_simultaneous_patternproperties_are_validated_request_body/post/request_body/content/application_json/schema.md index 613b81db129..2730ea8b296 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_simultaneous_patternproperties_are_validated_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_simultaneous_patternproperties_are_validated_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**multiple_simultaneous_patternproperties_are_validated.MultipleSimultaneousPatternpropertiesAreValidated**](../../../../../../../components/schema/multiple_simultaneous_patternproperties_are_validated.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**multiple_simultaneous_patternproperties_are_validated.MultipleSimultaneousPatternpropertiesAreValidated**](../../../../../../components/schema/multiple_simultaneous_patternproperties_are_validated.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_types_can_be_specified_in_an_array_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_types_can_be_specified_in_an_array_request_body/post/request_body/content/application_json/schema.md index 096c7775d39..b534cd678c4 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_types_can_be_specified_in_an_array_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_multiple_types_can_be_specified_in_an_array_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**multiple_types_can_be_specified_in_an_array.MultipleTypesCanBeSpecifiedInAnArray**](../../../../../../../components/schema/multiple_types_can_be_specified_in_an_array.md) | int, str | int, str +[**multiple_types_can_be_specified_in_an_array.MultipleTypesCanBeSpecifiedInAnArray**](../../../../../../components/schema/multiple_types_can_be_specified_in_an_array.md) | int, str | int, str diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md index a32ab420895..ae6aac7f049 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**nested_allof_to_check_validation_semantics.NestedAllofToCheckValidationSemantics**](../../../../../../../components/schema/nested_allof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**nested_allof_to_check_validation_semantics.NestedAllofToCheckValidationSemantics**](../../../../../../components/schema/nested_allof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md index 2d4aec6b010..42f068abc10 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**nested_anyof_to_check_validation_semantics.NestedAnyofToCheckValidationSemantics**](../../../../../../../components/schema/nested_anyof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**nested_anyof_to_check_validation_semantics.NestedAnyofToCheckValidationSemantics**](../../../../../../components/schema/nested_anyof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_items_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_items_request_body/post/request_body/content/application_json/schema.md index 0d870bdc405..80c7d114b77 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_items_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_items_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**nested_items.NestedItems**](../../../../../../../components/schema/nested_items.md) | [nested_items.NestedItemsTupleInput](../../../../../../../components/schema/nested_items.md#nesteditemstupleinput), [nested_items.NestedItemsTuple](../../../../../../../components/schema/nested_items.md#nesteditemstuple) | [nested_items.NestedItemsTuple](../../../../../../../components/schema/nested_items.md#nesteditemstuple) +[**nested_items.NestedItems**](../../../../../../components/schema/nested_items.md) | [nested_items.NestedItemsTupleInput](../../../../../../components/schema/nested_items.md#nesteditemstupleinput), [nested_items.NestedItemsTuple](../../../../../../components/schema/nested_items.md#nesteditemstuple) | [nested_items.NestedItemsTuple](../../../../../../components/schema/nested_items.md#nesteditemstuple) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md index 9d09a910d8f..e7e9a26a7d3 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**nested_oneof_to_check_validation_semantics.NestedOneofToCheckValidationSemantics**](../../../../../../../components/schema/nested_oneof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**nested_oneof_to_check_validation_semantics.NestedOneofToCheckValidationSemantics**](../../../../../../components/schema/nested_oneof_to_check_validation_semantics.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_non_ascii_pattern_with_additionalproperties_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_non_ascii_pattern_with_additionalproperties_request_body/post/request_body/content/application_json/schema.md index f7c8d18bfc6..668eed08815 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_non_ascii_pattern_with_additionalproperties_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_non_ascii_pattern_with_additionalproperties_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**non_ascii_pattern_with_additionalproperties.NonAsciiPatternWithAdditionalproperties**](../../../../../../../components/schema/non_ascii_pattern_with_additionalproperties.md) | [non_ascii_pattern_with_additionalproperties.NonAsciiPatternWithAdditionalpropertiesDictInput](../../../../../../../components/schema/non_ascii_pattern_with_additionalproperties.md#nonasciipatternwithadditionalpropertiesdictinput), [non_ascii_pattern_with_additionalproperties.NonAsciiPatternWithAdditionalpropertiesDict](../../../../../../../components/schema/non_ascii_pattern_with_additionalproperties.md#nonasciipatternwithadditionalpropertiesdict) | [non_ascii_pattern_with_additionalproperties.NonAsciiPatternWithAdditionalpropertiesDict](../../../../../../../components/schema/non_ascii_pattern_with_additionalproperties.md#nonasciipatternwithadditionalpropertiesdict) +[**non_ascii_pattern_with_additionalproperties.NonAsciiPatternWithAdditionalproperties**](../../../../../../components/schema/non_ascii_pattern_with_additionalproperties.md) | [non_ascii_pattern_with_additionalproperties.NonAsciiPatternWithAdditionalpropertiesDictInput](../../../../../../components/schema/non_ascii_pattern_with_additionalproperties.md#nonasciipatternwithadditionalpropertiesdictinput), [non_ascii_pattern_with_additionalproperties.NonAsciiPatternWithAdditionalpropertiesDict](../../../../../../components/schema/non_ascii_pattern_with_additionalproperties.md#nonasciipatternwithadditionalpropertiesdict) | [non_ascii_pattern_with_additionalproperties.NonAsciiPatternWithAdditionalpropertiesDict](../../../../../../components/schema/non_ascii_pattern_with_additionalproperties.md#nonasciipatternwithadditionalpropertiesdict) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_non_interference_across_combined_schemas_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_non_interference_across_combined_schemas_request_body/post/request_body/content/application_json/schema.md index 768fae17712..209d98f7ef7 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_non_interference_across_combined_schemas_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_non_interference_across_combined_schemas_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**non_interference_across_combined_schemas.NonInterferenceAcrossCombinedSchemas**](../../../../../../../components/schema/non_interference_across_combined_schemas.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**non_interference_across_combined_schemas.NonInterferenceAcrossCombinedSchemas**](../../../../../../components/schema/non_interference_across_combined_schemas.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_more_complex_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_more_complex_schema_request_body/post/request_body/content/application_json/schema.md index 4df28782209..08e9439d9f2 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_more_complex_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_more_complex_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**not_more_complex_schema.NotMoreComplexSchema**](../../../../../../../components/schema/not_more_complex_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**not_more_complex_schema.NotMoreComplexSchema**](../../../../../../components/schema/not_more_complex_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_multiple_types_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_multiple_types_request_body/post/request_body/content/application_json/schema.md index bbf298dabc3..717619a0fbd 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_multiple_types_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_multiple_types_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**not_multiple_types.NotMultipleTypes**](../../../../../../../components/schema/not_multiple_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**not_multiple_types.NotMultipleTypes**](../../../../../../components/schema/not_multiple_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_request_body/post/request_body/content/application_json/schema.md index ba78ba3a0ce..7010931a423 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_not_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**_not._Not**](../../../../../../../components/schema/_not.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**_not._Not**](../../../../../../components/schema/_not.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md index 6ad53749272..92934bcd2c4 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_nul_characters_in_strings_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**nul_characters_in_strings.NulCharactersInStrings**](../../../../../../../components/schema/nul_characters_in_strings.md) | typing.Literal["hello\x00there"] | typing.Literal["hello\x00there"] +[**nul_characters_in_strings.NulCharactersInStrings**](../../../../../../components/schema/nul_characters_in_strings.md) | typing.Literal["hello\x00there"] | typing.Literal["hello\x00there"] diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/request_body/content/application_json/schema.md index 81c50edc939..7eea59837be 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**null_type_matches_only_the_null_object.NullTypeMatchesOnlyTheNullObject**](../../../../../../../components/schema/null_type_matches_only_the_null_object.md) | None | None +[**null_type_matches_only_the_null_object.NullTypeMatchesOnlyTheNullObject**](../../../../../../components/schema/null_type_matches_only_the_null_object.md) | None | None diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_number_type_matches_numbers_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_number_type_matches_numbers_request_body/post/request_body/content/application_json/schema.md index 606772f63b4..6b64fee143b 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_number_type_matches_numbers_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_number_type_matches_numbers_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**number_type_matches_numbers.NumberTypeMatchesNumbers**](../../../../../../../components/schema/number_type_matches_numbers.md) | float, int | float, int +[**number_type_matches_numbers.NumberTypeMatchesNumbers**](../../../../../../components/schema/number_type_matches_numbers.md) | float, int | float, int diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_object_properties_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_object_properties_validation_request_body/post/request_body/content/application_json/schema.md index 1d16c9cd535..fd37d90a137 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_object_properties_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_object_properties_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**object_properties_validation.ObjectPropertiesValidation**](../../../../../../../components/schema/object_properties_validation.md) | [object_properties_validation.ObjectPropertiesValidationDictInput](../../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdictinput), [object_properties_validation.ObjectPropertiesValidationDict](../../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [object_properties_validation.ObjectPropertiesValidationDict](../../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**object_properties_validation.ObjectPropertiesValidation**](../../../../../../components/schema/object_properties_validation.md) | [object_properties_validation.ObjectPropertiesValidationDictInput](../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdictinput), [object_properties_validation.ObjectPropertiesValidationDict](../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [object_properties_validation.ObjectPropertiesValidationDict](../../../../../../components/schema/object_properties_validation.md#objectpropertiesvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_object_type_matches_objects_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_object_type_matches_objects_request_body/post/request_body/content/application_json/schema.md index 6f6e5fc77a5..12c3b278d60 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_object_type_matches_objects_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_object_type_matches_objects_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**object_type_matches_objects.ObjectTypeMatchesObjects**](../../../../../../../components/schema/object_type_matches_objects.md) | dict, schemas.immutabledict | schemas.immutabledict +[**object_type_matches_objects.ObjectTypeMatchesObjects**](../../../../../../components/schema/object_type_matches_objects.md) | dict, schemas.immutabledict | schemas.immutabledict diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_complex_types_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_complex_types_request_body/post/request_body/content/application_json/schema.md index 5858bfc003a..7394ae5b152 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_complex_types_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_complex_types_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**oneof_complex_types.OneofComplexTypes**](../../../../../../../components/schema/oneof_complex_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**oneof_complex_types.OneofComplexTypes**](../../../../../../components/schema/oneof_complex_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_request_body/post/request_body/content/application_json/schema.md index 44f80216af5..92ab9ebb75e 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**oneof.Oneof**](../../../../../../../components/schema/oneof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**oneof.Oneof**](../../../../../../components/schema/oneof.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_base_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_base_schema_request_body/post/request_body/content/application_json/schema.md index 2084a568920..acacec5d96d 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_base_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_base_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**oneof_with_base_schema.OneofWithBaseSchema**](../../../../../../../components/schema/oneof_with_base_schema.md) | str | str +[**oneof_with_base_schema.OneofWithBaseSchema**](../../../../../../components/schema/oneof_with_base_schema.md) | str | str diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_empty_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_empty_schema_request_body/post/request_body/content/application_json/schema.md index 023c37b1eca..4b052ab501c 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_empty_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_empty_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**oneof_with_empty_schema.OneofWithEmptySchema**](../../../../../../../components/schema/oneof_with_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**oneof_with_empty_schema.OneofWithEmptySchema**](../../../../../../components/schema/oneof_with_empty_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_required_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_required_request_body/post/request_body/content/application_json/schema.md index ad461179a5b..f3e5e1cb7b8 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_required_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_oneof_with_required_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**oneof_with_required.OneofWithRequired**](../../../../../../../components/schema/oneof_with_required.md) | dict, schemas.immutabledict | schemas.immutabledict +[**oneof_with_required.OneofWithRequired**](../../../../../../components/schema/oneof_with_required.md) | dict, schemas.immutabledict | schemas.immutabledict diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_pattern_is_not_anchored_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_pattern_is_not_anchored_request_body/post/request_body/content/application_json/schema.md index 45a6c609a06..2d899fd1e10 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_pattern_is_not_anchored_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_pattern_is_not_anchored_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**pattern_is_not_anchored.PatternIsNotAnchored**](../../../../../../../components/schema/pattern_is_not_anchored.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**pattern_is_not_anchored.PatternIsNotAnchored**](../../../../../../components/schema/pattern_is_not_anchored.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_pattern_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_pattern_validation_request_body/post/request_body/content/application_json/schema.md index 823a39e922c..9c35d0ecea7 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_pattern_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_pattern_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**pattern_validation.PatternValidation**](../../../../../../../components/schema/pattern_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**pattern_validation.PatternValidation**](../../../../../../components/schema/pattern_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_patternproperties_validates_properties_matching_a_regex_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_patternproperties_validates_properties_matching_a_regex_request_body/post/request_body/content/application_json/schema.md index b2d9e01210d..28b561741e8 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_patternproperties_validates_properties_matching_a_regex_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_patternproperties_validates_properties_matching_a_regex_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**patternproperties_validates_properties_matching_a_regex.PatternpropertiesValidatesPropertiesMatchingARegex**](../../../../../../../components/schema/patternproperties_validates_properties_matching_a_regex.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**patternproperties_validates_properties_matching_a_regex.PatternpropertiesValidatesPropertiesMatchingARegex**](../../../../../../components/schema/patternproperties_validates_properties_matching_a_regex.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_patternproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_patternproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md index 1a4b5c10927..1dcd79313b1 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_patternproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_patternproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**patternproperties_with_null_valued_instance_properties.PatternpropertiesWithNullValuedInstanceProperties**](../../../../../../../components/schema/patternproperties_with_null_valued_instance_properties.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**patternproperties_with_null_valued_instance_properties.PatternpropertiesWithNullValuedInstanceProperties**](../../../../../../components/schema/patternproperties_with_null_valued_instance_properties.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_prefixitems_validation_adjusts_the_starting_index_for_items_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_prefixitems_validation_adjusts_the_starting_index_for_items_request_body/post/request_body/content/application_json/schema.md index 6d74afd8911..45da3010df8 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_prefixitems_validation_adjusts_the_starting_index_for_items_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_prefixitems_validation_adjusts_the_starting_index_for_items_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**prefixitems_validation_adjusts_the_starting_index_for_items.PrefixitemsValidationAdjustsTheStartingIndexForItems**](../../../../../../../components/schema/prefixitems_validation_adjusts_the_starting_index_for_items.md) | [prefixitems_validation_adjusts_the_starting_index_for_items.PrefixitemsValidationAdjustsTheStartingIndexForItemsTupleInput](../../../../../../../components/schema/prefixitems_validation_adjusts_the_starting_index_for_items.md#prefixitemsvalidationadjuststhestartingindexforitemstupleinput), [prefixitems_validation_adjusts_the_starting_index_for_items.PrefixitemsValidationAdjustsTheStartingIndexForItemsTuple](../../../../../../../components/schema/prefixitems_validation_adjusts_the_starting_index_for_items.md#prefixitemsvalidationadjuststhestartingindexforitemstuple) | [prefixitems_validation_adjusts_the_starting_index_for_items.PrefixitemsValidationAdjustsTheStartingIndexForItemsTuple](../../../../../../../components/schema/prefixitems_validation_adjusts_the_starting_index_for_items.md#prefixitemsvalidationadjuststhestartingindexforitemstuple) +[**prefixitems_validation_adjusts_the_starting_index_for_items.PrefixitemsValidationAdjustsTheStartingIndexForItems**](../../../../../../components/schema/prefixitems_validation_adjusts_the_starting_index_for_items.md) | [prefixitems_validation_adjusts_the_starting_index_for_items.PrefixitemsValidationAdjustsTheStartingIndexForItemsTupleInput](../../../../../../components/schema/prefixitems_validation_adjusts_the_starting_index_for_items.md#prefixitemsvalidationadjuststhestartingindexforitemstupleinput), [prefixitems_validation_adjusts_the_starting_index_for_items.PrefixitemsValidationAdjustsTheStartingIndexForItemsTuple](../../../../../../components/schema/prefixitems_validation_adjusts_the_starting_index_for_items.md#prefixitemsvalidationadjuststhestartingindexforitemstuple) | [prefixitems_validation_adjusts_the_starting_index_for_items.PrefixitemsValidationAdjustsTheStartingIndexForItemsTuple](../../../../../../components/schema/prefixitems_validation_adjusts_the_starting_index_for_items.md#prefixitemsvalidationadjuststhestartingindexforitemstuple) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_prefixitems_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_prefixitems_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md index 159274cdbb2..b5b7b581fb7 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_prefixitems_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_prefixitems_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**prefixitems_with_null_instance_elements.PrefixitemsWithNullInstanceElements**](../../../../../../../components/schema/prefixitems_with_null_instance_elements.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, [prefixitems_with_null_instance_elements.PrefixitemsWithNullInstanceElementsTupleInput](../../../../../../../components/schema/prefixitems_with_null_instance_elements.md#prefixitemswithnullinstanceelementstupleinput), [prefixitems_with_null_instance_elements.PrefixitemsWithNullInstanceElementsTuple](../../../../../../../components/schema/prefixitems_with_null_instance_elements.md#prefixitemswithnullinstanceelementstuple), bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, [prefixitems_with_null_instance_elements.PrefixitemsWithNullInstanceElementsTuple](../../../../../../../components/schema/prefixitems_with_null_instance_elements.md#prefixitemswithnullinstanceelementstuple), bytes, io.FileIO +[**prefixitems_with_null_instance_elements.PrefixitemsWithNullInstanceElements**](../../../../../../components/schema/prefixitems_with_null_instance_elements.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, [prefixitems_with_null_instance_elements.PrefixitemsWithNullInstanceElementsTupleInput](../../../../../../components/schema/prefixitems_with_null_instance_elements.md#prefixitemswithnullinstanceelementstupleinput), [prefixitems_with_null_instance_elements.PrefixitemsWithNullInstanceElementsTuple](../../../../../../components/schema/prefixitems_with_null_instance_elements.md#prefixitemswithnullinstanceelementstuple), bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, [prefixitems_with_null_instance_elements.PrefixitemsWithNullInstanceElementsTuple](../../../../../../components/schema/prefixitems_with_null_instance_elements.md#prefixitemswithnullinstanceelementstuple), bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_patternproperties_additionalproperties_interaction_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_patternproperties_additionalproperties_interaction_request_body/post/request_body/content/application_json/schema.md index 7c59f958ac4..580da818a96 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_patternproperties_additionalproperties_interaction_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_patternproperties_additionalproperties_interaction_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**properties_patternproperties_additionalproperties_interaction.PropertiesPatternpropertiesAdditionalpropertiesInteraction**](../../../../../../../components/schema/properties_patternproperties_additionalproperties_interaction.md) | [properties_patternproperties_additionalproperties_interaction.PropertiesPatternpropertiesAdditionalpropertiesInteractionDictInput](../../../../../../../components/schema/properties_patternproperties_additionalproperties_interaction.md#propertiespatternpropertiesadditionalpropertiesinteractiondictinput), [properties_patternproperties_additionalproperties_interaction.PropertiesPatternpropertiesAdditionalpropertiesInteractionDict](../../../../../../../components/schema/properties_patternproperties_additionalproperties_interaction.md#propertiespatternpropertiesadditionalpropertiesinteractiondict) | [properties_patternproperties_additionalproperties_interaction.PropertiesPatternpropertiesAdditionalpropertiesInteractionDict](../../../../../../../components/schema/properties_patternproperties_additionalproperties_interaction.md#propertiespatternpropertiesadditionalpropertiesinteractiondict) +[**properties_patternproperties_additionalproperties_interaction.PropertiesPatternpropertiesAdditionalpropertiesInteraction**](../../../../../../components/schema/properties_patternproperties_additionalproperties_interaction.md) | [properties_patternproperties_additionalproperties_interaction.PropertiesPatternpropertiesAdditionalpropertiesInteractionDictInput](../../../../../../components/schema/properties_patternproperties_additionalproperties_interaction.md#propertiespatternpropertiesadditionalpropertiesinteractiondictinput), [properties_patternproperties_additionalproperties_interaction.PropertiesPatternpropertiesAdditionalpropertiesInteractionDict](../../../../../../components/schema/properties_patternproperties_additionalproperties_interaction.md#propertiespatternpropertiesadditionalpropertiesinteractiondict) | [properties_patternproperties_additionalproperties_interaction.PropertiesPatternpropertiesAdditionalpropertiesInteractionDict](../../../../../../components/schema/properties_patternproperties_additionalproperties_interaction.md#propertiespatternpropertiesadditionalpropertiesinteractiondict) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_whose_names_are_javascript_object_property_names_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_whose_names_are_javascript_object_property_names_request_body/post/request_body/content/application_json/schema.md index 150755b89b7..166db497313 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_whose_names_are_javascript_object_property_names_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_whose_names_are_javascript_object_property_names_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**properties_whose_names_are_javascript_object_property_names.PropertiesWhoseNamesAreJavascriptObjectPropertyNames**](../../../../../../../components/schema/properties_whose_names_are_javascript_object_property_names.md) | [properties_whose_names_are_javascript_object_property_names.PropertiesWhoseNamesAreJavascriptObjectPropertyNamesDictInput](../../../../../../../components/schema/properties_whose_names_are_javascript_object_property_names.md#propertieswhosenamesarejavascriptobjectpropertynamesdictinput), [properties_whose_names_are_javascript_object_property_names.PropertiesWhoseNamesAreJavascriptObjectPropertyNamesDict](../../../../../../../components/schema/properties_whose_names_are_javascript_object_property_names.md#propertieswhosenamesarejavascriptobjectpropertynamesdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [properties_whose_names_are_javascript_object_property_names.PropertiesWhoseNamesAreJavascriptObjectPropertyNamesDict](../../../../../../../components/schema/properties_whose_names_are_javascript_object_property_names.md#propertieswhosenamesarejavascriptobjectpropertynamesdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**properties_whose_names_are_javascript_object_property_names.PropertiesWhoseNamesAreJavascriptObjectPropertyNames**](../../../../../../components/schema/properties_whose_names_are_javascript_object_property_names.md) | [properties_whose_names_are_javascript_object_property_names.PropertiesWhoseNamesAreJavascriptObjectPropertyNamesDictInput](../../../../../../components/schema/properties_whose_names_are_javascript_object_property_names.md#propertieswhosenamesarejavascriptobjectpropertynamesdictinput), [properties_whose_names_are_javascript_object_property_names.PropertiesWhoseNamesAreJavascriptObjectPropertyNamesDict](../../../../../../components/schema/properties_whose_names_are_javascript_object_property_names.md#propertieswhosenamesarejavascriptobjectpropertynamesdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [properties_whose_names_are_javascript_object_property_names.PropertiesWhoseNamesAreJavascriptObjectPropertyNamesDict](../../../../../../components/schema/properties_whose_names_are_javascript_object_property_names.md#propertieswhosenamesarejavascriptobjectpropertynamesdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md index c55707308b3..57db4e07283 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**properties_with_escaped_characters.PropertiesWithEscapedCharacters**](../../../../../../../components/schema/properties_with_escaped_characters.md) | [properties_with_escaped_characters.PropertiesWithEscapedCharactersDictInput](../../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdictinput), [properties_with_escaped_characters.PropertiesWithEscapedCharactersDict](../../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [properties_with_escaped_characters.PropertiesWithEscapedCharactersDict](../../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**properties_with_escaped_characters.PropertiesWithEscapedCharacters**](../../../../../../components/schema/properties_with_escaped_characters.md) | [properties_with_escaped_characters.PropertiesWithEscapedCharactersDictInput](../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdictinput), [properties_with_escaped_characters.PropertiesWithEscapedCharactersDict](../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [properties_with_escaped_characters.PropertiesWithEscapedCharactersDict](../../../../../../components/schema/properties_with_escaped_characters.md#propertieswithescapedcharactersdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md index a591a7d8449..9c59d9c2a57 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_properties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**properties_with_null_valued_instance_properties.PropertiesWithNullValuedInstanceProperties**](../../../../../../../components/schema/properties_with_null_valued_instance_properties.md) | [properties_with_null_valued_instance_properties.PropertiesWithNullValuedInstancePropertiesDictInput](../../../../../../../components/schema/properties_with_null_valued_instance_properties.md#propertieswithnullvaluedinstancepropertiesdictinput), [properties_with_null_valued_instance_properties.PropertiesWithNullValuedInstancePropertiesDict](../../../../../../../components/schema/properties_with_null_valued_instance_properties.md#propertieswithnullvaluedinstancepropertiesdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [properties_with_null_valued_instance_properties.PropertiesWithNullValuedInstancePropertiesDict](../../../../../../../components/schema/properties_with_null_valued_instance_properties.md#propertieswithnullvaluedinstancepropertiesdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**properties_with_null_valued_instance_properties.PropertiesWithNullValuedInstanceProperties**](../../../../../../components/schema/properties_with_null_valued_instance_properties.md) | [properties_with_null_valued_instance_properties.PropertiesWithNullValuedInstancePropertiesDictInput](../../../../../../components/schema/properties_with_null_valued_instance_properties.md#propertieswithnullvaluedinstancepropertiesdictinput), [properties_with_null_valued_instance_properties.PropertiesWithNullValuedInstancePropertiesDict](../../../../../../components/schema/properties_with_null_valued_instance_properties.md#propertieswithnullvaluedinstancepropertiesdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [properties_with_null_valued_instance_properties.PropertiesWithNullValuedInstancePropertiesDict](../../../../../../components/schema/properties_with_null_valued_instance_properties.md#propertieswithnullvaluedinstancepropertiesdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/request_body/content/application_json/schema.md index ef67629144e..de944c4e2b4 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReference**](../../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md) | [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDictInput](../../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedictinput), [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDict](../../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDict](../../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReference**](../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md) | [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDictInput](../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedictinput), [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDict](../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [property_named_ref_that_is_not_a_reference.PropertyNamedRefThatIsNotAReferenceDict](../../../../../../components/schema/property_named_ref_that_is_not_a_reference.md#propertynamedrefthatisnotareferencedict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_propertynames_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_propertynames_validation_request_body/post/request_body/content/application_json/schema.md index f02316dc3fd..5316cf92a75 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_propertynames_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_propertynames_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**propertynames_validation.PropertynamesValidation**](../../../../../../../components/schema/propertynames_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**propertynames_validation.PropertynamesValidation**](../../../../../../components/schema/propertynames_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_regex_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_regex_format_request_body/post/request_body/content/application_json/schema.md index 39a6e8be2c8..28ab0756c69 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_regex_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_regex_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**regex_format.RegexFormat**](../../../../../../../components/schema/regex_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**regex_format.RegexFormat**](../../../../../../components/schema/regex_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_regexes_are_not_anchored_by_default_and_are_case_sensitive_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_regexes_are_not_anchored_by_default_and_are_case_sensitive_request_body/post/request_body/content/application_json/schema.md index 61978744127..294bb068969 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_regexes_are_not_anchored_by_default_and_are_case_sensitive_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_regexes_are_not_anchored_by_default_and_are_case_sensitive_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**regexes_are_not_anchored_by_default_and_are_case_sensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive**](../../../../../../../components/schema/regexes_are_not_anchored_by_default_and_are_case_sensitive.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**regexes_are_not_anchored_by_default_and_are_case_sensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive**](../../../../../../components/schema/regexes_are_not_anchored_by_default_and_are_case_sensitive.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_relative_json_pointer_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_relative_json_pointer_format_request_body/post/request_body/content/application_json/schema.md index 77fda004ab9..2e479de6478 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_relative_json_pointer_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_relative_json_pointer_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**relative_json_pointer_format.RelativeJsonPointerFormat**](../../../../../../../components/schema/relative_json_pointer_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**relative_json_pointer_format.RelativeJsonPointerFormat**](../../../../../../components/schema/relative_json_pointer_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_default_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_default_validation_request_body/post/request_body/content/application_json/schema.md index f3d0d05391e..9aa94355deb 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_default_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_default_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**required_default_validation.RequiredDefaultValidation**](../../../../../../../components/schema/required_default_validation.md) | [required_default_validation.RequiredDefaultValidationDictInput](../../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdictinput), [required_default_validation.RequiredDefaultValidationDict](../../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_default_validation.RequiredDefaultValidationDict](../../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**required_default_validation.RequiredDefaultValidation**](../../../../../../components/schema/required_default_validation.md) | [required_default_validation.RequiredDefaultValidationDictInput](../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdictinput), [required_default_validation.RequiredDefaultValidationDict](../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_default_validation.RequiredDefaultValidationDict](../../../../../../components/schema/required_default_validation.md#requireddefaultvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_properties_whose_names_are_javascript_object_property_names_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_properties_whose_names_are_javascript_object_property_names_request_body/post/request_body/content/application_json/schema.md index ec4178c16fc..8bc634405a6 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_properties_whose_names_are_javascript_object_property_names_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_properties_whose_names_are_javascript_object_property_names_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**required_properties_whose_names_are_javascript_object_property_names.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames**](../../../../../../../components/schema/required_properties_whose_names_are_javascript_object_property_names.md) | [required_properties_whose_names_are_javascript_object_property_names.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesDictInput](../../../../../../../components/schema/required_properties_whose_names_are_javascript_object_property_names.md#requiredpropertieswhosenamesarejavascriptobjectpropertynamesdictinput), [required_properties_whose_names_are_javascript_object_property_names.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesDict](../../../../../../../components/schema/required_properties_whose_names_are_javascript_object_property_names.md#requiredpropertieswhosenamesarejavascriptobjectpropertynamesdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_properties_whose_names_are_javascript_object_property_names.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesDict](../../../../../../../components/schema/required_properties_whose_names_are_javascript_object_property_names.md#requiredpropertieswhosenamesarejavascriptobjectpropertynamesdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**required_properties_whose_names_are_javascript_object_property_names.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames**](../../../../../../components/schema/required_properties_whose_names_are_javascript_object_property_names.md) | [required_properties_whose_names_are_javascript_object_property_names.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesDictInput](../../../../../../components/schema/required_properties_whose_names_are_javascript_object_property_names.md#requiredpropertieswhosenamesarejavascriptobjectpropertynamesdictinput), [required_properties_whose_names_are_javascript_object_property_names.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesDict](../../../../../../components/schema/required_properties_whose_names_are_javascript_object_property_names.md#requiredpropertieswhosenamesarejavascriptobjectpropertynamesdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_properties_whose_names_are_javascript_object_property_names.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesDict](../../../../../../components/schema/required_properties_whose_names_are_javascript_object_property_names.md#requiredpropertieswhosenamesarejavascriptobjectpropertynamesdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_validation_request_body/post/request_body/content/application_json/schema.md index ac71e0dfa80..4482ab801fe 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**required_validation.RequiredValidation**](../../../../../../../components/schema/required_validation.md) | [required_validation.RequiredValidationDictInput](../../../../../../../components/schema/required_validation.md#requiredvalidationdictinput), [required_validation.RequiredValidationDict](../../../../../../../components/schema/required_validation.md#requiredvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_validation.RequiredValidationDict](../../../../../../../components/schema/required_validation.md#requiredvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**required_validation.RequiredValidation**](../../../../../../components/schema/required_validation.md) | [required_validation.RequiredValidationDictInput](../../../../../../components/schema/required_validation.md#requiredvalidationdictinput), [required_validation.RequiredValidationDict](../../../../../../components/schema/required_validation.md#requiredvalidationdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_validation.RequiredValidationDict](../../../../../../components/schema/required_validation.md#requiredvalidationdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_with_empty_array_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_with_empty_array_request_body/post/request_body/content/application_json/schema.md index b9224fb1d06..d1218b340cc 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_with_empty_array_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_with_empty_array_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**required_with_empty_array.RequiredWithEmptyArray**](../../../../../../../components/schema/required_with_empty_array.md) | [required_with_empty_array.RequiredWithEmptyArrayDictInput](../../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydictinput), [required_with_empty_array.RequiredWithEmptyArrayDict](../../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_with_empty_array.RequiredWithEmptyArrayDict](../../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**required_with_empty_array.RequiredWithEmptyArray**](../../../../../../components/schema/required_with_empty_array.md) | [required_with_empty_array.RequiredWithEmptyArrayDictInput](../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydictinput), [required_with_empty_array.RequiredWithEmptyArrayDict](../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_with_empty_array.RequiredWithEmptyArrayDict](../../../../../../components/schema/required_with_empty_array.md#requiredwithemptyarraydict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md index a9cbdcbdf56..857704d4790 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_required_with_escaped_characters_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**required_with_escaped_characters.RequiredWithEscapedCharacters**](../../../../../../../components/schema/required_with_escaped_characters.md) | [required_with_escaped_characters.RequiredWithEscapedCharactersDictInput](../../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdictinput), [required_with_escaped_characters.RequiredWithEscapedCharactersDict](../../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_with_escaped_characters.RequiredWithEscapedCharactersDict](../../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdict), str, float, int, bool, None, tuple, bytes, io.FileIO +[**required_with_escaped_characters.RequiredWithEscapedCharacters**](../../../../../../components/schema/required_with_escaped_characters.md) | [required_with_escaped_characters.RequiredWithEscapedCharactersDictInput](../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdictinput), [required_with_escaped_characters.RequiredWithEscapedCharactersDict](../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [required_with_escaped_characters.RequiredWithEscapedCharactersDict](../../../../../../components/schema/required_with_escaped_characters.md#requiredwithescapedcharactersdict), str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_simple_enum_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_simple_enum_validation_request_body/post/request_body/content/application_json/schema.md index 5163b27843e..01a2e0e29d9 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_simple_enum_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_simple_enum_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**simple_enum_validation.SimpleEnumValidation**](../../../../../../../components/schema/simple_enum_validation.md) | float, int | float, int +[**simple_enum_validation.SimpleEnumValidation**](../../../../../../components/schema/simple_enum_validation.md) | float, int | float, int diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_single_dependency_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_single_dependency_request_body/post/request_body/content/application_json/schema.md index 2e410f716a4..ac04fc03471 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_single_dependency_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_single_dependency_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**single_dependency.SingleDependency**](../../../../../../../components/schema/single_dependency.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**single_dependency.SingleDependency**](../../../../../../components/schema/single_dependency.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_small_multiple_of_large_integer_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_small_multiple_of_large_integer_request_body/post/request_body/content/application_json/schema.md index e941b42a489..cf99f614ab7 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_small_multiple_of_large_integer_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_small_multiple_of_large_integer_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**small_multiple_of_large_integer.SmallMultipleOfLargeInteger**](../../../../../../../components/schema/small_multiple_of_large_integer.md) | int | int +[**small_multiple_of_large_integer.SmallMultipleOfLargeInteger**](../../../../../../components/schema/small_multiple_of_large_integer.md) | int | int diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_string_type_matches_strings_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_string_type_matches_strings_request_body/post/request_body/content/application_json/schema.md index 5557e2bcba2..eb1f9cd6468 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_string_type_matches_strings_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_string_type_matches_strings_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**string_type_matches_strings.StringTypeMatchesStrings**](../../../../../../../components/schema/string_type_matches_strings.md) | str | str +[**string_type_matches_strings.StringTypeMatchesStrings**](../../../../../../components/schema/string_type_matches_strings.md) | str | str diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_time_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_time_format_request_body/post/request_body/content/application_json/schema.md index c0964ed8da4..d4ac7b392c7 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_time_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_time_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**time_format.TimeFormat**](../../../../../../../components/schema/time_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**time_format.TimeFormat**](../../../../../../components/schema/time_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_array_object_or_null_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_array_object_or_null_request_body/post/request_body/content/application_json/schema.md index 49c3f52d415..0ac4e15181c 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_array_object_or_null_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_array_object_or_null_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**type_array_object_or_null.TypeArrayObjectOrNull**](../../../../../../../components/schema/type_array_object_or_null.md) | list, tuple, dict, schemas.immutabledict, None | tuple, schemas.immutabledict, None +[**type_array_object_or_null.TypeArrayObjectOrNull**](../../../../../../components/schema/type_array_object_or_null.md) | list, tuple, dict, schemas.immutabledict, None | tuple, schemas.immutabledict, None diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_array_or_object_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_array_or_object_request_body/post/request_body/content/application_json/schema.md index 8bec189d6d3..d6a3dcca701 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_array_or_object_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_array_or_object_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**type_array_or_object.TypeArrayOrObject**](../../../../../../../components/schema/type_array_or_object.md) | list, tuple, dict, schemas.immutabledict | tuple, schemas.immutabledict +[**type_array_or_object.TypeArrayOrObject**](../../../../../../components/schema/type_array_or_object.md) | list, tuple, dict, schemas.immutabledict | tuple, schemas.immutabledict diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_as_array_with_one_item_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_as_array_with_one_item_request_body/post/request_body/content/application_json/schema.md index 0c71b49ccd3..17dc6021c34 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_as_array_with_one_item_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_type_as_array_with_one_item_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**type_as_array_with_one_item.TypeAsArrayWithOneItem**](../../../../../../../components/schema/type_as_array_with_one_item.md) | str | str +[**type_as_array_with_one_item.TypeAsArrayWithOneItem**](../../../../../../components/schema/type_as_array_with_one_item.md) | str | str diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_as_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_as_schema_request_body/post/request_body/content/application_json/schema.md index d52aae61bbf..867fa039c8f 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_as_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_as_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**unevaluateditems_as_schema.UnevaluateditemsAsSchema**](../../../../../../../components/schema/unevaluateditems_as_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**unevaluateditems_as_schema.UnevaluateditemsAsSchema**](../../../../../../components/schema/unevaluateditems_as_schema.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_depends_on_multiple_nested_contains_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_depends_on_multiple_nested_contains_request_body/post/request_body/content/application_json/schema.md index c9919b9dbb0..e431f7e7671 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_depends_on_multiple_nested_contains_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_depends_on_multiple_nested_contains_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**unevaluateditems_depends_on_multiple_nested_contains.UnevaluateditemsDependsOnMultipleNestedContains**](../../../../../../../components/schema/unevaluateditems_depends_on_multiple_nested_contains.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**unevaluateditems_depends_on_multiple_nested_contains.UnevaluateditemsDependsOnMultipleNestedContains**](../../../../../../components/schema/unevaluateditems_depends_on_multiple_nested_contains.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_with_items_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_with_items_request_body/post/request_body/content/application_json/schema.md index fedcd5e1e14..f9f0e58860b 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_with_items_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_with_items_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**unevaluateditems_with_items.UnevaluateditemsWithItems**](../../../../../../../components/schema/unevaluateditems_with_items.md) | [unevaluateditems_with_items.UnevaluateditemsWithItemsTupleInput](../../../../../../../components/schema/unevaluateditems_with_items.md#unevaluateditemswithitemstupleinput), [unevaluateditems_with_items.UnevaluateditemsWithItemsTuple](../../../../../../../components/schema/unevaluateditems_with_items.md#unevaluateditemswithitemstuple) | [unevaluateditems_with_items.UnevaluateditemsWithItemsTuple](../../../../../../../components/schema/unevaluateditems_with_items.md#unevaluateditemswithitemstuple) +[**unevaluateditems_with_items.UnevaluateditemsWithItems**](../../../../../../components/schema/unevaluateditems_with_items.md) | [unevaluateditems_with_items.UnevaluateditemsWithItemsTupleInput](../../../../../../components/schema/unevaluateditems_with_items.md#unevaluateditemswithitemstupleinput), [unevaluateditems_with_items.UnevaluateditemsWithItemsTuple](../../../../../../components/schema/unevaluateditems_with_items.md#unevaluateditemswithitemstuple) | [unevaluateditems_with_items.UnevaluateditemsWithItemsTuple](../../../../../../components/schema/unevaluateditems_with_items.md#unevaluateditemswithitemstuple) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md index 280c9a3f821..ba161396c1e 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluateditems_with_null_instance_elements_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**unevaluateditems_with_null_instance_elements.UnevaluateditemsWithNullInstanceElements**](../../../../../../../components/schema/unevaluateditems_with_null_instance_elements.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**unevaluateditems_with_null_instance_elements.UnevaluateditemsWithNullInstanceElements**](../../../../../../components/schema/unevaluateditems_with_null_instance_elements.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_not_affected_by_propertynames_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_not_affected_by_propertynames_request_body/post/request_body/content/application_json/schema.md index 2c04218f6b8..f08ef3c456b 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_not_affected_by_propertynames_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_not_affected_by_propertynames_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**unevaluatedproperties_not_affected_by_propertynames.UnevaluatedpropertiesNotAffectedByPropertynames**](../../../../../../../components/schema/unevaluatedproperties_not_affected_by_propertynames.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**unevaluatedproperties_not_affected_by_propertynames.UnevaluatedpropertiesNotAffectedByPropertynames**](../../../../../../components/schema/unevaluatedproperties_not_affected_by_propertynames.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_schema_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_schema_request_body/post/request_body/content/application_json/schema.md index 38ec30e5765..812840c7306 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_schema_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_schema_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**unevaluatedproperties_schema.UnevaluatedpropertiesSchema**](../../../../../../../components/schema/unevaluatedproperties_schema.md) | dict, schemas.immutabledict | schemas.immutabledict +[**unevaluatedproperties_schema.UnevaluatedpropertiesSchema**](../../../../../../components/schema/unevaluatedproperties_schema.md) | dict, schemas.immutabledict | schemas.immutabledict diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_with_adjacent_additionalproperties_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_with_adjacent_additionalproperties_request_body/post/request_body/content/application_json/schema.md index 8fa61cf23eb..5ab44982a2a 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_with_adjacent_additionalproperties_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_with_adjacent_additionalproperties_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**unevaluatedproperties_with_adjacent_additionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties**](../../../../../../../components/schema/unevaluatedproperties_with_adjacent_additionalproperties.md) | [unevaluatedproperties_with_adjacent_additionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesDictInput](../../../../../../../components/schema/unevaluatedproperties_with_adjacent_additionalproperties.md#unevaluatedpropertieswithadjacentadditionalpropertiesdictinput), [unevaluatedproperties_with_adjacent_additionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesDict](../../../../../../../components/schema/unevaluatedproperties_with_adjacent_additionalproperties.md#unevaluatedpropertieswithadjacentadditionalpropertiesdict) | [unevaluatedproperties_with_adjacent_additionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesDict](../../../../../../../components/schema/unevaluatedproperties_with_adjacent_additionalproperties.md#unevaluatedpropertieswithadjacentadditionalpropertiesdict) +[**unevaluatedproperties_with_adjacent_additionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties**](../../../../../../components/schema/unevaluatedproperties_with_adjacent_additionalproperties.md) | [unevaluatedproperties_with_adjacent_additionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesDictInput](../../../../../../components/schema/unevaluatedproperties_with_adjacent_additionalproperties.md#unevaluatedpropertieswithadjacentadditionalpropertiesdictinput), [unevaluatedproperties_with_adjacent_additionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesDict](../../../../../../components/schema/unevaluatedproperties_with_adjacent_additionalproperties.md#unevaluatedpropertieswithadjacentadditionalpropertiesdict) | [unevaluatedproperties_with_adjacent_additionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesDict](../../../../../../components/schema/unevaluatedproperties_with_adjacent_additionalproperties.md#unevaluatedpropertieswithadjacentadditionalpropertiesdict) diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md index f09cc3561d8..3eaf9b0009d 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_unevaluatedproperties_with_null_valued_instance_properties_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**unevaluatedproperties_with_null_valued_instance_properties.UnevaluatedpropertiesWithNullValuedInstanceProperties**](../../../../../../../components/schema/unevaluatedproperties_with_null_valued_instance_properties.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**unevaluatedproperties_with_null_valued_instance_properties.UnevaluatedpropertiesWithNullValuedInstanceProperties**](../../../../../../components/schema/unevaluatedproperties_with_null_valued_instance_properties.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_false_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_false_validation_request_body/post/request_body/content/application_json/schema.md index 5bb6533383f..0f14ec1888e 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_false_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_false_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uniqueitems_false_validation.UniqueitemsFalseValidation**](../../../../../../../components/schema/uniqueitems_false_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**uniqueitems_false_validation.UniqueitemsFalseValidation**](../../../../../../components/schema/uniqueitems_false_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_false_with_an_array_of_items_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_false_with_an_array_of_items_request_body/post/request_body/content/application_json/schema.md index 604a192c8b0..a80d06fcc9a 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_false_with_an_array_of_items_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_false_with_an_array_of_items_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uniqueitems_false_with_an_array_of_items.UniqueitemsFalseWithAnArrayOfItems**](../../../../../../../components/schema/uniqueitems_false_with_an_array_of_items.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, [uniqueitems_false_with_an_array_of_items.UniqueitemsFalseWithAnArrayOfItemsTupleInput](../../../../../../../components/schema/uniqueitems_false_with_an_array_of_items.md#uniqueitemsfalsewithanarrayofitemstupleinput), [uniqueitems_false_with_an_array_of_items.UniqueitemsFalseWithAnArrayOfItemsTuple](../../../../../../../components/schema/uniqueitems_false_with_an_array_of_items.md#uniqueitemsfalsewithanarrayofitemstuple), bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, [uniqueitems_false_with_an_array_of_items.UniqueitemsFalseWithAnArrayOfItemsTuple](../../../../../../../components/schema/uniqueitems_false_with_an_array_of_items.md#uniqueitemsfalsewithanarrayofitemstuple), bytes, io.FileIO +[**uniqueitems_false_with_an_array_of_items.UniqueitemsFalseWithAnArrayOfItems**](../../../../../../components/schema/uniqueitems_false_with_an_array_of_items.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, [uniqueitems_false_with_an_array_of_items.UniqueitemsFalseWithAnArrayOfItemsTupleInput](../../../../../../components/schema/uniqueitems_false_with_an_array_of_items.md#uniqueitemsfalsewithanarrayofitemstupleinput), [uniqueitems_false_with_an_array_of_items.UniqueitemsFalseWithAnArrayOfItemsTuple](../../../../../../components/schema/uniqueitems_false_with_an_array_of_items.md#uniqueitemsfalsewithanarrayofitemstuple), bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, [uniqueitems_false_with_an_array_of_items.UniqueitemsFalseWithAnArrayOfItemsTuple](../../../../../../components/schema/uniqueitems_false_with_an_array_of_items.md#uniqueitemsfalsewithanarrayofitemstuple), bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_validation_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_validation_request_body/post/request_body/content/application_json/schema.md index 724f095f458..f3c95028b10 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_validation_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_validation_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uniqueitems_validation.UniqueitemsValidation**](../../../../../../../components/schema/uniqueitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**uniqueitems_validation.UniqueitemsValidation**](../../../../../../components/schema/uniqueitems_validation.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_with_an_array_of_items_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_with_an_array_of_items_request_body/post/request_body/content/application_json/schema.md index d99c993d4b5..8c4f018a3f2 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_with_an_array_of_items_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uniqueitems_with_an_array_of_items_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uniqueitems_with_an_array_of_items.UniqueitemsWithAnArrayOfItems**](../../../../../../../components/schema/uniqueitems_with_an_array_of_items.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, [uniqueitems_with_an_array_of_items.UniqueitemsWithAnArrayOfItemsTupleInput](../../../../../../../components/schema/uniqueitems_with_an_array_of_items.md#uniqueitemswithanarrayofitemstupleinput), [uniqueitems_with_an_array_of_items.UniqueitemsWithAnArrayOfItemsTuple](../../../../../../../components/schema/uniqueitems_with_an_array_of_items.md#uniqueitemswithanarrayofitemstuple), bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, [uniqueitems_with_an_array_of_items.UniqueitemsWithAnArrayOfItemsTuple](../../../../../../../components/schema/uniqueitems_with_an_array_of_items.md#uniqueitemswithanarrayofitemstuple), bytes, io.FileIO +[**uniqueitems_with_an_array_of_items.UniqueitemsWithAnArrayOfItems**](../../../../../../components/schema/uniqueitems_with_an_array_of_items.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, [uniqueitems_with_an_array_of_items.UniqueitemsWithAnArrayOfItemsTupleInput](../../../../../../components/schema/uniqueitems_with_an_array_of_items.md#uniqueitemswithanarrayofitemstupleinput), [uniqueitems_with_an_array_of_items.UniqueitemsWithAnArrayOfItemsTuple](../../../../../../components/schema/uniqueitems_with_an_array_of_items.md#uniqueitemswithanarrayofitemstuple), bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, [uniqueitems_with_an_array_of_items.UniqueitemsWithAnArrayOfItemsTuple](../../../../../../components/schema/uniqueitems_with_an_array_of_items.md#uniqueitemswithanarrayofitemstuple), bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_format_request_body/post/request_body/content/application_json/schema.md index 7d7776c3fea..faf691ea9fc 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uri_format.UriFormat**](../../../../../../../components/schema/uri_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**uri_format.UriFormat**](../../../../../../components/schema/uri_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_reference_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_reference_format_request_body/post/request_body/content/application_json/schema.md index bc3e1eb283b..f8d2a47e259 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_reference_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_reference_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uri_reference_format.UriReferenceFormat**](../../../../../../../components/schema/uri_reference_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**uri_reference_format.UriReferenceFormat**](../../../../../../components/schema/uri_reference_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_template_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_template_format_request_body/post/request_body/content/application_json/schema.md index d6647813edd..b46af932270 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_template_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uri_template_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uri_template_format.UriTemplateFormat**](../../../../../../../components/schema/uri_template_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**uri_template_format.UriTemplateFormat**](../../../../../../components/schema/uri_template_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uuid_format_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uuid_format_request_body/post/request_body/content/application_json/schema.md index b3860830d93..5fd447f0f67 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uuid_format_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_uuid_format_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**uuid_format.UuidFormat**](../../../../../../../components/schema/uuid_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**uuid_format.UuidFormat**](../../../../../../components/schema/uuid_format.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_validate_against_correct_branch_then_vs_else_request_body/post/request_body/content/application_json/schema.md b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_validate_against_correct_branch_then_vs_else_request_body/post/request_body/content/application_json/schema.md index d150495b656..42fafe73bde 100644 --- a/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_validate_against_correct_branch_then_vs_else_request_body/post/request_body/content/application_json/schema.md +++ b/samples/client/3_1_0_unit_test/python/docs/paths/request_body_post_validate_against_correct_branch_then_vs_else_request_body/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**validate_against_correct_branch_then_vs_else.ValidateAgainstCorrectBranchThenVsElse**](../../../../../../../components/schema/validate_against_correct_branch_then_vs_else.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**validate_against_correct_branch_then_vs_else.ValidateAgainstCorrectBranchThenVsElse**](../../../../../../components/schema/validate_against_correct_branch_then_vs_else.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/openapi_features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/paths/operators/post/request_body/content/application_json/schema.md b/samples/client/openapi_features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/paths/operators/post/request_body/content/application_json/schema.md index 43e6a719ccb..b1ef7bccaea 100644 --- a/samples/client/openapi_features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/paths/operators/post/request_body/content/application_json/schema.md +++ b/samples/client/openapi_features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/paths/operators/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**operator.Operator**](../../../../../../../components/schema/operator.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**operator.Operator**](../../../../../../components/schema/operator.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/petstore/java/.openapi-generator/FILES b/samples/client/petstore/java/.openapi-generator/FILES index aa899ef9fe6..75d48d1effe 100644 --- a/samples/client/petstore/java/.openapi-generator/FILES +++ b/samples/client/petstore/java/.openapi-generator/FILES @@ -518,6 +518,9 @@ docs/paths/foo/get/FooGetServerInfo.md docs/paths/foo/get/Responses.md docs/paths/foo/get/responses/CodedefaultResponse.md docs/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.md +docs/paths/foo/get/servers/FooGetServer0.md +docs/paths/foo/get/servers/FooGetServer1.md +docs/paths/foo/get/servers/server1/Variables.md docs/paths/pet/Post.md docs/paths/pet/Put.md docs/paths/pet/post/PetPostSecurityInfo.md @@ -547,6 +550,9 @@ docs/paths/petfindbystatus/get/responses/Code400Response.md docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md +docs/paths/petfindbystatus/servers/PetfindbystatusServer0.md +docs/paths/petfindbystatus/servers/PetfindbystatusServer1.md +docs/paths/petfindbystatus/servers/server1/Variables.md docs/paths/petfindbytags/Get.md docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md docs/paths/petfindbytags/get/QueryParameters.md @@ -678,6 +684,8 @@ docs/paths/userusername/put/responses/Code404Response.md docs/servers/Server0.md docs/servers/Server1.md docs/servers/Server2.md +docs/servers/server0/Variables.md +docs/servers/server1/Variables.md pom.xml src/main/java/org/openapijsonschematools/client/RootServerInfo.java src/main/java/org/openapijsonschematools/client/apiclient/ApiClient.java @@ -888,7 +896,7 @@ src/main/java/org/openapijsonschematools/client/contenttype/ContentTypeSerialize src/main/java/org/openapijsonschematools/client/exceptions/ApiException.java src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java src/main/java/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.java -src/main/java/org/openapijsonschematools/client/exceptions/InvalidTypeException.java +src/main/java/org/openapijsonschematools/client/exceptions/NotImplementedException.java src/main/java/org/openapijsonschematools/client/exceptions/UnsetPropertyException.java src/main/java/org/openapijsonschematools/client/exceptions/ValidationException.java src/main/java/org/openapijsonschematools/client/header/ContentHeader.java diff --git a/samples/client/petstore/java/docs/RootServerInfo.md b/samples/client/petstore/java/docs/RootServerInfo.md index 7923e66cc3f..8df9c7bf6ee 100644 --- a/samples/client/petstore/java/docs/RootServerInfo.md +++ b/samples/client/petstore/java/docs/RootServerInfo.md @@ -4,13 +4,38 @@ RootServerInfo.java public class RootServerInfo A class that provides a server, and any needed server info classes +- a class that is a 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 | | 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()
Creates an instance using default server variable values | +| RootServerInfo1(@Nullable [Server0](servers/Server0.md) server0,@Nullable [Server1](servers/Server1.md) server1,@Nullable [Server2](servers/Server2.md) server2)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [Server0](servers/Server0.md) | server0 | +| [Server1](servers/Server1.md) | server1 | +| [Server2](servers/Server2.md) | server2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + ## ServerIndex enum ServerIndex
diff --git a/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md b/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md index 0719e44d623..0a6ef69c824 100644 --- a/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md +++ b/samples/client/petstore/java/docs/components/headers/Int32JsonContentTypeHeader.md @@ -48,7 +48,7 @@ a class that deserializes a header value | @Nullable ParameterStyle | ParameterStyle.SIMPLE | | @Nullable Boolean explode | false | | @Nullable Boolean allowReserved | null | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | +| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
the contentType to schema info | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md b/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md index dbb069c6ae6..f267518fd67 100644 --- a/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md +++ b/samples/client/petstore/java/docs/components/headers/RefContentSchemaHeader.md @@ -48,7 +48,7 @@ a class that deserializes a header value | @Nullable ParameterStyle | ParameterStyle.SIMPLE | | @Nullable Boolean explode | false | | @Nullable Boolean allowReserved | null | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | +| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
the contentType to schema info | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md b/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md index 882379fc131..2d4bf3bc54c 100644 --- a/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md +++ b/samples/client/petstore/java/docs/components/parameters/ComponentRefSchemaStringWithValidation.md @@ -50,7 +50,7 @@ a class that deserializes a parameter value | @Nullable Boolean explode | null | | @Nullable ParameterStyle | null | | @Nullable Boolean allowReserved | false | -| Map | content = Map.ofEntries(
    new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
)
the contentType to schema info | +| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("application/json", new [ApplicationjsonMediaType](#applicationjsonmediatype)())
the contentType to schema info | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md b/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md index d0a1d8d650c..dbe40f61ba7 100644 --- a/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md +++ b/samples/client/petstore/java/docs/components/requestbodies/RefUserArray.md @@ -12,7 +12,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RefUserArray.RefUserArray1](#refuserarray1)
class that serializes request bodies | ## RefUserArray1 -public static class RefUserArray1 extends [UserArray](../../components/requestbodies/UserArray.md#userarray1)
+public static class RefUserArray1 extends [UserArray1](../../components/requestbodies/UserArray.md#userarray1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md index 56c5752c199..8ce9988a2f5 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/Patch.md @@ -22,8 +22,84 @@ public static class Patch1 extends ApiClient.ApiClient1 implements PatchOperatio a class that allows one to call the endpoint using a method named patch -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.RootServerInfo; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.RequestBody; +import org.openapijsonschematools.client.components.schemas.Client; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.Code200Response; +import org.openapijsonschematools.client.paths.anotherfakedummy.Patch; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); + + +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.patch(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md index a4283fe34f8..72d0a1a3ced 100644 --- a/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/anotherfakedummy/patch/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Client](../../components/requestbodies/Client.md) +public class RequestBody extends [Client](../../../components/requestbodies/Client.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client](../../components/requestbodies/Client.md#client1)
+public static class RequestBody1 extends [Client1](../../../components/requestbodies/Client.md#client1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md index 17d65515caa..f766eb05a79 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Delete.md @@ -22,8 +22,82 @@ public static class Delete1 extends ApiClient.ApiClient1 implements DeleteOperat a class that allows one to call the endpoint using a method named delete -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.commonparamsubdir.delete.HeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.Code200Response; +import org.openapijsonschematools.client.paths.commonparamsubdir.Delete; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); + + +// Map validation +PathParameters.PathParametersMap pathParameters = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .subDir("c") + + .build(), + schemaConfiguration +); + +var request = new DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.delete(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md index abbfc1713cc..4cc89d8ffc0 100644 --- a/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md +++ b/samples/client/petstore/java/docs/paths/commonparamsubdir/Get.md @@ -22,8 +22,82 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); +securitySchemes.add( + new BearerTest("someAccessToken"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .fakeDeleteSecurityInfoSecurityIndex(FakeDeleteSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); + + +// Map validation +HeaderParameters.HeaderParametersMap headerParameters = + HeaderParameters.HeaderParameters1.validate( + new HeaderParameters.HeaderParametersMapBuilder() + .required_boolean_group("true") + + .boolean_group("true") + + .build(), + schemaConfiguration +); + +// Map validation +QueryParameters.QueryParametersMap queryParameters = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .required_int64_group(1L) + + .required_string_group("a") + + .int64_group(1L) + + .string_group("a") + + .build(), + schemaConfiguration +); + +var request = new DeleteRequestBuilder() + .headerParameters(headerParameters) + .queryParameters(queryParameters) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.delete(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fake/Get.md b/samples/client/petstore/java/docs/paths/fake/Get.md index 2037002cda3..eaaac40d53d 100644 --- a/samples/client/petstore/java/docs/paths/fake/Get.md +++ b/samples/client/petstore/java/docs/paths/fake/Get.md @@ -20,8 +20,76 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); +securitySchemes.add( + new HttpBasicTest("someUserId", "somePassword"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .fakePostSecurityInfoSecurityIndex(FakePostSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (Code404Response.ResponseApiException e) { + // server returned an error response defined in the openapi document + throw e; +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md b/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md index 6480bf870bd..7c008b766c7 100644 --- a/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fake/delete/FakeDeleteSecurityInfo.md @@ -4,7 +4,7 @@ FakeDeleteSecurityInfo.java public class FakeDeleteSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakeDeleteSecurityRequirementObject0()](../../../paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md)
)); | +| [FakeDeleteSecurityRequirementObject0](../../../paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md index af486306c7b..ce14db9f6b9 100644 --- a/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [BearerTest.class](../../../../components/securityschemes/BearerTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [BearerTest.class](../../../../components/securityschemes/BearerTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md b/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md index ecb0c751dc6..f65e52d102c 100644 --- a/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fake/get/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationxwwwformurlencodedMediaType public record ApplicationxwwwformurlencodedMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md index a4283fe34f8..72d0a1a3ced 100644 --- a/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fake/patch/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Client](../../components/requestbodies/Client.md) +public class RequestBody extends [Client](../../../components/requestbodies/Client.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client](../../components/requestbodies/Client.md#client1)
+public static class RequestBody1 extends [Client1](../../../components/requestbodies/Client.md#client1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md b/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md index 95b409d5023..0166862a304 100644 --- a/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fake/post/FakePostSecurityInfo.md @@ -4,7 +4,7 @@ FakePostSecurityInfo.java public class FakePostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakePostSecurityRequirementObject0()](../../../paths/fake/post/security/FakePostSecurityRequirementObject0.md)
)); | +| [FakePostSecurityRequirementObject0](../../../paths/fake/post/security/FakePostSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md index a6cfa244081..0b707158f4f 100644 --- a/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fake/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationxwwwformurlencodedMediaType public record ApplicationxwwwformurlencodedMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md index ffe185f4a8a..db0df44256c 100644 --- a/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md index a405deb463f..e1599769a32 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md @@ -20,8 +20,72 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[AdditionalPropertiesWithArrayOfEnums1Boxed](../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md index 3c5d3360d21..e583d49bf2d 100644 --- a/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakeadditionalpropertieswitharrayofenums/get/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [AdditionalPropertiesWithArrayOfEnums1](../../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums) +extends [AdditionalPropertiesWithArrayOfEnums1](../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](../../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) +extends [AdditionalPropertiesWithArrayOfEnums.AdditionalPropertiesWithArrayOfEnums1](../../../../../../components/schemas/AdditionalPropertiesWithArrayOfEnums.md#additionalpropertieswitharrayofenums1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md index 5d2c32c9a42..1418fafcf3f 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/Put.md @@ -22,8 +22,84 @@ public static class Put1 extends ApiClient.ApiClient1 implements PutOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[FileSchemaTestClass1Boxed](../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md index a3c6ea7cd01..16f5864b396 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithfileschema/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [FileSchemaTestClass1](../../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass) +extends [FileSchemaTestClass1](../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [FileSchemaTestClass.FileSchemaTestClass1](../../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1) +extends [FileSchemaTestClass.FileSchemaTestClass1](../../../../../../components/schemas/FileSchemaTestClass.md#fileschematestclass1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md index 6bfd7245a02..5b044c5f4e7 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/Put.md @@ -24,8 +24,110 @@ public static class Put1 extends ApiClient.ApiClient1 implements PutOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md index 3433b43b8a4..87ec51870cc 100644 --- a/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakebodywithqueryparams/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [User1](../../../../../../../components/schemas/User.md#user) +extends [User1](../../../../../../components/schemas/User.md#user) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../../components/schemas/User.md#user1) +extends [User.User1](../../../../../../components/schemas/User.md#user1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md index dd59e0b0e47..866755c2812 100644 --- a/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md +++ b/samples/client/petstore/java/docs/paths/fakecasesensitiveparams/Put.md @@ -22,8 +22,85 @@ public static class Put1 extends ApiClient.ApiClient1 implements PutOperation
securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKeyQuery("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .fakeclassnametestPatchSecurityInfoSecurityIndex(FakeclassnametestPatchSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); + + +Client1BoxedMap requestBodyPayload = + Client.Client1.validateAndBox( + new Client.ClientMapBuilder1() + .client("a") + + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PatchRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.patch(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md index 2137564e12f..3e252e7cdd7 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.md @@ -4,7 +4,7 @@ FakeclassnametestPatchSecurityInfo.java public class FakeclassnametestPatchSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakeclassnametestPatchSecurityRequirementObject0()](../../../paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md)
)); | +| [FakeclassnametestPatchSecurityRequirementObject0](../../../paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md index a4283fe34f8..72d0a1a3ced 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Client](../../components/requestbodies/Client.md) +public class RequestBody extends [Client](../../../components/requestbodies/Client.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Client](../../components/requestbodies/Client.md#client1)
+public static class RequestBody1 extends [Client1](../../../components/requestbodies/Client.md#client1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md index 74c9bd15fba..0651521d4b3 100644 --- a/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKeyQuery.class](../../../../components/securityschemes/ApiKeyQuery.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKeyQuery.class](../../../../components/securityschemes/ApiKeyQuery.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md index f308e708d4c..3a5bdb7bc60 100644 --- a/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md +++ b/samples/client/petstore/java/docs/paths/fakedeletecoffeeid/Delete.md @@ -22,8 +22,85 @@ public static class Delete1 extends ApiClient.ApiClient1 implements DeleteOperat a class that allows one to call the endpoint using a method named delete -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.CodedefaultResponse; +import org.openapijsonschematools.client.paths.fakedeletecoffeeid.Delete; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); + + +// Map validation +PathParameters.PathParametersMap pathParameters = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .id("a") + + .build(), + schemaConfiguration +); + +var request = new DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.delete(request); +} 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 (response instanceof Responses.EndpointCode200Response castResponse) { +} else { + Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakehealth/Get.md b/samples/client/petstore/java/docs/paths/fakehealth/Get.md index 59d078db1ee..32d3de4ba5c 100644 --- a/samples/client/petstore/java/docs/paths/fakehealth/Get.md +++ b/samples/client/petstore/java/docs/paths/fakehealth/Get.md @@ -20,8 +20,70 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md index 6d76b64b5dc..6f01f31fd31 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/Post.md @@ -20,8 +20,77 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakeinlinecomposition.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.QueryParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakeinlinecomposition.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +if (castResponse.body instanceof Code200Response.ApplicationjsonResponseBody deserializedBody) { + // handle deserialized body here +} else { + Code200Response.MultipartformdataResponseBody deserializedBody = (Code200Response.MultipartformdataResponseBody) castResponse.body; + // handle deserialized body here +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md index 7ffb61525e4..42b8f6dd39d 100644 --- a/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeinlinecomposition/post/RequestBody.md @@ -31,7 +31,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -43,12 +43,12 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -60,7 +60,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -95,34 +95,34 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md index 50f6b327a13..1e911fb538b 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md +++ b/samples/client/petstore/java/docs/paths/fakejsonformdata/Get.md @@ -20,8 +20,70 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md index 627dd1e9048..a186afc0763 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/Patch.md @@ -20,8 +20,70 @@ public static class Patch1 extends ApiClient.ApiClient1 implements PatchOperatio a class that allows one to call the endpoint using a method named patch -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakejsonpatch.patch.RequestBody; +import org.openapijsonschematools.client.components.schemas.JSONPatchRequest; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakejsonpatch.Patch; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Patch.Patch1 apiClient = new Patch.Patch1(apiConfiguration, schemaConfiguration); + + +var request = new PatchRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.patch(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md index 1030df8f6d8..8f4044c6273 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonpatchjsonMediaType public record ApplicationjsonpatchjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonpatchjsonSchema.ApplicationjsonpatchjsonSchema1](../../../paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md#applicationjsonpatchjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonpatchjsonRequestBody public record ApplicationjsonpatchjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json-patch+json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonpatchjsonRequestBody(ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) body)
Creates an instance | +| ApplicationjsonpatchjsonRequestBody(ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json-patch+json" | -| ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonpatchjsonSchema.[JSONPatchRequest1Boxed](../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md index d1984604169..c8f50418586 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson/ApplicationjsonpatchjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonpatchjsonSchema public class ApplicationjsonpatchjsonSchema
-extends [JSONPatchRequest1](../../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest) +extends [JSONPatchRequest1](../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonpatchjsonSchema1 public static class ApplicationjsonpatchjsonSchema1
-extends [JSONPatchRequest.JSONPatchRequest1](../../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1) +extends [JSONPatchRequest.JSONPatchRequest1](../../../../../../components/schemas/JSONPatchRequest.md#jsonpatchrequest1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md index a789ea7cacc..c600ed01aee 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/Post.md @@ -20,8 +20,72 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakejsonwithcharset.post.RequestBody; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.requestbody.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakejsonwithcharset.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.Applicationjsoncharsetutf8ResponseBody deserializedBody = (Code200Response.Applicationjsoncharsetutf8ResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md index 4d62929c09a..8e7015ce024 100644 --- a/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakejsonwithcharset/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## Applicationjsoncharsetutf8MediaType public record Applicationjsoncharsetutf8MediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1) | schema()
the schema for this MediaType | +| [Applicationjsoncharsetutf8Schema.Applicationjsoncharsetutf8Schema1](../../../paths/fakejsonwithcharset/post/requestbody/content/applicationjsoncharsetutf8/Applicationjsoncharsetutf8Schema.md#applicationjsoncharsetutf8schema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md index 7fcb3e8e9a4..0c5ce872d6c 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/Post.md @@ -20,8 +20,72 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakemultiplerequestbodycontenttypes.post.RequestBody; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.requestbody.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md index 3790fd6e579..5258ce593d8 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.md @@ -31,7 +31,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -43,12 +43,12 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -60,7 +60,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -95,34 +95,34 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ApplicationjsonSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1boxed) | body()
returns the body passed in in the constructor | ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md index 6bcd8534f05..2b87ae47a1c 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/Get.md @@ -20,8 +20,76 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); +securitySchemes.add( + new HttpBasicTest("someUserId", "somePassword"); +); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .fakemultiplesecuritiesGetSecurityInfoSecurityIndex(FakemultiplesecuritiesGetSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.get(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md index 202b98244be..dfdd24f765d 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md @@ -4,7 +4,7 @@ FakemultiplesecuritiesGetSecurityInfo.java public class FakemultiplesecuritiesGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,9 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakemultiplesecuritiesGetSecurityRequirementObject0()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [FakemultiplesecuritiesGetSecurityRequirementObject1()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new [FakemultiplesecuritiesGetSecurityRequirementObject2()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md)
)); | +| [FakemultiplesecuritiesGetSecurityRequirementObject0](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md) | security0 | +| [FakemultiplesecuritiesGetSecurityRequirementObject1](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md) | security1 | +| [FakemultiplesecuritiesGetSecurityRequirementObject2](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md) | security2 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md index b642d36e8d5..2fc62ae0497 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),        List.of()    ),    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),
        List.of()
    ),
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md index a59e0627a45..b073e315c8b 100644 --- a/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md +++ b/samples/client/petstore/java/docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md index 22c4630d3e6..c54fe28b951 100644 --- a/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeobjinquery/Get.md @@ -20,8 +20,69 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md index 1734ac7cfca..77a14552f9d 100644 --- a/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakepemcontenttype/Get.md @@ -20,8 +20,72 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1) | schema()
the schema for this MediaType | +| [ApplicationxpemfileSchema.ApplicationxpemfileSchema1](../../../paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/ApplicationxpemfileSchema.md#applicationxpemfileschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md index d7f708bfa38..a9346a188ed 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/Post.md @@ -22,8 +22,92 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakepetiduploadimagewithrequiredfile.post.RequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.FakepetiduploadimagewithrequiredfilePostSecurityInfo; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex(FakepetiduploadimagewithrequiredfilePostSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +// Map validation +PathParameters.PathParametersMap pathParameters = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md index 47cbe85d783..7d31590a6a5 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.md @@ -4,7 +4,7 @@ FakepetiduploadimagewithrequiredfilePostSecurityInfo.java public class FakepetiduploadimagewithrequiredfilePostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0()](../../../paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md)
)); | +| [FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0](../../../paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md index 26648d87300..dfcea020fdb 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md index e2e1adb6ae8..3e58c101d48 100644 --- a/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md index cf90327aa5d..a1734c23862 100644 --- a/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md +++ b/samples/client/petstore/java/docs/paths/fakequeryparamwithjsoncontenttype/Get.md @@ -22,8 +22,81 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[AnimalFarm1Boxed](../../../../components/schemas/AnimalFarm.md#animalfarm1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[AnimalFarm1Boxed](../../../components/schemas/AnimalFarm.md#animalfarm1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[AnimalFarm1Boxed](../../../../components/schemas/AnimalFarm.md#animalfarm1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[AnimalFarm1Boxed](../../../components/schemas/AnimalFarm.md#animalfarm1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index f4786efc35d..1418728fbd4 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarraymodel/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [AnimalFarm1](../../../../../../../components/schemas/AnimalFarm.md#animalfarm) +extends [AnimalFarm1](../../../../../../components/schemas/AnimalFarm.md#animalfarm) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [AnimalFarm.AnimalFarm1](../../../../../../../components/schemas/AnimalFarm.md#animalfarm1) +extends [AnimalFarm.AnimalFarm1](../../../../../../components/schemas/AnimalFarm.md#animalfarm1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md index 3a6d686f74c..05581875a20 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/Post.md @@ -20,8 +20,72 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakerefsarrayofenums.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.ArrayOfEnums; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakerefsarrayofenums.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md index ae1cbe63ddf..8cdc705b119 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ArrayOfEnums1Boxed](../../../components/schemas/ArrayOfEnums.md#arrayofenums1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 82450aa4900..c49c361c228 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsarrayofenums/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [ArrayOfEnums1](../../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums) +extends [ArrayOfEnums1](../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [ArrayOfEnums.ArrayOfEnums1](../../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums1) +extends [ArrayOfEnums.ArrayOfEnums1](../../../../../../components/schemas/ArrayOfEnums.md#arrayofenums1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md index 91bf55a8053..d2eb60a0c7a 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/Post.md @@ -20,8 +20,72 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakerefsboolean.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.BooleanSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakerefsboolean.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md index 9e85a660909..6097f74bea9 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 1694ac4a00a..d0446d3d804 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsboolean/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [BooleanSchema1](../../../../../../../components/schemas/BooleanSchema.md#booleanschema) +extends [BooleanSchema1](../../../../../../components/schemas/BooleanSchema.md#booleanschema) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [BooleanSchema.BooleanSchema1](../../../../../../../components/schemas/BooleanSchema.md#booleanschema1) +extends [BooleanSchema.BooleanSchema1](../../../../../../components/schemas/BooleanSchema.md#booleanschema1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md index dfa19619600..5e1b8b12e96 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/Post.md @@ -20,8 +20,72 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakerefscomposedoneofnumberwithvalidations.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.ComposedOneOfDifferentTypes; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md index 3c736c0054a..0e61ede331b 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ComposedOneOfDifferentTypes1Boxed](../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 1e3738551c2..6d15e5f1438 100644 --- a/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefscomposedoneofnumberwithvalidations/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [ComposedOneOfDifferentTypes1](../../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes) +extends [ComposedOneOfDifferentTypes1](../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](../../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) +extends [ComposedOneOfDifferentTypes.ComposedOneOfDifferentTypes1](../../../../../../components/schemas/ComposedOneOfDifferentTypes.md#composedoneofdifferenttypes1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md index 1165fe8a0d7..77f32d0c789 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/Post.md @@ -20,8 +20,72 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakerefsenum.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.StringEnum; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakerefsenum.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md index 759f5de5c67..385c2e4a878 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[StringEnum1Boxed](../../../../components/schemas/StringEnum.md#stringenum1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[StringEnum1Boxed](../../../components/schemas/StringEnum.md#stringenum1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[StringEnum1Boxed](../../../../components/schemas/StringEnum.md#stringenum1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[StringEnum1Boxed](../../../components/schemas/StringEnum.md#stringenum1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 2ac02fd09b9..d83adaf246f 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsenum/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [StringEnum1](../../../../../../../components/schemas/StringEnum.md#stringenum) +extends [StringEnum1](../../../../../../components/schemas/StringEnum.md#stringenum) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [StringEnum.StringEnum1](../../../../../../../components/schemas/StringEnum.md#stringenum1) +extends [StringEnum.StringEnum1](../../../../../../components/schemas/StringEnum.md#stringenum1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md index 54a746a8f69..cdcf9614119 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/Post.md @@ -22,8 +22,75 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.RootServerInfo; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.Mammal; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakerefsmammal.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md index 6b08a8b5a27..64fb8aa98e1 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[Mammal1Boxed](../../../../components/schemas/Mammal.md#mammal1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[Mammal1Boxed](../../../components/schemas/Mammal.md#mammal1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[Mammal1Boxed](../../../../components/schemas/Mammal.md#mammal1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[Mammal1Boxed](../../../components/schemas/Mammal.md#mammal1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index f0a5b53544f..b1b525d94da 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsmammal/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [Mammal1](../../../../../../../components/schemas/Mammal.md#mammal) +extends [Mammal1](../../../../../../components/schemas/Mammal.md#mammal) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [Mammal.Mammal1](../../../../../../../components/schemas/Mammal.md#mammal1) +extends [Mammal.Mammal1](../../../../../../components/schemas/Mammal.md#mammal1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md index b14e8af78a6..076da420c03 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/Post.md @@ -20,8 +20,72 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakerefsnumber.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.NumberWithValidations; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakerefsnumber.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md index 22ca5825b4d..bf52e31b42d 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[NumberWithValidations1Boxed](../../../components/schemas/NumberWithValidations.md#numberwithvalidations1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index a903474b2ee..a6a485e5657 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsnumber/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [NumberWithValidations1](../../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations) +extends [NumberWithValidations1](../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [NumberWithValidations.NumberWithValidations1](../../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1) +extends [NumberWithValidations.NumberWithValidations1](../../../../../../components/schemas/NumberWithValidations.md#numberwithvalidations1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md index 569e2c4a6c6..4b07291c56b 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/Post.md @@ -20,8 +20,72 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakerefsobjectmodelwithrefprops.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.ObjectModelWithRefProps; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md index 6d81f6580ca..fa402eba521 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[ObjectModelWithRefProps1Boxed](../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 495e07e6094..0cdc2140e3a 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsobjectmodelwithrefprops/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [ObjectModelWithRefProps1](../../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops) +extends [ObjectModelWithRefProps1](../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [ObjectModelWithRefProps.ObjectModelWithRefProps1](../../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) +extends [ObjectModelWithRefProps.ObjectModelWithRefProps1](../../../../../../components/schemas/ObjectModelWithRefProps.md#objectmodelwithrefprops1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md index 12fdec36a3e..5ef61bea0e5 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/Post.md @@ -20,8 +20,72 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakerefsstring.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.StringSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakerefsstring.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md index 546531f6ffd..dadb1fcd877 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 8fadd779761..abe4f0713c9 100644 --- a/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/fakerefsstring/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [StringSchema1](../../../../../../../components/schemas/StringSchema.md#stringschema) +extends [StringSchema1](../../../../../../components/schemas/StringSchema.md#stringschema) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [StringSchema.StringSchema1](../../../../../../../components/schemas/StringSchema.md#stringschema1) +extends [StringSchema.StringSchema1](../../../../../../components/schemas/StringSchema.md#stringschema1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md index a8e1f04cf2d..71e144d57ba 100644 --- a/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md +++ b/samples/client/petstore/java/docs/paths/fakeresponsewithoutschema/Get.md @@ -20,8 +20,68 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1) | schema()
the schema for this MediaType | +| [ApplicationoctetstreamSchema.ApplicationoctetstreamSchema1](../../../paths/fakeuploaddownloadfile/post/requestbody/content/applicationoctetstream/ApplicationoctetstreamSchema.md#applicationoctetstreamschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md index 4942566ce4c..7501fc1831a 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/Post.md @@ -20,8 +20,72 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakeuploadfile.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.requestbody.content.multipartformdata.MultipartformdataSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakeuploadfile.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md index 50e947003b9..bd73b367e08 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfile/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md index 04889c52b27..e3775d87065 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/Post.md @@ -20,8 +20,72 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.fakeuploadfiles.post.RequestBody; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.requestbody.content.multipartformdata.MultipartformdataSchema; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.fakeuploadfiles.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +var request = new PostRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; +// handle deserialized body here +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md b/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md index 2f0056fe248..0b3ec075d2c 100644 --- a/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/fakeuploadfiles/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md index 3d59d81d0fd..15119587928 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/Get.md @@ -20,8 +20,89 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
class that stores a server index | | enum | [FooGetServerInfo.ServerIndex](#serverindex)
class that stores a server index | +## FooGetServerInfo1 +implements ServerProvider<[ServerIndex](#serverindex)>
+ +A class that stores servers and allows one to be returned with a ServerIndex instance + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooGetServerInfo1()
Creates an instance using default server variable values | +| FooGetServerInfo1(@Nullable [FooGetServer0](../../../paths/foo/get/servers/FooGetServer0.md) server0,@Nullable [FooGetServer1](../../../paths/foo/get/servers/FooGetServer1.md) server1)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [FooGetServer0](../../../paths/foo/get/servers/FooGetServer0.md) | server0 | +| [FooGetServer1](../../../paths/foo/get/servers/FooGetServer1.md) | server1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + ## ServerIndex enum ServerIndex
diff --git a/samples/client/petstore/java/docs/paths/pet/Post.md b/samples/client/petstore/java/docs/paths/pet/Post.md index 48dbbe20d67..f23d6c37030 100644 --- a/samples/client/petstore/java/docs/paths/pet/Post.md +++ b/samples/client/petstore/java/docs/paths/pet/Post.md @@ -22,8 +22,130 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.RootServerInfo; +import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; +import org.openapijsonschematools.client.paths.pet.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.Pet; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.components.securityschemes.HttpSignatureTest; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.pet.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.pet.post.responses.Code405Response; +import org.openapijsonschematools.client.paths.pet.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petPostSecurityInfoSecurityIndex(PetPostSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +Pet1BoxedMap requestBodyPayload = + Pet.Pet1.validateAndBox( + new Pet.PetMapBuilder() + .name("a") + + .photoUrls( + Arrays.asList( + "a" + ) + ) + .id(1L) + + .category( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ), + new AbstractMap.SimpleEntry( + "id", + 1L + ) + ) + ) + .tags( + Arrays.asList( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ) + ) + ) + ) + .status("available") + + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (Code405Response.ResponseApiException e) { + // server returned an error response defined in the openapi document + throw e; +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/pet/Put.md b/samples/client/petstore/java/docs/paths/pet/Put.md index f02961e0d91..26a031cc6ef 100644 --- a/samples/client/petstore/java/docs/paths/pet/Put.md +++ b/samples/client/petstore/java/docs/paths/pet/Put.md @@ -22,8 +22,126 @@ public static class Put1 extends ApiClient.ApiClient1 implements PutOperation
securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petPutSecurityInfoSecurityIndex(PetPutSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Put.Put1 apiClient = new Put.Put1(apiConfiguration, schemaConfiguration); + + +Pet1BoxedMap requestBodyPayload = + Pet.Pet1.validateAndBox( + new Pet.PetMapBuilder() + .name("a") + + .photoUrls( + Arrays.asList( + "a" + ) + ) + .id(1L) + + .category( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ), + new AbstractMap.SimpleEntry( + "id", + 1L + ) + ) + ) + .tags( + Arrays.asList( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "name", + "a" + ) + ) + ) + ) + .status("available") + + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PutRequestBuilder() + .requestBody(requestBody) + .build(); + +Void response; +try { + response = apiClient.put(request); +} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException | Code405Response.ResponseApiException e) { + // server returned an error response defined in the openapi document + throw e; +} 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; +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md b/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md index bfcbdaed682..233fdd10e78 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/pet/post/PetPostSecurityInfo.md @@ -4,7 +4,7 @@ PetPostSecurityInfo.java public class PetPostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,9 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetPostSecurityRequirementObject0()](../../../paths/pet/post/security/PetPostSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetPostSecurityRequirementObject1()](../../../paths/pet/post/security/PetPostSecurityRequirementObject1.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new [PetPostSecurityRequirementObject2()](../../../paths/pet/post/security/PetPostSecurityRequirementObject2.md)
)); | +| [PetPostSecurityRequirementObject0](../../../paths/pet/post/security/PetPostSecurityRequirementObject0.md) | security0 | +| [PetPostSecurityRequirementObject1](../../../paths/pet/post/security/PetPostSecurityRequirementObject1.md) | security1 | +| [PetPostSecurityRequirementObject2](../../../paths/pet/post/security/PetPostSecurityRequirementObject2.md) | security2 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md b/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md index da70cdc38c1..ee81d9d563b 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/pet/post/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Pet](../../components/requestbodies/Pet.md) +public class RequestBody extends [Pet](../../../components/requestbodies/Pet.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Pet](../../components/requestbodies/Pet.md#pet1)
+public static class RequestBody1 extends [Pet1](../../../components/requestbodies/Pet.md#pet1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md index 34870b66eb6..dc904ae9529 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md index 1cb682b7915..4ffc2e46b31 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md index ccb5edf9c7a..88db581a2d6 100644 --- a/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md +++ b/samples/client/petstore/java/docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md b/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md index 1f13f8174c2..1136055dad2 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/pet/put/PetPutSecurityInfo.md @@ -4,7 +4,7 @@ PetPutSecurityInfo.java public class PetPutSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,8 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetPutSecurityRequirementObject0()](../../../paths/pet/put/security/PetPutSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetPutSecurityRequirementObject1()](../../../paths/pet/put/security/PetPutSecurityRequirementObject1.md)
)); | +| [PetPutSecurityRequirementObject0](../../../paths/pet/put/security/PetPutSecurityRequirementObject0.md) | security0 | +| [PetPutSecurityRequirementObject1](../../../paths/pet/put/security/PetPutSecurityRequirementObject1.md) | security1 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md b/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md index da70cdc38c1..ee81d9d563b 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/pet/put/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [Pet](../../components/requestbodies/Pet.md) +public class RequestBody extends [Pet](../../../components/requestbodies/Pet.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [Pet](../../components/requestbodies/Pet.md#pet1)
+public static class RequestBody1 extends [Pet1](../../../components/requestbodies/Pet.md#pet1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md index 23269a709b1..a0bb52235ba 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md index d57a44d83e2..9dd305982f5 100644 --- a/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md index 535451d5ccc..3c051b1b538 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/Get.md @@ -22,8 +22,100 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petfindbystatusGetSecurityInfoSecurityIndex(PetfindbystatusGetSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + + +// Map validation +QueryParameters.QueryParametersMap queryParameters = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .status( + Arrays.asList( + "available" + ) + ) + .build(), + schemaConfiguration +); + +var request = new GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (Code400Response.ResponseApiException e) { + // server returned an error response defined in the openapi document + throw e; +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md b/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md index 8eaa744bf52..65da91a672e 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/PetfindbystatusServerInfo.md @@ -4,13 +4,37 @@ PetfindbystatusServerInfo.java public class PetfindbystatusServerInfo A class that provides a server, and any needed server info classes +- a class that is a ServerProvider - an enum class that stores server index values ## Nested Class Summary | Modifier and Type | Class and Description | | ----------------- | --------------------- | +| static class | [PetfindbystatusServerInfo.PetfindbystatusServerInfo1](#petfindbystatusserverinfo1)
class that stores a server index | | enum | [PetfindbystatusServerInfo.ServerIndex](#serverindex)
class that stores a server index | +## PetfindbystatusServerInfo1 +implements ServerProvider<[ServerIndex](#serverindex)>
+ +A class that stores servers and allows one to be returned with a ServerIndex instance + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PetfindbystatusServerInfo1()
Creates an instance using default server variable values | +| PetfindbystatusServerInfo1(@Nullable [PetfindbystatusServer0](../../paths/petfindbystatus/servers/PetfindbystatusServer0.md) server0,@Nullable [PetfindbystatusServer1](../../paths/petfindbystatus/servers/PetfindbystatusServer1.md) server1)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [PetfindbystatusServer0](../../paths/petfindbystatus/servers/PetfindbystatusServer0.md) | server0 | +| [PetfindbystatusServer1](../../paths/petfindbystatus/servers/PetfindbystatusServer1.md) | server1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + ## ServerIndex enum ServerIndex
diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md index c3cc586c35b..a0bc58eb967 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md @@ -4,7 +4,7 @@ PetfindbystatusGetSecurityInfo.java public class PetfindbystatusGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,9 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetfindbystatusGetSecurityRequirementObject0()](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetfindbystatusGetSecurityRequirementObject1()](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new [PetfindbystatusGetSecurityRequirementObject2()](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md)
)); | +| [PetfindbystatusGetSecurityRequirementObject0](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md) | security0 | +| [PetfindbystatusGetSecurityRequirementObject1](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md) | security1 | +| [PetfindbystatusGetSecurityRequirementObject2](../../../paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md) | security2 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md index a656f810b95..608eb248028 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md index d505ac57b5b..6749160f760 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md index 38f9d7030cc..7f0527ce9f7 100644 --- a/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md +++ b/samples/client/petstore/java/docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md index a3032f20dbd..685df8f5a4b 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/Get.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/Get.md @@ -22,8 +22,98 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petfindbytagsGetSecurityInfoSecurityIndex(PetfindbytagsGetSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + + +// Map validation +QueryParameters.QueryParametersMap queryParameters = + QueryParameters.QueryParameters1.validate( + new QueryParameters.QueryParametersMapBuilder() + .tags( + Arrays.asList( + "a" + ) + ) + .build(), + schemaConfiguration +); + +var request = new GetRequestBuilder() + .queryParameters(queryParameters) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (Code400Response.ResponseApiException e) { + // server returned an error response defined in the openapi document + throw e; +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md index 9d0ab412696..ea6339e8f26 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md @@ -4,7 +4,7 @@ PetfindbytagsGetSecurityInfo.java public class PetfindbytagsGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,8 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetfindbytagsGetSecurityRequirementObject0()](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetfindbytagsGetSecurityRequirementObject1()](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md)
)); | +| [PetfindbytagsGetSecurityRequirementObject0](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md) | security0 | +| [PetfindbytagsGetSecurityRequirementObject1](../../../paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md) | security1 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md index 8cec8cbafe3..256a672a40f 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [HttpSignatureTest.class](../../../../components/securityschemes/HttpSignatureTest.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md index 003dc335aa8..39a130b834f 100644 --- a/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Delete.md b/samples/client/petstore/java/docs/paths/petpetid/Delete.md index c4c7ca08460..1f5d91cb3a3 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Delete.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Delete.md @@ -22,8 +22,96 @@ public static class Delete1 extends ApiClient.ApiClient1 implements DeleteOperat a class that allows one to call the endpoint using a method named delete -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.petpetid.delete.HeaderParameters; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.delete.PetpetidDeleteSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.delete.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.petpetid.delete.responses.Code400Response; +import org.openapijsonschematools.client.paths.petpetid.Delete; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petpetidDeleteSecurityInfoSecurityIndex(PetpetidDeleteSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); + + +// Map validation +PathParameters.PathParametersMap pathParameters = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Void response; +try { + response = apiClient.delete(request); +} catch (Code400Response.ResponseApiException e) { + // server returned an error response defined in the openapi document + throw e; +} 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; +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Get.md b/samples/client/petstore/java/docs/paths/petpetid/Get.md index e3e7328fb47..7716f7374fc 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Get.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Get.md @@ -22,8 +22,103 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petpetidGetSecurityInfoSecurityIndex(PetpetidGetSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + + +// Map validation +PathParameters.PathParametersMap pathParameters = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new GetRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.get(request); +} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { + // server returned an error response defined in the openapi document + throw e; +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +if (castResponse.body instanceof Code200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petpetid/Post.md b/samples/client/petstore/java/docs/paths/petpetid/Post.md index 3518498d3af..ae19e21515d 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetid/Post.md @@ -22,8 +22,96 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.petpetid.post.RequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetid.post.PetpetidPostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetid.post.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.ApiKey; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.petpetid.post.responses.Code405Response; +import org.openapijsonschematools.client.paths.petpetid.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +List securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petpetidPostSecurityInfoSecurityIndex(PetpetidPostSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +// Map validation +PathParameters.PathParametersMap pathParameters = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Void response; +try { + response = apiClient.post(request); +} catch (Code405Response.ResponseApiException e) { + // server returned an error response defined in the openapi document + throw e; +} 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; +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md index 78dca588af1..0a71b0d01f1 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetid/delete/PetpetidDeleteSecurityInfo.md @@ -4,7 +4,7 @@ PetpetidDeleteSecurityInfo.java public class PetpetidDeleteSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,8 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetidDeleteSecurityRequirementObject0()](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetpetidDeleteSecurityRequirementObject1()](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md)
)); | +| [PetpetidDeleteSecurityRequirementObject0](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md) | security0 | +| [PetpetidDeleteSecurityRequirementObject1](../../../paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md) | security1 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md index 1bfbaa536d1..f80b6f15b40 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md index 70dcf48c967..8877bdea9a3 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md index f6403d11468..c6615ea3fa9 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetid/get/PetpetidGetSecurityInfo.md @@ -4,7 +4,7 @@ PetpetidGetSecurityInfo.java public class PetpetidGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetidGetSecurityRequirementObject0()](../../../paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md)
)); | +| [PetpetidGetSecurityRequirementObject0](../../../paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md index 6a56d6d61e7..77bfdbe2448 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md index 18f25e685bf..915b9ce6f7c 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/PetpetidPostSecurityInfo.md @@ -4,7 +4,7 @@ PetpetidPostSecurityInfo.java public class PetpetidPostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,8 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetidPostSecurityRequirementObject0()](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md),
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [PetpetidPostSecurityRequirementObject1()](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md)
)); | +| [PetpetidPostSecurityRequirementObject0](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md) | security0 | +| [PetpetidPostSecurityRequirementObject1](../../../paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md) | security1 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md b/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md index 37eadc5c54d..672ae8e9af1 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationxwwwformurlencodedMediaType public record ApplicationxwwwformurlencodedMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | +| [ApplicationxwwwformurlencodedSchema.ApplicationxwwwformurlencodedSchema1](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationxwwwformurlencodedRequestBody public record ApplicationxwwwformurlencodedRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/x-www-form-urlencoded" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | +| ApplicationxwwwformurlencodedRequestBody(ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/x-www-form-urlencoded" | -| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | +| ApplicationxwwwformurlencodedSchema.[ApplicationxwwwformurlencodedSchema1Boxed](../../../paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md#applicationxwwwformurlencodedschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md index cd3e742dcd2..0e8d3540345 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md index ad6ba36e84e..fb9621d4c1e 100644 --- a/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md +++ b/samples/client/petstore/java/docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md index 7dd09fbfb2d..b2cb8065834 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/Post.md @@ -22,8 +22,92 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.paths.petpetiduploadimage.post.RequestBody; +import org.openapijsonschematools.client.RootServerInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.components.securityschemes.PetstoreAuth; +import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.Code200Response; +import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; +import org.openapijsonschematools.client.paths.petpetiduploadimage.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +List securitySchemes = new ArrayList(); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .petpetiduploadimagePostSecurityInfoSecurityIndex(PetpetiduploadimagePostSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +// Map validation +PathParameters.PathParametersMap pathParameters = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .petId(1L) + + .build(), + schemaConfiguration +); + +var request = new PostRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md index 5c45e3b65b1..a6c84397204 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md @@ -4,7 +4,7 @@ PetpetiduploadimagePostSecurityInfo.java public class PetpetiduploadimagePostSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [PetpetiduploadimagePostSecurityRequirementObject0()](../../../paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md)
)); | +| [PetpetiduploadimagePostSecurityRequirementObject0](../../../paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md index c5faf95b33b..d65d0664340 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## MultipartformdataMediaType public record MultipartformdataMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[MultipartformdataSchema.MultipartformdataSchema1](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [MultipartformdataSchema.MultipartformdataSchema1](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | +| [MultipartformdataSchema.MultipartformdataSchema1](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## MultipartformdataRequestBody public record MultipartformdataRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="multipart/form-data" ### Constructor Summary | Constructor and Description | | --------------------------- | -| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | +| MultipartformdataRequestBody(MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "multipart/form-data" | -| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | +| MultipartformdataSchema.[MultipartformdataSchema1Boxed](../../../paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md#multipartformdataschema1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md index e31f5956998..adb3502a449 100644 --- a/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),        List.of("write:pets", "read:pets")    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [PetstoreAuth.class](../../../../components/securityschemes/PetstoreAuth.md),
        List.of("write:pets", "read:pets")
    )) | diff --git a/samples/client/petstore/java/docs/paths/solidus/Get.md b/samples/client/petstore/java/docs/paths/solidus/Get.md index 03e0717d96e..e98e2da79f5 100644 --- a/samples/client/petstore/java/docs/paths/solidus/Get.md +++ b/samples/client/petstore/java/docs/paths/solidus/Get.md @@ -20,8 +20,68 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
securitySchemes = new ArrayList(); +securitySchemes.add( + new ApiKey("someApiKey"); +); +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfo(); + .storeinventoryGetSecurityInfoSecurityIndex(StoreinventoryGetSecurityInfo.SecurityIndex.SECURITY_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + securitySchemes, + securityIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Get.Get1 apiClient = new Get.Get1(apiConfiguration, schemaConfiguration); + + +var request = new GetRequestBuilder().build(); + +Responses.EndpointResponse response; +try { + response = apiClient.get(request); +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md b/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md index eca03625ce0..2f5f07f0f26 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md @@ -4,7 +4,7 @@ StoreinventoryGetSecurityInfo.java public class StoreinventoryGetSecurityInfo A class that provides a security requirement object, and any needed security info classes -- a class that stores a securityIndex and provides a SecurityRequirementsObject +- a class that is a SecurityRequirementObjectProvider - an enum class that describes security index values ## Nested Class Summary @@ -24,7 +24,7 @@ implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| EnumMap | securities = new EnumMap<>(Map.ofEntries(
    new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [StoreinventoryGetSecurityRequirementObject0()](../../../paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md)
)); | +| [StoreinventoryGetSecurityRequirementObject0](../../../paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md) | security0 | ### Method Summary | Modifier and Type | Method and Description | diff --git a/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md b/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md index ae36a11c931..d979d8cb08c 100644 --- a/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md +++ b/samples/client/petstore/java/docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md @@ -12,4 +12,4 @@ extends SecurityRequirementObject ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | -| Map, List> | securitySchemeToScopes = Map.ofEntries(    new AbstractMap.SimpleEntry, List>(        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),        List.of()    )) | +| Map, List> | securitySchemeToScopes = Map.ofEntries(
    new AbstractMap.SimpleEntry, List>(
        [ApiKey.class](../../../../components/securityschemes/ApiKey.md),
        List.of()
    )) | diff --git a/samples/client/petstore/java/docs/paths/storeorder/Post.md b/samples/client/petstore/java/docs/paths/storeorder/Post.md index 626f3ab09c0..e8b7295b563 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/Post.md +++ b/samples/client/petstore/java/docs/paths/storeorder/Post.md @@ -22,8 +22,102 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.RootServerInfo; +import org.openapijsonschematools.client.paths.storeorder.post.RequestBody; +import org.openapijsonschematools.client.components.schemas.Order; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.storeorder.post.responses.Code200Response; +import org.openapijsonschematools.client.paths.storeorder.post.responses.Code400Response; +import org.openapijsonschematools.client.paths.storeorder.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +Order1BoxedMap requestBodyPayload = + Order.Order1.validateAndBox( + new Order.OrderMapBuilder() + .id(1L) + + .petId(1L) + + .quantity(1) + + .shipDate("1970-01-01T00:00:00.00Z") + + .status("placed") + + .complete(true) + + .build(), + schemaConfiguration +); +Post.SealedRequestBody requestBody = new Post.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} catch (Code400Response.ResponseApiException e) { + // server returned an error response defined in the openapi document + throw e; +} 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; +} +Responses.EndpointCode200Response castResponse = (Responses.EndpointCode200Response) response; +if (castResponse.body instanceof Code200Response.ApplicationxmlResponseBody deserializedBody) { + // handle deserialized body here +} else { + Code200Response.ApplicationjsonResponseBody deserializedBody = (Code200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md b/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md index 64d7782838d..98ae13f9473 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/storeorder/post/RequestBody.md @@ -28,7 +28,7 @@ sealed interface that stores schema and encoding info ## ApplicationjsonMediaType public record ApplicationjsonMediaType
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[Order1Boxed](../../../components/schemas/Order.md#order1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[Order1Boxed](../../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[Order1Boxed](../../../components/schemas/Order.md#order1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index e069f9c21c8..25524457185 100644 --- a/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/storeorder/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [Order1](../../../../../../../components/schemas/Order.md#order) +extends [Order1](../../../../../../components/schemas/Order.md#order) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [Order.Order1](../../../../../../../components/schemas/Order.md#order1) +extends [Order.Order1](../../../../../../components/schemas/Order.md#order1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md index e6ee67aaee0..e84a5ca3713 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Delete.md @@ -22,8 +22,84 @@ public static class Delete1 extends ApiClient.ApiClient1 implements DeleteOperat a class that allows one to call the endpoint using a method named delete -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.RootServerInfo; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.PathParameters; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code400Response; +import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code404Response; +import org.openapijsonschematools.client.paths.storeorderorderid.Delete; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Delete.Delete1 apiClient = new Delete.Delete1(apiConfiguration, schemaConfiguration); + + +// Map validation +PathParameters.PathParametersMap pathParameters = + PathParameters.PathParameters1.validate( + new PathParameters.PathParametersMapBuilder() + .order_id("a") + + .build(), + schemaConfiguration +); + +var request = new DeleteRequestBuilder() + .pathParameters(pathParameters) + .build(); + +Void response; +try { + response = apiClient.delete(request); +} catch (Code400Response.ResponseApiException | Code404Response.ResponseApiException e) { + // server returned an error response defined in the openapi document + throw e; +} 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; +} +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md index 707115a6828..21415665295 100644 --- a/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md +++ b/samples/client/petstore/java/docs/paths/storeorderorderid/Get.md @@ -22,8 +22,92 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md index 3433b43b8a4..87ec51870cc 100644 --- a/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/user/post/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [User1](../../../../../../../components/schemas/User.md#user) +extends [User1](../../../../../../components/schemas/User.md#user) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../../components/schemas/User.md#user1) +extends [User.User1](../../../../../../components/schemas/User.md#user1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md index 30ef103ec9c..4a59f7a599d 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/Post.md @@ -22,8 +22,120 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.RootServerInfo; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.RequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.CodedefaultResponse; +import org.openapijsonschematools.client.paths.usercreatewitharray.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +ApplicationjsonSchema1BoxedList requestBodyPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( + new ApplicationjsonSchema.ApplicationjsonSchemaListBuilder() + .add( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "id", + 1L + ), + new AbstractMap.SimpleEntry( + "username", + "a" + ), + new AbstractMap.SimpleEntry( + "firstName", + "a" + ), + new AbstractMap.SimpleEntry( + "lastName", + "a" + ), + new AbstractMap.SimpleEntry( + "email", + "a" + ), + new AbstractMap.SimpleEntry( + "password", + "a" + ), + new AbstractMap.SimpleEntry( + "phone", + "a" + ), + new AbstractMap.SimpleEntry( + "userStatus", + 1 + ), + new AbstractMap.SimpleEntry( + "objectWithNoDeclaredPropsNullable", + null + ) + ) + ) + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md b/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md index 33628aac017..c3f2cf9f53e 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/usercreatewitharray/post/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [UserArray](../../components/requestbodies/UserArray.md) +public class RequestBody extends [UserArray](../../../components/requestbodies/UserArray.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [UserArray](../../components/requestbodies/UserArray.md#userarray1)
+public static class RequestBody1 extends [UserArray1](../../../components/requestbodies/UserArray.md#userarray1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md index 1f7279bdc8b..1692dc67f66 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/Post.md @@ -22,8 +22,120 @@ public static class Post1 extends ApiClient.ApiClient1 implements PostOperation< a class that allows one to call the endpoint using a method named post -TODO code sample - +### Code Sample +``` +import org.openapijsonschematools.client.configurations.ApiConfiguration; +import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +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.RootServerInfo; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.RequestBody; +import org.openapijsonschematools.client.components.requestbodies.userarray.content.applicationjson.ApplicationjsonSchema; +import org.openapijsonschematools.client.servers.Server0; +import org.openapijsonschematools.client.servers.Server1; +import org.openapijsonschematools.client.servers.Server2; +import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.CodedefaultResponse; +import org.openapijsonschematools.client.paths.usercreatewithlist.Post; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +// if you want to use a sever that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfo( + new Server0(), + null, + null +); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfo() + .rootServerInfoServerIndex(RootServerInfo.ServerIndex.SERVER_0); +Duration timeout = Duration.ofSeconds(1L); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + timeout +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); +Post.Post1 apiClient = new Post.Post1(apiConfiguration, schemaConfiguration); + + +ApplicationjsonSchema1BoxedList requestBodyPayload = + ApplicationjsonSchema.ApplicationjsonSchema1.validateAndBox( + new ApplicationjsonSchema.ApplicationjsonSchemaListBuilder() + .add( + MapUtils.makeMap( + new AbstractMap.SimpleEntry( + "id", + 1L + ), + new AbstractMap.SimpleEntry( + "username", + "a" + ), + new AbstractMap.SimpleEntry( + "firstName", + "a" + ), + new AbstractMap.SimpleEntry( + "lastName", + "a" + ), + new AbstractMap.SimpleEntry( + "email", + "a" + ), + new AbstractMap.SimpleEntry( + "password", + "a" + ), + new AbstractMap.SimpleEntry( + "phone", + "a" + ), + new AbstractMap.SimpleEntry( + "userStatus", + 1 + ), + new AbstractMap.SimpleEntry( + "objectWithNoDeclaredPropsNullable", + null + ) + ) + ) + .build(), + schemaConfiguration +); +RequestBody.SealedRequestBody requestBody = new RequestBody.ApplicationjsonRequestBody(requestBodyPayload); + +var request = new PostRequestBuilder() + .requestBody(requestBody) + .build(); + +Responses.EndpointResponse response; +try { + response = apiClient.post(request); +} 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; +} +Responses.EndpointCodedefaultResponse castResponse = (Responses.EndpointCodedefaultResponse) response; +``` ### Constructor Summary | Constructor and Description | | --------------------------- | diff --git a/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md b/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md index 63751df47b6..8a4cde3614a 100644 --- a/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md +++ b/samples/client/petstore/java/docs/paths/usercreatewithlist/post/RequestBody.md @@ -1,6 +1,6 @@ # RequestBody -public class RequestBody extends [RefUserArray](../../components/requestbodies/RefUserArray.md) +public class RequestBody extends [RefUserArray](../../../components/requestbodies/RefUserArray.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 @@ -11,7 +11,7 @@ A class (extended from the $ref class) that contains necessary nested request bo | static class | [RequestBody.RequestBody1](#requestbody1)
class that serializes request bodies | ## RequestBody1 -public static class RequestBody1 extends [RefUserArray](../../components/requestbodies/RefUserArray.md#refuserarray1)
+public static class RequestBody1 extends [RefUserArray1](../../../components/requestbodies/RefUserArray.md#refuserarray1)
a class that serializes SealedRequestBody request bodies, extended from the $ref class diff --git a/samples/client/petstore/java/docs/paths/userlogin/Get.md b/samples/client/petstore/java/docs/paths/userlogin/Get.md index a8324e391e3..e7361ffeef9 100644 --- a/samples/client/petstore/java/docs/paths/userlogin/Get.md +++ b/samples/client/petstore/java/docs/paths/userlogin/Get.md @@ -22,8 +22,94 @@ public static class Get1 extends ApiClient.ApiClient1 implements GetOperation
-implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> +implements [SealedMediaType](#sealedmediatype), MediaType<[ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1), Void> class storing schema info for a specific contentType @@ -40,7 +40,7 @@ class storing schema info for a specific contentType ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | +| [ApplicationjsonSchema.ApplicationjsonSchema1](../../../paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md#applicationjsonschema1) | schema()
the schema for this MediaType | | Void | encoding()
the encoding info | ## RequestBody1 @@ -74,17 +74,17 @@ sealed interface that stores request contentType + validated schema data ## ApplicationjsonRequestBody public record ApplicationjsonRequestBody
implements [SealedRequestBody](#sealedrequestbody),
-GenericRequestBody
+GenericRequestBody
A record class to store request body input for contentType="application/json" ### Constructor Summary | Constructor and Description | | --------------------------- | -| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) body)
Creates an instance | +| ApplicationjsonRequestBody(ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) body)
Creates an instance | ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | | String | contentType()
always returns "application/json" | -| ApplicationjsonSchema.[User1Boxed](../../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | +| ApplicationjsonSchema.[User1Boxed](../../../components/schemas/User.md#user1boxed) | body()
returns the body passed in in the constructor | diff --git a/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md b/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md index 3433b43b8a4..87ec51870cc 100644 --- a/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md +++ b/samples/client/petstore/java/docs/paths/userusername/put/requestbody/content/applicationjson/ApplicationjsonSchema.md @@ -1,6 +1,6 @@ # ApplicationjsonSchema public class ApplicationjsonSchema
-extends [User1](../../../../../../../components/schemas/User.md#user) +extends [User1](../../../../../../components/schemas/User.md#user) A class that contains necessary nested - schema classes (which validate payloads), extends JsonSchema @@ -14,6 +14,6 @@ A class that contains necessary nested ## ApplicationjsonSchema1 public static class ApplicationjsonSchema1
-extends [User.User1](../../../../../../../components/schemas/User.md#user1) +extends [User.User1](../../../../../../components/schemas/User.md#user1) A schema class that validates payloads diff --git a/samples/client/petstore/java/docs/servers/Server0.md b/samples/client/petstore/java/docs/servers/Server0.md index 4612ee1d333..199ec6ccd47 100644 --- a/samples/client/petstore/java/docs/servers/Server0.md +++ b/samples/client/petstore/java/docs/servers/Server0.md @@ -11,499 +11,12 @@ petstore server | Constructor and Description | | --------------------------- | | Server0()
Creates a server using default values for variables | -| Server0([Variables.VariablesMap](#variablesmap) variables)
Creates a server using input values for variables | +| Server0([Variables.VariablesMap](../servers/server0/Variables.md#variablesmap) variables)
Creates a server using input values for variables | ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | | String | url = "http://{server}.swagger.io:{port}/v2" | -| [Variables.VariablesMap](#variablesmap) | variables | - -## Variables -public class Variables
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads -- enum classes - -### Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Variables.Variables1Boxed](#variables1boxed)
sealed interface for validated payloads | -| record | [Variables.Variables1BoxedMap](#variables1boxedmap)
boxed class to store validated Map payloads | -| static class | [Variables.Variables1](#variables1)
schema class | -| static class | [Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | -| static class | [Variables.VariablesMap](#variablesmap)
output class for Map payloads | -| sealed interface | [Variables.PortBoxed](#portboxed)
sealed interface for validated payloads | -| record | [Variables.PortBoxedString](#portboxedstring)
boxed class to store validated String payloads | -| static class | [Variables.Port](#port)
schema class | -| enum | [Variables.StringPortEnums](#stringportenums)
String enum | -| sealed interface | [Variables.ServerBoxed](#serverboxed)
sealed interface for validated payloads | -| record | [Variables.ServerBoxedString](#serverboxedstring)
boxed class to store validated String payloads | -| static class | [Variables.Server](#server)
schema class | -| enum | [Variables.StringServerEnums](#stringserverenums)
String enum | -| sealed interface | [Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [Variables.AdditionalProperties](#additionalproperties)
schema class | - -### Variables1Boxed -public sealed interface Variables1Boxed
-permits
-[Variables1BoxedMap](#variables1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -### Variables1BoxedMap -public record Variables1BoxedMap
-implements [Variables1Boxed](#variables1boxed) - -record that stores validated Map payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Variables1BoxedMap([VariablesMap](#variablesmap) data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap](#variablesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### Variables1 -public static class Variables1
-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.servers.server0.Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); - -// Map validation -Variables.VariablesMap validatedPayload = - Variables.Variables1.validate( - new Variables.VariablesMapBuilder() - .port("80") - - .server("petstore") - - .build(), - configuration -); -``` - -#### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("server", [Server.class](#server))),
    new PropertyEntry("port", [Port.class](#port)))
)
| -| Set | required = Set.of(
    "port",
    "server"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap](#variablesmap) | validate([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [Variables1BoxedMap](#variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [Variables1Boxed](#variables1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -### VariablesMap00Builder -public class VariablesMap00Builder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMap00Builder(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 | - -### VariablesMap01Builder -public class VariablesMap01Builder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMap01Builder(Map instance)
Creates a builder that contains the passed instance | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap00Builder](#variablesmap00builder) | server(String value) | -| [VariablesMap00Builder](#variablesmap00builder) | server([StringServerEnums](#stringserverenums) value) | - -### VariablesMap10Builder -public class VariablesMap10Builder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMap10Builder(Map instance)
Creates a builder that contains the passed instance | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap00Builder](#variablesmap00builder) | port(String value) | -| [VariablesMap00Builder](#variablesmap00builder) | port([StringPortEnums](#stringportenums) value) | - -### VariablesMapBuilder -public class VariablesMapBuilder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMapBuilder()
Creates a builder that contains an empty map | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap01Builder](#variablesmap01builder) | port(String value) | -| [VariablesMap01Builder](#variablesmap01builder) | port([StringPortEnums](#stringportenums) value) | -| [VariablesMap10Builder](#variablesmap10builder) | server(String value) | -| [VariablesMap10Builder](#variablesmap10builder) | server([StringServerEnums](#stringserverenums) value) | - -### VariablesMap -public static class VariablesMap
-extends FrozenMap - -A class to store validated Map payloads - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [VariablesMap](#variablesmap) | of([Map](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| String | port()
must be one of ["80", "8080"] if omitted the server will use the default value of 80 | -| String | server()
must be one of ["petstore", "qa-petstore", "dev-petstore"] if omitted the server will use the default value of petstore | - -### PortBoxed -public sealed interface PortBoxed
-permits
-[PortBoxedString](#portboxedstring) - -sealed interface that stores validated payloads using boxed classes - -### PortBoxedString -public record PortBoxedString
-implements [PortBoxed](#portboxed) - -record that stores validated String payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| PortBoxedString(String data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### Port -public static class Port
-extends JsonSchema - -A schema class that validates payloads - -### Description -the port - -#### 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.servers.server0.Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); - -// String validation -String validatedPayload = Variables.Port.validate( - "80", - configuration -); -``` - -#### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "80",
    "8080"
)
| -| @Nullable Object | defaultValue = "80" | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringPortEnums](#stringportenums) arg, SchemaConfiguration configuration) | -| [PortBoxedString](#portboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [PortBoxed](#portboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -### StringPortEnums -public enum StringPortEnums
-extends `Enum` - -A class that stores String enum values - -#### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| POSITIVE_80 | value = "80" | -| POSITIVE_8080 | value = "8080" | - -### ServerBoxed -public sealed interface ServerBoxed
-permits
-[ServerBoxedString](#serverboxedstring) - -sealed interface that stores validated payloads using boxed classes - -### ServerBoxedString -public record ServerBoxedString
-implements [ServerBoxed](#serverboxed) - -record that stores validated String payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| ServerBoxedString(String data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### Server -public static class Server
-extends JsonSchema - -A schema class that validates payloads - -### Description -server host prefix - -#### 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.servers.server0.Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); - -// String validation -String validatedPayload = Variables.Server.validate( - "petstore", - configuration -); -``` - -#### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "petstore",
    "qa-petstore",
    "dev-petstore"
)
| -| @Nullable Object | defaultValue = "petstore" | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringServerEnums](#stringserverenums) arg, SchemaConfiguration configuration) | -| [ServerBoxedString](#serverboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [ServerBoxed](#serverboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -### StringServerEnums -public enum StringServerEnums
-extends `Enum` - -A class that stores String enum values - -#### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| PETSTORE | value = "petstore" | -| QA_HYPHEN_MINUS_PETSTORE | value = "qa-petstore" | -| DEV_HYPHEN_MINUS_PETSTORE | value = "dev-petstore" | - -### AdditionalPropertiesBoxed -public 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 -public record AdditionalPropertiesBoxedVoid
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated null payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedVoid(Void data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Void | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedBoolean -public record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedNumber -public record AdditionalPropertiesBoxedNumber
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedString -public record AdditionalPropertiesBoxedString
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedList -public record AdditionalPropertiesBoxedList
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated List payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenList<@Nullable Object> | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedMap -public record AdditionalPropertiesBoxedMap
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated Map payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap<@Nullable Object> | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalProperties -public static class AdditionalProperties
-extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | +| [Variables.VariablesMap](../servers/server0/Variables.md#variablesmap) | variables | [[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/java/docs/servers/Server1.md b/samples/client/petstore/java/docs/servers/Server1.md index 9fb232ff697..8c170c320c6 100644 --- a/samples/client/petstore/java/docs/servers/Server1.md +++ b/samples/client/petstore/java/docs/servers/Server1.md @@ -11,368 +11,12 @@ The local server | Constructor and Description | | --------------------------- | | Server1()
Creates a server using default values for variables | -| Server1([Variables.VariablesMap](#variablesmap) variables)
Creates a server using input values for variables | +| Server1([Variables.VariablesMap](../servers/server1/Variables.md#variablesmap) variables)
Creates a server using input values for variables | ### Field Summary | Modifier and Type | Field and Description | | ----------------- | --------------------- | | String | url = "https://localhost:8080/{version}" | -| [Variables.VariablesMap](#variablesmap) | variables | - -## Variables -public class Variables
- -A class that contains necessary nested -- schema classes (which validate payloads), extends JsonSchema -- sealed interfaces which store validated payloads, java version of a sum type -- boxed classes which store validated payloads, sealed permits class implementations -- classes to store validated map payloads, extends FrozenMap -- classes to build inputs for map payloads -- enum classes - -### Nested Class Summary -| Modifier and Type | Class and Description | -| ----------------- | ---------------------- | -| sealed interface | [Variables.Variables1Boxed](#variables1boxed)
sealed interface for validated payloads | -| record | [Variables.Variables1BoxedMap](#variables1boxedmap)
boxed class to store validated Map payloads | -| static class | [Variables.Variables1](#variables1)
schema class | -| static class | [Variables.VariablesMapBuilder](#variablesmapbuilder)
builder for Map payloads | -| static class | [Variables.VariablesMap](#variablesmap)
output class for Map payloads | -| sealed interface | [Variables.VersionBoxed](#versionboxed)
sealed interface for validated payloads | -| record | [Variables.VersionBoxedString](#versionboxedstring)
boxed class to store validated String payloads | -| static class | [Variables.Version](#version)
schema class | -| enum | [Variables.StringVersionEnums](#stringversionenums)
String enum | -| sealed interface | [Variables.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | -| record | [Variables.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | -| record | [Variables.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | -| record | [Variables.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | -| record | [Variables.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | -| record | [Variables.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | -| record | [Variables.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | -| static class | [Variables.AdditionalProperties](#additionalproperties)
schema class | - -### Variables1Boxed -public sealed interface Variables1Boxed
-permits
-[Variables1BoxedMap](#variables1boxedmap) - -sealed interface that stores validated payloads using boxed classes - -### Variables1BoxedMap -public record Variables1BoxedMap
-implements [Variables1Boxed](#variables1boxed) - -record that stores validated Map payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| Variables1BoxedMap([VariablesMap](#variablesmap) data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap](#variablesmap) | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### Variables1 -public static class Variables1
-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.servers.server1.Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); - -// Map validation -Variables.VariablesMap validatedPayload = - Variables.Variables1.validate( - new Variables.VariablesMapBuilder() - .version("v1") - - .build(), - configuration -); -``` - -#### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(Map.class) | -| Map> | properties = Map.ofEntries(
    new PropertyEntry("version", [Version.class](#version)))
)
| -| Set | required = Set.of(
    "version"
)
| -| Class | additionalProperties = [AdditionalProperties.class](#additionalproperties) | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap](#variablesmap) | validate([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [Variables1BoxedMap](#variables1boxedmap) | validateAndBox([Map<?, ?>](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| [Variables1Boxed](#variables1boxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -### VariablesMap0Builder -public class VariablesMap0Builder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMap0Builder(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 | - -### VariablesMapBuilder -public class VariablesMapBuilder
-builder for `Map` - -A class that builds the Map input type - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VariablesMapBuilder()
Creates a builder that contains an empty map | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| [VariablesMap0Builder](#variablesmap0builder) | version(String value) | -| [VariablesMap0Builder](#variablesmap0builder) | version([StringVersionEnums](#stringversionenums) value) | - -### VariablesMap -public static class VariablesMap
-extends FrozenMap - -A class to store validated Map payloads - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| static [VariablesMap](#variablesmap) | of([Map](#variablesmapbuilder) arg, SchemaConfiguration configuration) | -| String | version()
must be one of ["v1", "v2"] if omitted the server will use the default value of v2 | - -### VersionBoxed -public sealed interface VersionBoxed
-permits
-[VersionBoxedString](#versionboxedstring) - -sealed interface that stores validated payloads using boxed classes - -### VersionBoxedString -public record VersionBoxedString
-implements [VersionBoxed](#versionboxed) - -record that stores validated String payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| VersionBoxedString(String data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### Version -public static class Version
-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.servers.server1.Variables; - -import java.util.Arrays; -import java.util.List; -import java.util.AbstractMap; - -static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); - -// String validation -String validatedPayload = Variables.Version.validate( - "v1", - configuration -); -``` - -#### Field Summary -| Modifier and Type | Field and Description | -| ----------------- | ---------------------- | -| Set> | type = Set.of(
    String.class
)
| -| Set | enumValues = SetMaker.makeSet(
    "v1",
    "v2"
)
| -| @Nullable Object | defaultValue = "v2" | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| String | validate(String arg, SchemaConfiguration configuration) | -| String | validate([StringVersionEnums](#stringversionenums) arg, SchemaConfiguration configuration) | -| [VersionBoxedString](#versionboxedstring) | validateAndBox(String arg, SchemaConfiguration configuration) | -| [VersionBoxed](#versionboxed) | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) | -| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) | - -### StringVersionEnums -public enum StringVersionEnums
-extends `Enum` - -A class that stores String enum values - -#### Enum Constant Summary -| Enum Constant | Description | -| ------------- | ----------- | -| V1 | value = "v1" | -| V2 | value = "v2" | - -### AdditionalPropertiesBoxed -public 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 -public record AdditionalPropertiesBoxedVoid
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated null payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedVoid(Void data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| Void | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedBoolean -public record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedNumber -public record AdditionalPropertiesBoxedNumber
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedString -public record AdditionalPropertiesBoxedString
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record 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 | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedList -public record AdditionalPropertiesBoxedList
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated List payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenList<@Nullable Object> | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalPropertiesBoxedMap -public record AdditionalPropertiesBoxedMap
-implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) - -record that stores validated Map payloads, sealed permits implementation - -#### Constructor Summary -| Constructor and Description | -| --------------------------- | -| AdditionalPropertiesBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility | - -#### Method Summary -| Modifier and Type | Method and Description | -| ----------------- | ---------------------- | -| FrozenMap<@Nullable Object> | data()
validated payload | -| @Nullable Object | getData()
validated payload | - -### AdditionalProperties -public static class AdditionalProperties
-extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 - -A schema class that validates payloads - -| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | -| ------------------------------------------------------------------ | -| validate | -| validateAndBox | +| [Variables.VariablesMap](../servers/server1/Variables.md#variablesmap) | variables | [[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java index b94c5bb4b28..b9ad3b615a8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/RootServerInfo.java @@ -1,6 +1,5 @@ package org.openapijsonschematools.client; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.servers.Server0; import org.openapijsonschematools.client.servers.Server1; import org.openapijsonschematools.client.servers.Server2; @@ -8,75 +7,40 @@ import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.AbstractMap; -import java.util.Map; import java.util.Objects; -import java.util.EnumMap; -public class RootServerInfo implements ServerProvider { - final private Servers servers; - final private ServerIndex serverIndex; +public class RootServerInfo { + public static class RootServerInfo1 implements ServerProvider { + public final Server0 server0; + public final Server1 server1; + public final Server2 server2; - public RootServerInfo() { - this.servers = new Servers(); - this.serverIndex = ServerIndex.SERVER_0; - } - - public RootServerInfo(Servers servers, ServerIndex serverIndex) { - this.servers = servers; - this.serverIndex = serverIndex; - } - - public static class Servers { - private final EnumMap servers; - - public Servers() { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - new Server0() - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - new Server1() - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_2, - new Server2() - ) - ) - ); + public RootServerInfo1() { + server0 = new Server0(); + server1 = new Server1(); + server2 = new Server2(); } - public Servers( + public RootServerInfo1( @Nullable Server0 server0, @Nullable Server1 server1, @Nullable Server2 server2 ) { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - Objects.requireNonNullElseGet(server0, Server0::new) - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - Objects.requireNonNullElseGet(server1, Server1::new) - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_2, - Objects.requireNonNullElseGet(server2, Server2::new) - ) - ) - ); + this.server0 = Objects.requireNonNullElseGet(server0, Server0::new); + this.server1 = Objects.requireNonNullElseGet(server1, Server1::new); + this.server2 = Objects.requireNonNullElseGet(server2, Server2::new); } - public Server get(ServerIndex serverIndex) { - if (servers.containsKey(serverIndex)) { - return get(serverIndex); + @Override + public Server getServer(ServerIndex serverIndex) { + switch (serverIndex) { + case SERVER_0: + return server0; + case SERVER_1: + return server1; + default: + return server2; } - throw new UnsetPropertyException(serverIndex+" is unset"); } } @@ -85,11 +49,4 @@ public enum ServerIndex { SERVER_1, SERVER_2 } - - public Server getServer(@Nullable ServerIndex serverIndex) { - if (serverIndex == null) { - return servers.get(this.serverIndex); - } - return servers.get(serverIndex); - } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java index 5d91b356758..2a240c51127 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/Int32JsonContentTypeHeader.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.components.headers.int32jsoncontenttypeheader.content.applicationjson.Int32JsonContentTypeHeaderSchema; import java.util.AbstractMap; -import java.util.Map; public class Int32JsonContentTypeHeader { @@ -25,9 +24,7 @@ public Int32JsonContentTypeHeader1() { true, null, false, - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java index 14fb0ea2ef2..7f46cc4b68c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/headers/RefContentSchemaHeader.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.components.headers.refcontentschemaheader.content.applicationjson.RefContentSchemaHeaderSchema; import java.util.AbstractMap; -import java.util.Map; public class RefContentSchemaHeader { @@ -25,9 +24,7 @@ public RefContentSchemaHeader1() { true, null, false, - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java index be499256cb1..f26059d9b43 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/parameters/ComponentRefSchemaStringWithValidation.java @@ -6,7 +6,6 @@ import org.openapijsonschematools.client.components.parameters.componentrefschemastringwithvalidation.content.applicationjson.ApplicationjsonSchema; import java.util.AbstractMap; -import java.util.Map; public class ComponentRefSchemaStringWithValidation { @@ -29,9 +28,7 @@ public ComponentRefSchemaStringWithValidation1() { null, null, false, - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java index 4c4ca5901c7..fdf11d477dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Client.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.components.requestbodies; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public Client1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java index 8a7f7c6e732..74110c3f0fc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/Pet.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.components.requestbodies; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -48,7 +49,7 @@ public Pet1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java index f94e5690f59..5b0a97f4d57 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/UserArray.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.components.requestbodies; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public UserArray1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java index 9e4ba1794ae..55abb17fdbd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/requestbodies/userarray/content/applicationjson/ApplicationjsonSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.schemas.User; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -96,12 +95,12 @@ public ApplicationjsonSchemaList getNewInstance(List arg, List pathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof User.UserMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((User.UserMap) itemInstance); i += 1; @@ -121,29 +120,29 @@ public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration confi } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java index 3c5e23a79cb..632e56e143c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/HeadersWithNoBody.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.components.responses.headerswithnobody.HeadersWithNoBodyHeadersSchema; import org.openapijsonschematools.client.components.responses.headerswithnobody.Headers; @@ -23,12 +25,12 @@ public HeadersWithNoBody1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } @Override - protected HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + protected HeadersWithNoBodyHeadersSchema.HeadersWithNoBodyHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java index c61f5c1dee0..d7d943ac519 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessDescriptionOnly.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public SuccessDescriptionOnly1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java index c1b9c74b65c..b694d846659 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessInlineContentAndHeader.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; @@ -39,20 +41,14 @@ public SuccessInlineContentAndHeader1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override - protected SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + protected SuccessInlineContentAndHeaderHeadersSchema.SuccessInlineContentAndHeaderHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java index 61a2d19f509..e48fd69140e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessWithJsonApiResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; @@ -39,20 +41,14 @@ public SuccessWithJsonApiResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override - protected SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + protected SuccessWithJsonApiResponseHeadersSchema.SuccessWithJsonApiResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java index 7ed6c0ef51e..ab4cafafef3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/SuccessfulXmlAndJsonArrayOfPet.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.components.responses.successfulxmlandjsonarrayofpet.content.applicationjson.ApplicationjsonSchema; @@ -50,19 +52,15 @@ public SuccessfulXmlAndJsonArrayOfPet1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java index d0cbaf812f0..f84e00f8370 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/headerswithnobody/HeadersWithNoBodyHeadersSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.responses.headerswithnobody.headers.location.LocationSchema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -130,7 +129,7 @@ public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +137,12 @@ public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -151,7 +150,7 @@ public HeadersWithNoBodyHeadersSchemaMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeadersWithNoBodyHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,29 +162,29 @@ public HeadersWithNoBodyHeadersSchemaMap validate(Map arg, SchemaConfigura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeadersWithNoBodyHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeadersWithNoBodyHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeadersWithNoBodyHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public HeadersWithNoBodyHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeadersWithNoBodyHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java index cf00c44021c..2d47eb20745 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationjson/ApplicationjsonSchema.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.components.schemas.RefPet; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -97,12 +96,12 @@ public ApplicationjsonSchemaList getNewInstance(List arg, List pathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Pet.PetMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Pet.PetMap) itemInstance); i += 1; @@ -122,29 +121,29 @@ public ApplicationjsonSchemaList validate(List arg, SchemaConfiguration confi } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java index 0ed36ee6a42..a04441ddc86 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successfulxmlandjsonarrayofpet/content/applicationxml/ApplicationxmlSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.schemas.Pet; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -96,12 +95,12 @@ public ApplicationxmlSchemaList getNewInstance(List arg, List pathToI itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Pet.PetMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Pet.PetMap) itemInstance); i += 1; @@ -121,29 +120,29 @@ public ApplicationxmlSchemaList validate(List arg, SchemaConfiguration config } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxmlSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxmlSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxmlSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationxmlSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxmlSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java index 227e14f64b5..2c88c985d14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/SuccessInlineContentAndHeaderHeadersSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.headers.someheader.SomeHeaderSchema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -130,7 +129,7 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map ar for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +137,12 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map ar Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -151,7 +150,7 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap getNewInstance(Map ar return new SuccessInlineContentAndHeaderHeadersSchemaMap(castProperties); } - public SuccessInlineContentAndHeaderHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessInlineContentAndHeaderHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,29 +162,29 @@ public SuccessInlineContentAndHeaderHeadersSchemaMap validate(Map arg, Sch @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SuccessInlineContentAndHeaderHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessInlineContentAndHeaderHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SuccessInlineContentAndHeaderHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public SuccessInlineContentAndHeaderHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessInlineContentAndHeaderHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java index 7d1f6c17975..a6103068681 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successinlinecontentandheader/content/applicationjson/ApplicationjsonSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -129,7 +128,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +136,12 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -150,7 +149,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,29 +161,29 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java index e5a54a4d001..1c691e76d47 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/responses/successwithjsonapiresponse/SuccessWithJsonApiResponseHeadersSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.components.schemas.StringWithValidation; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -65,7 +64,7 @@ public static SuccessWithJsonApiResponseHeadersSchemaMap of(Map arg, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -478,7 +477,7 @@ public SuccessWithJsonApiResponseHeadersSchemaMap getNewInstance(Map arg, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -488,7 +487,7 @@ public SuccessWithJsonApiResponseHeadersSchemaMap getNewInstance(Map arg, return new SuccessWithJsonApiResponseHeadersSchemaMap(castProperties); } - public SuccessWithJsonApiResponseHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessWithJsonApiResponseHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -500,29 +499,29 @@ public SuccessWithJsonApiResponseHeadersSchemaMap validate(Map arg, Schema @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SuccessWithJsonApiResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessWithJsonApiResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SuccessWithJsonApiResponseHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public SuccessWithJsonApiResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SuccessWithJsonApiResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java index 0491701ee19..4fbba3d77fb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AbstractStepMessage.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -55,19 +54,27 @@ public static AbstractStepMessageMap of(Map } public @Nullable Object description() { - return getOrThrow("description"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public String discriminator() { @Nullable Object value = get("discriminator"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for discriminator"); + throw new RuntimeException("Invalid value stored for discriminator"); } return (String) value; } public @Nullable Object sequenceNumber() { - return getOrThrow("sequenceNumber"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public @Nullable Object getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -389,7 +396,7 @@ public AbstractStepMessageMap getNewInstance(Map arg, List pathToI for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -397,7 +404,7 @@ public AbstractStepMessageMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -407,7 +414,7 @@ public AbstractStepMessageMap getNewInstance(Map arg, List pathToI return new AbstractStepMessageMap(castProperties); } - public AbstractStepMessageMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AbstractStepMessageMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -419,29 +426,29 @@ public AbstractStepMessageMap validate(Map arg, SchemaConfiguration config @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AbstractStepMessage1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AbstractStepMessage1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AbstractStepMessage1BoxedMap(validate(arg, configuration)); } @Override - public AbstractStepMessage1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AbstractStepMessage1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java index e5c4d17f293..3426c014963 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesClass.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -127,7 +126,7 @@ public MapPropertyMap getNewInstance(Map arg, List pathToItem, Pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -135,12 +134,12 @@ public MapPropertyMap getNewInstance(Map arg, List pathToItem, Pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -148,7 +147,7 @@ public MapPropertyMap getNewInstance(Map arg, List pathToItem, Pat return new MapPropertyMap(castProperties); } - public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -160,29 +159,29 @@ public MapPropertyMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapPropertyBoxedMap(validate(arg, configuration)); } @Override - public MapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -281,7 +280,7 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -289,12 +288,12 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -302,7 +301,7 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo return new AdditionalPropertiesMap(castProperties); } - public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,29 +313,29 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration confi @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -424,7 +423,7 @@ public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -432,12 +431,12 @@ public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof AdditionalPropertiesMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (AdditionalPropertiesMap) propertyInstance); } @@ -445,7 +444,7 @@ public MapOfMapPropertyMap getNewInstance(Map arg, List pathToItem return new MapOfMapPropertyMap(castProperties); } - public MapOfMapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfMapPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -457,29 +456,29 @@ public MapOfMapPropertyMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapOfMapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfMapPropertyBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapOfMapPropertyBoxedMap(validate(arg, configuration)); } @Override - public MapOfMapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfMapPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -667,7 +666,7 @@ public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -675,7 +674,7 @@ public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -685,7 +684,7 @@ public MapWithUndeclaredPropertiesAnytype3Map getNewInstance(Map arg, List return new MapWithUndeclaredPropertiesAnytype3Map(castProperties); } - public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -697,29 +696,29 @@ public MapWithUndeclaredPropertiesAnytype3Map validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapWithUndeclaredPropertiesAnytype3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesAnytype3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapWithUndeclaredPropertiesAnytype3BoxedMap(validate(arg, configuration)); } @Override - public MapWithUndeclaredPropertiesAnytype3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesAnytype3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -797,7 +796,7 @@ public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -805,7 +804,7 @@ public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -815,7 +814,7 @@ public EmptyMapMap getNewInstance(Map arg, List pathToItem, PathTo return new EmptyMapMap(castProperties); } - public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -827,29 +826,29 @@ public EmptyMapMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EmptyMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EmptyMapBoxedMap(validate(arg, configuration)); } @Override - public EmptyMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EmptyMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -948,7 +947,7 @@ public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -956,12 +955,12 @@ public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -969,7 +968,7 @@ public MapWithUndeclaredPropertiesStringMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -981,29 +980,29 @@ public MapWithUndeclaredPropertiesStringMap validate(Map arg, SchemaConfig @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapWithUndeclaredPropertiesStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapWithUndeclaredPropertiesStringBoxedMap(validate(arg, configuration)); } @Override - public MapWithUndeclaredPropertiesStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapWithUndeclaredPropertiesStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1032,7 +1031,7 @@ public MapPropertyMap map_property() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapPropertyMap)) { - throw new InvalidTypeException("Invalid value stored for map_property"); + throw new RuntimeException("Invalid value stored for map_property"); } return (MapPropertyMap) value; } @@ -1042,7 +1041,7 @@ public MapOfMapPropertyMap map_of_map_property() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapOfMapPropertyMap)) { - throw new InvalidTypeException("Invalid value stored for map_of_map_property"); + throw new RuntimeException("Invalid value stored for map_of_map_property"); } return (MapOfMapPropertyMap) value; } @@ -1056,7 +1055,7 @@ public FrozenMap map_with_undeclared_properties_anytype_1() throws UnsetPrope throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_anytype_1"); + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_1"); } return (FrozenMap) value; } @@ -1066,7 +1065,7 @@ public FrozenMap map_with_undeclared_properties_anytype_2() throws UnsetPrope throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_anytype_2"); + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_2"); } return (FrozenMap) value; } @@ -1076,7 +1075,7 @@ public MapWithUndeclaredPropertiesAnytype3Map map_with_undeclared_properties_any throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapWithUndeclaredPropertiesAnytype3Map)) { - throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_anytype_3"); + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_anytype_3"); } return (MapWithUndeclaredPropertiesAnytype3Map) value; } @@ -1086,7 +1085,7 @@ public EmptyMapMap empty_map() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof EmptyMapMap)) { - throw new InvalidTypeException("Invalid value stored for empty_map"); + throw new RuntimeException("Invalid value stored for empty_map"); } return (EmptyMapMap) value; } @@ -1096,7 +1095,7 @@ public MapWithUndeclaredPropertiesStringMap map_with_undeclared_properties_strin throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapWithUndeclaredPropertiesStringMap)) { - throw new InvalidTypeException("Invalid value stored for map_with_undeclared_properties_string"); + throw new RuntimeException("Invalid value stored for map_with_undeclared_properties_string"); } return (MapWithUndeclaredPropertiesStringMap) value; } @@ -1347,7 +1346,7 @@ public AdditionalPropertiesClassMap getNewInstance(Map arg, List p for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1355,7 +1354,7 @@ public AdditionalPropertiesClassMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1365,7 +1364,7 @@ public AdditionalPropertiesClassMap getNewInstance(Map arg, List p return new AdditionalPropertiesClassMap(castProperties); } - public AdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1377,29 +1376,29 @@ public AdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalPropertiesClass1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java index 6cc2511dad8..cd38c0e0ee1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -188,7 +187,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -196,7 +195,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -206,7 +205,7 @@ public Schema0Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema0Map(castProperties); } - public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,29 +217,29 @@ public Schema0Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedMap(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -309,7 +308,7 @@ public static AdditionalProperties1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -321,7 +320,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -333,7 +332,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -344,24 +343,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -393,7 +392,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -420,7 +419,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -428,7 +427,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -438,7 +437,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -450,7 +449,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -465,10 +464,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -483,34 +482,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedBoolean(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedNumber(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedString(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedList(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -526,7 +525,7 @@ public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -669,7 +668,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -677,7 +676,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -687,7 +686,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -699,29 +698,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -790,7 +789,7 @@ public static AdditionalProperties2 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -802,7 +801,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -814,7 +813,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -825,24 +824,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -874,7 +873,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -901,7 +900,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -909,7 +908,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -919,7 +918,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -931,7 +930,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -946,10 +945,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -964,34 +963,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedBoolean(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedNumber(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedString(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedList(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1007,7 +1006,7 @@ public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1150,7 +1149,7 @@ public Schema2Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1158,7 +1157,7 @@ public Schema2Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1168,7 +1167,7 @@ public Schema2Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema2Map(castProperties); } - public Schema2Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1180,29 +1179,29 @@ public Schema2Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema2BoxedMap(validate(arg, configuration)); } @Override - public Schema2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1251,7 +1250,7 @@ public static AdditionalPropertiesSchema1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1259,7 +1258,7 @@ public static AdditionalPropertiesSchema1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1269,7 +1268,7 @@ public static AdditionalPropertiesSchema1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1281,29 +1280,29 @@ public static AdditionalPropertiesSchema1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalPropertiesSchema1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java index bcbef03c5d4..2ed4a1f0360 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalPropertiesWithArrayOfEnums.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -105,12 +104,12 @@ public AdditionalPropertiesList getNewInstance(List arg, List pathToI itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -130,29 +129,29 @@ public AdditionalPropertiesList validate(List arg, SchemaConfiguration config } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalPropertiesBoxedList(validate(arg, configuration)); } @Override - public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -169,7 +168,7 @@ public static AdditionalPropertiesWithArrayOfEnumsMap of(Map arg, Lis for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -257,12 +256,12 @@ public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(Map arg, Lis Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof AdditionalPropertiesList)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (AdditionalPropertiesList) propertyInstance); } @@ -270,7 +269,7 @@ public AdditionalPropertiesWithArrayOfEnumsMap getNewInstance(Map arg, Lis return new AdditionalPropertiesWithArrayOfEnumsMap(castProperties); } - public AdditionalPropertiesWithArrayOfEnumsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesWithArrayOfEnumsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -282,29 +281,29 @@ public AdditionalPropertiesWithArrayOfEnumsMap validate(Map arg, SchemaCon @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesWithArrayOfEnums1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesWithArrayOfEnums1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalPropertiesWithArrayOfEnums1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesWithArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesWithArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java index b0ed926c90e..4a116392673 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Address.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -149,7 +148,7 @@ public AddressMap getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -157,12 +156,12 @@ public AddressMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -170,7 +169,7 @@ public AddressMap getNewInstance(Map arg, List pathToItem, PathToS return new AddressMap(castProperties); } - public AddressMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AddressMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -182,29 +181,29 @@ public AddressMap validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Address1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Address1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Address1BoxedMap(validate(arg, configuration)); } @Override - public Address1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Address1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java index bb25f8c14eb..f65e1246b7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Animal.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -86,35 +85,35 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public ColorBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ColorBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ColorBoxedString(validate(arg, configuration)); } @Override - public ColorBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ColorBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -135,7 +134,7 @@ public static AnimalMap of(Map arg, SchemaCo public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for className"); + throw new RuntimeException("Invalid value stored for className"); } return (String) value; } @@ -145,7 +144,7 @@ public String color() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for color"); + throw new RuntimeException("Invalid value stored for color"); } return (String) value; } @@ -265,7 +264,7 @@ public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -273,7 +272,7 @@ public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -283,7 +282,7 @@ public AnimalMap getNewInstance(Map arg, List pathToItem, PathToSc return new AnimalMap(castProperties); } - public AnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -295,29 +294,29 @@ public AnimalMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Animal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Animal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Animal1BoxedMap(validate(arg, configuration)); } @Override - public Animal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Animal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java index e6ee613c3e1..56c1faea7aa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnimalFarm.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -101,12 +100,12 @@ public AnimalFarmList getNewInstance(List arg, List pathToItem, PathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Animal.AnimalMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Animal.AnimalMap) itemInstance); i += 1; @@ -126,29 +125,29 @@ public AnimalFarmList validate(List arg, SchemaConfiguration configuration) t } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnimalFarm1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnimalFarm1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnimalFarm1BoxedList(validate(arg, configuration)); } @Override - public AnimalFarm1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnimalFarm1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java index 8b3f5b7cd09..b93b1cd30eb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeAndFormat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -101,7 +100,7 @@ public static UuidSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -113,7 +112,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -125,7 +124,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -136,24 +135,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,7 +184,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -212,7 +211,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -220,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -230,7 +229,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -257,10 +256,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -275,34 +274,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UuidSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedVoid(validate(arg, configuration)); } @Override - public UuidSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public UuidSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedNumber(validate(arg, configuration)); } @Override - public UuidSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedString(validate(arg, configuration)); } @Override - public UuidSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedList(validate(arg, configuration)); } @Override - public UuidSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UuidSchemaBoxedMap(validate(arg, configuration)); } @Override - public UuidSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -318,7 +317,7 @@ public UuidSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -386,7 +385,7 @@ public static Date getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -398,7 +397,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -410,7 +409,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -421,24 +420,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -470,7 +469,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -497,7 +496,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -505,7 +504,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -515,7 +514,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -527,7 +526,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -542,10 +541,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -560,34 +559,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedVoid(validate(arg, configuration)); } @Override - public DateBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedBoolean(validate(arg, configuration)); } @Override - public DateBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedNumber(validate(arg, configuration)); } @Override - public DateBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedString(validate(arg, configuration)); } @Override - public DateBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedList(validate(arg, configuration)); } @Override - public DateBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DateBoxedMap(validate(arg, configuration)); } @Override - public DateBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -603,7 +602,7 @@ public DateBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -671,7 +670,7 @@ public static Datetime getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -683,7 +682,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -695,7 +694,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -706,24 +705,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -755,7 +754,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -782,7 +781,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -790,7 +789,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -800,7 +799,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -812,7 +811,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -827,10 +826,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -845,34 +844,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DatetimeBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedVoid(validate(arg, configuration)); } @Override - public DatetimeBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedBoolean(validate(arg, configuration)); } @Override - public DatetimeBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedNumber(validate(arg, configuration)); } @Override - public DatetimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedString(validate(arg, configuration)); } @Override - public DatetimeBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedList(validate(arg, configuration)); } @Override - public DatetimeBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimeBoxedMap(validate(arg, configuration)); } @Override - public DatetimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -888,7 +887,7 @@ public DatetimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -956,7 +955,7 @@ public static NumberSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -968,7 +967,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -980,7 +979,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -991,24 +990,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1040,7 +1039,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1067,7 +1066,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1075,7 +1074,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1085,7 +1084,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1097,7 +1096,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1112,10 +1111,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1130,34 +1129,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedVoid(validate(arg, configuration)); } @Override - public NumberSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedNumber(validate(arg, configuration)); } @Override - public NumberSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedString(validate(arg, configuration)); } @Override - public NumberSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedList(validate(arg, configuration)); } @Override - public NumberSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedMap(validate(arg, configuration)); } @Override - public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1173,7 +1172,7 @@ public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1241,7 +1240,7 @@ public static Binary getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1253,7 +1252,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1265,7 +1264,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1276,24 +1275,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1325,7 +1324,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1352,7 +1351,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1360,7 +1359,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1370,7 +1369,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1382,7 +1381,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1397,10 +1396,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1415,34 +1414,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BinaryBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedVoid(validate(arg, configuration)); } @Override - public BinaryBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedBoolean(validate(arg, configuration)); } @Override - public BinaryBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedNumber(validate(arg, configuration)); } @Override - public BinaryBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedString(validate(arg, configuration)); } @Override - public BinaryBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedList(validate(arg, configuration)); } @Override - public BinaryBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new BinaryBoxedMap(validate(arg, configuration)); } @Override - public BinaryBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BinaryBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1458,7 +1457,7 @@ public BinaryBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1526,7 +1525,7 @@ public static Int32 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1538,7 +1537,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1550,7 +1549,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1561,24 +1560,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1610,7 +1609,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1637,7 +1636,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1645,7 +1644,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1655,7 +1654,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1667,7 +1666,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1682,10 +1681,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1700,34 +1699,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Int32BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedVoid(validate(arg, configuration)); } @Override - public Int32BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedBoolean(validate(arg, configuration)); } @Override - public Int32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedNumber(validate(arg, configuration)); } @Override - public Int32BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedString(validate(arg, configuration)); } @Override - public Int32BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedList(validate(arg, configuration)); } @Override - public Int32BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Int32BoxedMap(validate(arg, configuration)); } @Override - public Int32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -1743,7 +1742,7 @@ public Int32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1811,7 +1810,7 @@ public static Int64 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1823,7 +1822,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1835,7 +1834,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1846,24 +1845,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1895,7 +1894,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -1922,7 +1921,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1930,7 +1929,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1940,7 +1939,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1952,7 +1951,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -1967,10 +1966,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -1985,34 +1984,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Int64BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedVoid(validate(arg, configuration)); } @Override - public Int64BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedBoolean(validate(arg, configuration)); } @Override - public Int64BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedNumber(validate(arg, configuration)); } @Override - public Int64BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedString(validate(arg, configuration)); } @Override - public Int64BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedList(validate(arg, configuration)); } @Override - public Int64BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Int64BoxedMap(validate(arg, configuration)); } @Override - public Int64Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -2028,7 +2027,7 @@ public Int64Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2096,7 +2095,7 @@ public static DoubleSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2108,7 +2107,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2120,7 +2119,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2131,24 +2130,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2180,7 +2179,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -2207,7 +2206,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2215,7 +2214,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -2225,7 +2224,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2237,7 +2236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -2252,10 +2251,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -2270,34 +2269,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DoubleSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedVoid(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedNumber(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedString(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedList(validate(arg, configuration)); } @Override - public DoubleSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedMap(validate(arg, configuration)); } @Override - public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -2313,7 +2312,7 @@ public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2381,7 +2380,7 @@ public static FloatSchema getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2393,7 +2392,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2405,7 +2404,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2416,24 +2415,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2465,7 +2464,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -2492,7 +2491,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2500,7 +2499,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -2510,7 +2509,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2522,7 +2521,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -2537,10 +2536,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -2555,34 +2554,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FloatSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedVoid(validate(arg, configuration)); } @Override - public FloatSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedBoolean(validate(arg, configuration)); } @Override - public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedNumber(validate(arg, configuration)); } @Override - public FloatSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedString(validate(arg, configuration)); } @Override - public FloatSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedList(validate(arg, configuration)); } @Override - public FloatSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedMap(validate(arg, configuration)); } @Override - public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -2598,7 +2597,7 @@ public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -3284,7 +3283,7 @@ public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -3292,7 +3291,7 @@ public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -3302,7 +3301,7 @@ public AnyTypeAndFormatMap getNewInstance(Map arg, List pathToItem return new AnyTypeAndFormatMap(castProperties); } - public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -3314,29 +3313,29 @@ public AnyTypeAndFormatMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyTypeAndFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeAndFormat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeAndFormat1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeAndFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeAndFormat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java index 13dfb48e9a9..e9ebdac6dd9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AnyTypeNotString.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -117,7 +116,7 @@ public static AnyTypeNotString1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -129,7 +128,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -141,7 +140,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -152,24 +151,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -246,7 +245,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,7 +257,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -273,10 +272,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -291,34 +290,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyTypeNotString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedString(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedList(validate(arg, configuration)); } @Override - public AnyTypeNotString1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeNotString1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeNotString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeNotString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -334,7 +333,7 @@ public AnyTypeNotString1Boxed validateAndBox(@Nullable Object arg, SchemaConfigu } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java index 19681cbe576..bf0915b5b2d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ApiResponseSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -82,7 +81,7 @@ public Number code() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for code"); + throw new RuntimeException("Invalid value stored for code"); } return (Number) value; } @@ -92,7 +91,7 @@ public String type() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for type"); + throw new RuntimeException("Invalid value stored for type"); } return (String) value; } @@ -102,7 +101,7 @@ public String message() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for message"); + throw new RuntimeException("Invalid value stored for message"); } return (String) value; } @@ -231,7 +230,7 @@ public ApiResponseMap getNewInstance(Map arg, List pathToItem, Pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -239,7 +238,7 @@ public ApiResponseMap getNewInstance(Map arg, List pathToItem, Pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -249,7 +248,7 @@ public ApiResponseMap getNewInstance(Map arg, List pathToItem, Pat return new ApiResponseMap(castProperties); } - public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -261,29 +260,29 @@ public ApiResponseMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApiResponseSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApiResponseSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApiResponseSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApiResponseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApiResponseSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java index 1ff84d0d77f..9903c1e079c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Apple.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -77,29 +76,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public CultivarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CultivarBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new CultivarBoxedString(validate(arg, configuration)); } @Override - public CultivarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CultivarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -150,29 +149,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OriginBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OriginBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OriginBoxedString(validate(arg, configuration)); } @Override - public OriginBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OriginBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -193,7 +192,7 @@ public static AppleMap of(Map arg, SchemaCon public String cultivar() { @Nullable Object value = get("cultivar"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for cultivar"); + throw new RuntimeException("Invalid value stored for cultivar"); } return (String) value; } @@ -203,7 +202,7 @@ public String origin() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for origin"); + throw new RuntimeException("Invalid value stored for origin"); } return (String) value; } @@ -344,7 +343,7 @@ public AppleMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -352,7 +351,7 @@ public AppleMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -362,7 +361,7 @@ public AppleMap getNewInstance(Map arg, List pathToItem, PathToSch return new AppleMap(castProperties); } - public AppleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AppleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -374,40 +373,40 @@ public AppleMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Apple1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Apple1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Apple1BoxedVoid(validate(arg, configuration)); } @Override - public Apple1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Apple1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Apple1BoxedMap(validate(arg, configuration)); } @Override - public Apple1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Apple1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java index e5e5ec8123c..51f1827adc1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/AppleReq.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -82,7 +81,7 @@ public static AppleReqMap of(Map arg, SchemaConfiguration config public String cultivar() { Object value = get("cultivar"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for cultivar"); + throw new RuntimeException("Invalid value stored for cultivar"); } return (String) value; } @@ -92,7 +91,7 @@ public boolean mealy() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for mealy"); + throw new RuntimeException("Invalid value stored for mealy"); } return (boolean) value; } @@ -204,7 +203,7 @@ public AppleReqMap getNewInstance(Map arg, List pathToItem, PathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -212,12 +211,12 @@ public AppleReqMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } @@ -225,7 +224,7 @@ public AppleReqMap getNewInstance(Map arg, List pathToItem, PathTo return new AppleReqMap(castProperties); } - public AppleReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AppleReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -237,29 +236,29 @@ public AppleReqMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AppleReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AppleReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AppleReq1BoxedMap(validate(arg, configuration)); } @Override - public AppleReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AppleReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java index 6b80d6a622a..f103ccb7b11 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayHoldingAnyType.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -152,7 +151,7 @@ public ArrayHoldingAnyTypeList getNewInstance(List arg, List pathToIt itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -174,29 +173,29 @@ public ArrayHoldingAnyTypeList validate(List arg, SchemaConfiguration configu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayHoldingAnyType1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayHoldingAnyType1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayHoldingAnyType1BoxedList(validate(arg, configuration)); } @Override - public ArrayHoldingAnyType1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayHoldingAnyType1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java index b7f9fd7e937..65ee5a9b86d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfArrayOfNumberOnly.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -128,12 +127,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -153,29 +152,29 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedList(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -250,12 +249,12 @@ public ArrayArrayNumberList getNewInstance(List arg, List pathToItem, itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList) itemInstance); i += 1; @@ -275,29 +274,29 @@ public ArrayArrayNumberList validate(List arg, SchemaConfiguration configurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayArrayNumberBoxedList(validate(arg, configuration)); } @Override - public ArrayArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -318,7 +317,7 @@ public ArrayArrayNumberList ArrayArrayNumber() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayArrayNumberList)) { - throw new InvalidTypeException("Invalid value stored for ArrayArrayNumber"); + throw new RuntimeException("Invalid value stored for ArrayArrayNumber"); } return (ArrayArrayNumberList) value; } @@ -409,7 +408,7 @@ public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pa for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -417,7 +416,7 @@ public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -427,7 +426,7 @@ public ArrayOfArrayOfNumberOnlyMap getNewInstance(Map arg, List pa return new ArrayOfArrayOfNumberOnlyMap(castProperties); } - public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -439,29 +438,29 @@ public ArrayOfArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayOfArrayOfNumberOnly1BoxedMap(validate(arg, configuration)); } @Override - public ArrayOfArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java index 8364d46380d..d800ee9917b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfEnums.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -114,12 +113,12 @@ public ArrayOfEnumsList getNewInstance(List arg, List pathToItem, Pat itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((@Nullable String) itemInstance); i += 1; @@ -139,29 +138,29 @@ public ArrayOfEnumsList validate(List arg, SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfEnums1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfEnums1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayOfEnums1BoxedList(validate(arg, configuration)); } @Override - public ArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfEnums1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java index 03b7659a3c1..60dbea4de6e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayOfNumberOnly.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -128,12 +127,12 @@ public ArrayNumberList getNewInstance(List arg, List pathToItem, Path itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -153,29 +152,29 @@ public ArrayNumberList validate(List arg, SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayNumberBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayNumberBoxedList(validate(arg, configuration)); } @Override - public ArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -196,7 +195,7 @@ public ArrayNumberList ArrayNumber() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayNumberList)) { - throw new InvalidTypeException("Invalid value stored for ArrayNumber"); + throw new RuntimeException("Invalid value stored for ArrayNumber"); } return (ArrayNumberList) value; } @@ -287,7 +286,7 @@ public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -295,7 +294,7 @@ public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -305,7 +304,7 @@ public ArrayOfNumberOnlyMap getNewInstance(Map arg, List pathToIte return new ArrayOfNumberOnlyMap(castProperties); } - public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -317,29 +316,29 @@ public ArrayOfNumberOnlyMap validate(Map arg, SchemaConfiguration configur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfNumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayOfNumberOnly1BoxedMap(validate(arg, configuration)); } @Override - public ArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfNumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java index a6de7bc8168..bad14500fe5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayTest.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -114,12 +113,12 @@ public ArrayOfStringList getNewInstance(List arg, List pathToItem, Pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -139,29 +138,29 @@ public ArrayOfStringList validate(List arg, SchemaConfiguration configuration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayOfStringBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfStringBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayOfStringBoxedList(validate(arg, configuration)); } @Override - public ArrayOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -262,12 +261,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -287,29 +286,29 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Items1BoxedList(validate(arg, configuration)); } @Override - public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -384,12 +383,12 @@ public ArrayArrayOfIntegerList getNewInstance(List arg, List pathToIt itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList) itemInstance); i += 1; @@ -409,29 +408,29 @@ public ArrayArrayOfIntegerList validate(List arg, SchemaConfiguration configu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayArrayOfIntegerBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayOfIntegerBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayArrayOfIntegerBoxedList(validate(arg, configuration)); } @Override - public ArrayArrayOfIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayOfIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -506,12 +505,12 @@ public ItemsList1 getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ReadOnlyFirst.ReadOnlyFirstMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ReadOnlyFirst.ReadOnlyFirstMap) itemInstance); i += 1; @@ -531,29 +530,29 @@ public ItemsList1 validate(List arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items3BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items3BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Items3BoxedList(validate(arg, configuration)); } @Override - public Items3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -628,12 +627,12 @@ public ArrayArrayOfModelList getNewInstance(List arg, List pathToItem itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof ItemsList1)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((ItemsList1) itemInstance); i += 1; @@ -653,29 +652,29 @@ public ArrayArrayOfModelList validate(List arg, SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayArrayOfModelBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayOfModelBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayArrayOfModelBoxedList(validate(arg, configuration)); } @Override - public ArrayArrayOfModelBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayArrayOfModelBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -698,7 +697,7 @@ public ArrayOfStringList array_of_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayOfStringList)) { - throw new InvalidTypeException("Invalid value stored for array_of_string"); + throw new RuntimeException("Invalid value stored for array_of_string"); } return (ArrayOfStringList) value; } @@ -708,7 +707,7 @@ public ArrayArrayOfIntegerList array_array_of_integer() throws UnsetPropertyExce throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayArrayOfIntegerList)) { - throw new InvalidTypeException("Invalid value stored for array_array_of_integer"); + throw new RuntimeException("Invalid value stored for array_array_of_integer"); } return (ArrayArrayOfIntegerList) value; } @@ -718,7 +717,7 @@ public ArrayArrayOfModelList array_array_of_model() throws UnsetPropertyExceptio throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayArrayOfModelList)) { - throw new InvalidTypeException("Invalid value stored for array_array_of_model"); + throw new RuntimeException("Invalid value stored for array_array_of_model"); } return (ArrayArrayOfModelList) value; } @@ -841,7 +840,7 @@ public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -849,7 +848,7 @@ public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -859,7 +858,7 @@ public ArrayTestMap getNewInstance(Map arg, List pathToItem, PathT return new ArrayTestMap(castProperties); } - public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -871,29 +870,29 @@ public ArrayTestMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayTest1BoxedMap(validate(arg, configuration)); } @Override - public ArrayTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java index 99a7c45a8d2..c397a603a61 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ArrayWithValidationsInItems.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -87,29 +86,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedNumber(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -206,12 +205,12 @@ public ArrayWithValidationsInItemsList getNewInstance(List arg, List itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -231,29 +230,29 @@ public ArrayWithValidationsInItemsList validate(List arg, SchemaConfiguration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayWithValidationsInItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithValidationsInItems1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithValidationsInItems1BoxedList(validate(arg, configuration)); } @Override - public ArrayWithValidationsInItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithValidationsInItems1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java index ffa0682bd6c..f314e9f312f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Banana.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -55,7 +54,7 @@ public static BananaMap of(Map arg, SchemaCo public Number lengthCm() { @Nullable Object value = get("lengthCm"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for lengthCm"); + throw new RuntimeException("Invalid value stored for lengthCm"); } return (Number) value; } @@ -177,7 +176,7 @@ public BananaMap getNewInstance(Map arg, List pathToItem, PathToSc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -185,7 +184,7 @@ public BananaMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -195,7 +194,7 @@ public BananaMap getNewInstance(Map arg, List pathToItem, PathToSc return new BananaMap(castProperties); } - public BananaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BananaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,29 +206,29 @@ public BananaMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Banana1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Banana1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Banana1BoxedMap(validate(arg, configuration)); } @Override - public Banana1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Banana1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java index 9ca17cb18fc..2e7fc44ef1e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BananaReq.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -82,7 +81,7 @@ public static BananaReqMap of(Map arg, SchemaConfiguration confi public Number lengthCm() { Object value = get("lengthCm"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for lengthCm"); + throw new RuntimeException("Invalid value stored for lengthCm"); } return (Number) value; } @@ -92,7 +91,7 @@ public boolean sweet() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for sweet"); + throw new RuntimeException("Invalid value stored for sweet"); } return (boolean) value; } @@ -222,7 +221,7 @@ public BananaReqMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,12 +229,12 @@ public BananaReqMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } @@ -243,7 +242,7 @@ public BananaReqMap getNewInstance(Map arg, List pathToItem, PathT return new BananaReqMap(castProperties); } - public BananaReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BananaReqMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -255,29 +254,29 @@ public BananaReqMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BananaReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BananaReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new BananaReq1BoxedMap(validate(arg, configuration)); } @Override - public BananaReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BananaReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java index a46435968b3..e62a21a1d0e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Bar.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -70,35 +69,35 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Bar1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Bar1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Bar1BoxedString(validate(arg, configuration)); } @Override - public Bar1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Bar1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java index 826127d11ee..726452e88a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BasquePig.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -95,29 +94,29 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -136,7 +135,7 @@ public static BasquePigMap of(Map arg, Schem public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for className"); + throw new RuntimeException("Invalid value stored for className"); } return (String) value; } @@ -246,7 +245,7 @@ public BasquePigMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -254,7 +253,7 @@ public BasquePigMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +263,7 @@ public BasquePigMap getNewInstance(Map arg, List pathToItem, PathT return new BasquePigMap(castProperties); } - public BasquePigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BasquePigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -276,29 +275,29 @@ public BasquePigMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BasquePig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BasquePig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new BasquePig1BoxedMap(validate(arg, configuration)); } @Override - public BasquePig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BasquePig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java index 0681c9d4961..f9ac16b3542 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/BooleanEnum.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator; @@ -89,32 +88,32 @@ public boolean validate(BooleanBooleanEnumEnums arg,SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BooleanEnum1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanEnum1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BooleanEnum1BoxedBoolean(validate(arg, configuration)); } @Override - public BooleanEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java index d5fb609e4e8..b36f13cc0c1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Capitalization.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -117,7 +116,7 @@ public String smallCamel() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for smallCamel"); + throw new RuntimeException("Invalid value stored for smallCamel"); } return (String) value; } @@ -127,7 +126,7 @@ public String CapitalCamel() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for CapitalCamel"); + throw new RuntimeException("Invalid value stored for CapitalCamel"); } return (String) value; } @@ -137,7 +136,7 @@ public String small_Snake() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for small_Snake"); + throw new RuntimeException("Invalid value stored for small_Snake"); } return (String) value; } @@ -147,7 +146,7 @@ public String Capital_Snake() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for Capital_Snake"); + throw new RuntimeException("Invalid value stored for Capital_Snake"); } return (String) value; } @@ -157,7 +156,7 @@ public String SCA_ETH_Flow_Points() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for SCA_ETH_Flow_Points"); + throw new RuntimeException("Invalid value stored for SCA_ETH_Flow_Points"); } return (String) value; } @@ -167,7 +166,7 @@ public String ATT_NAME() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for ATT_NAME"); + throw new RuntimeException("Invalid value stored for ATT_NAME"); } return (String) value; } @@ -338,7 +337,7 @@ public CapitalizationMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -346,7 +345,7 @@ public CapitalizationMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -356,7 +355,7 @@ public CapitalizationMap getNewInstance(Map arg, List pathToItem, return new CapitalizationMap(castProperties); } - public CapitalizationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CapitalizationMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -368,29 +367,29 @@ public CapitalizationMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Capitalization1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Capitalization1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Capitalization1BoxedMap(validate(arg, configuration)); } @Override - public Capitalization1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Capitalization1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java index b05aec208e2..1fd40713a14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Cat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -66,7 +65,7 @@ public boolean declawed() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for declawed"); + throw new RuntimeException("Invalid value stored for declawed"); } return (boolean) value; } @@ -151,7 +150,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -159,7 +158,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -169,7 +168,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -181,29 +180,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -281,7 +280,7 @@ public static Cat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -293,7 +292,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -305,7 +304,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -316,24 +315,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -365,7 +364,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -392,7 +391,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -400,7 +399,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -410,7 +409,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -422,7 +421,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -437,10 +436,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -455,34 +454,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Cat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedVoid(validate(arg, configuration)); } @Override - public Cat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedBoolean(validate(arg, configuration)); } @Override - public Cat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedNumber(validate(arg, configuration)); } @Override - public Cat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedString(validate(arg, configuration)); } @Override - public Cat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedList(validate(arg, configuration)); } @Override - public Cat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Cat1BoxedMap(validate(arg, configuration)); } @Override - public Cat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Cat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -498,7 +497,7 @@ public Cat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java index b19f935049b..cd5364ea788 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Category.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -86,35 +85,35 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public NameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NameBoxedString(validate(arg, configuration)); } @Override - public NameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -135,7 +134,7 @@ public static CategoryMap of(Map arg, Schema public String name() { @Nullable Object value = get("name"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (String) value; } @@ -145,7 +144,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for id"); + throw new RuntimeException("Invalid value stored for id"); } return (Number) value; } @@ -283,7 +282,7 @@ public CategoryMap getNewInstance(Map arg, List pathToItem, PathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -291,7 +290,7 @@ public CategoryMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -301,7 +300,7 @@ public CategoryMap getNewInstance(Map arg, List pathToItem, PathTo return new CategoryMap(castProperties); } - public CategoryMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CategoryMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -313,29 +312,29 @@ public CategoryMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Category1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Category1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Category1BoxedMap(validate(arg, configuration)); } @Override - public Category1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Category1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java index fdb76bf0d38..2b56cafb84b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ChildCat.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +65,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (String) value; } @@ -151,7 +150,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -159,7 +158,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -169,7 +168,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -181,29 +180,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -281,7 +280,7 @@ public static ChildCat1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -293,7 +292,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -305,7 +304,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -316,24 +315,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -365,7 +364,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -392,7 +391,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -400,7 +399,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -410,7 +409,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -422,7 +421,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -437,10 +436,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -455,34 +454,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ChildCat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedVoid(validate(arg, configuration)); } @Override - public ChildCat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedBoolean(validate(arg, configuration)); } @Override - public ChildCat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedNumber(validate(arg, configuration)); } @Override - public ChildCat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedString(validate(arg, configuration)); } @Override - public ChildCat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedList(validate(arg, configuration)); } @Override - public ChildCat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ChildCat1BoxedMap(validate(arg, configuration)); } @Override - public ChildCat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ChildCat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -498,7 +497,7 @@ public ChildCat1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java index 8949335b280..21aab6cfc14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ClassModel.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -179,7 +178,7 @@ public static ClassModel1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,7 +190,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +202,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -214,24 +213,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -263,7 +262,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -290,7 +289,7 @@ public ClassModelMap getNewInstance(Map arg, List pathToItem, Path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -298,7 +297,7 @@ public ClassModelMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -308,7 +307,7 @@ public ClassModelMap getNewInstance(Map arg, List pathToItem, Path return new ClassModelMap(castProperties); } - public ClassModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -320,7 +319,7 @@ public ClassModelMap validate(Map arg, SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -335,10 +334,10 @@ public ClassModelMap validate(Map arg, SchemaConfiguration configuration) } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -353,34 +352,34 @@ public ClassModelMap validate(Map arg, SchemaConfiguration configuration) } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassModel1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedVoid(validate(arg, configuration)); } @Override - public ClassModel1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedBoolean(validate(arg, configuration)); } @Override - public ClassModel1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedNumber(validate(arg, configuration)); } @Override - public ClassModel1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedString(validate(arg, configuration)); } @Override - public ClassModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedList(validate(arg, configuration)); } @Override - public ClassModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ClassModel1BoxedMap(validate(arg, configuration)); } @Override - public ClassModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -396,7 +395,7 @@ public ClassModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java index 9cd4880d680..3585bd08508 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Client.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ public String client() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for client"); + throw new RuntimeException("Invalid value stored for client"); } return (String) value; } @@ -148,7 +147,7 @@ public ClientMap getNewInstance(Map arg, List pathToItem, PathToSc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -156,7 +155,7 @@ public ClientMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -166,7 +165,7 @@ public ClientMap getNewInstance(Map arg, List pathToItem, PathToSc return new ClientMap(castProperties); } - public ClientMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClientMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -178,29 +177,29 @@ public ClientMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Client1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Client1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Client1BoxedMap(validate(arg, configuration)); } @Override - public Client1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Client1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java index 0f5fe34f199..0f19e634466 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComplexQuadrilateral.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -103,29 +102,29 @@ public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration conf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralTypeBoxedString(validate(arg, configuration)); } @Override - public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -146,7 +145,7 @@ public String quadrilateralType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for quadrilateralType"); + throw new RuntimeException("Invalid value stored for quadrilateralType"); } return (String) value; } @@ -237,7 +236,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -245,7 +244,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -255,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,29 +266,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -367,7 +366,7 @@ public static ComplexQuadrilateral1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -391,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -451,7 +450,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -478,7 +477,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -486,7 +485,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -508,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -523,10 +522,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -541,34 +540,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComplexQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedVoid(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedBoolean(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedNumber(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedString(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedList(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ComplexQuadrilateral1BoxedMap(validate(arg, configuration)); } @Override - public ComplexQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComplexQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -584,7 +583,7 @@ public ComplexQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java index 688e2a66912..d8a18a9d2f4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedAnyOfDifferentTypesNoValidations.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -270,7 +269,7 @@ public Schema9List getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -292,29 +291,29 @@ public Schema9List validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema9BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema9BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema9BoxedList(validate(arg, configuration)); } @Override - public Schema9Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema9Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -471,7 +470,7 @@ public static ComposedAnyOfDifferentTypesNoValidations1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -483,7 +482,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -495,7 +494,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -506,24 +505,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -555,7 +554,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -582,7 +581,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -590,7 +589,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -600,7 +599,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -612,7 +611,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -627,10 +626,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -645,34 +644,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedVoid(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedBoolean(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedNumber(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedString(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedList(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedAnyOfDifferentTypesNoValidations1BoxedMap(validate(arg, configuration)); } @Override - public ComposedAnyOfDifferentTypesNoValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedAnyOfDifferentTypesNoValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -688,7 +687,7 @@ public ComposedAnyOfDifferentTypesNoValidations1Boxed validateAndBox(@Nullable O } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java index 924341f499f..71fd76caa3d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedArray.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -152,7 +151,7 @@ public ComposedArrayList getNewInstance(List arg, List pathToItem, Pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -174,29 +173,29 @@ public ComposedArrayList validate(List arg, SchemaConfiguration configuration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedArray1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedArray1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedArray1BoxedList(validate(arg, configuration)); } @Override - public ComposedArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java index ec600363510..7f34004555f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedBool.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator; @@ -81,32 +80,32 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedBool1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedBool1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedBool1BoxedBoolean(validate(arg, configuration)); } @Override - public ComposedBool1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedBool1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java index bee61f4d10f..78930744e81 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNone.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -81,30 +80,30 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedNone1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedNone1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedNone1BoxedVoid(validate(arg, configuration)); } @Override - public ComposedNone1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedNone1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java index 37c4b6c7c2c..ef87afd4d8d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedNumber.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -102,29 +101,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedNumber1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedNumber1BoxedNumber(validate(arg, configuration)); } @Override - public ComposedNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedNumber1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java index 89afb88c828..9bfd1ae80f8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedObject.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -80,7 +79,7 @@ public static ComposedObject1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -88,7 +87,7 @@ public static ComposedObject1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -98,7 +97,7 @@ public static ComposedObject1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -110,29 +109,29 @@ public static ComposedObject1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedObject1BoxedMap(validate(arg, configuration)); } @Override - public ComposedObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java index 100e117efda..44bb609f46b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedOneOfDifferentTypes.java @@ -15,7 +15,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -96,7 +95,7 @@ public static Schema4 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -104,7 +103,7 @@ public static Schema4 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -114,7 +113,7 @@ public static Schema4 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -126,29 +125,29 @@ public static Schema4 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema4BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema4BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema4BoxedMap(validate(arg, configuration)); } @Override - public Schema4Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema4Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -277,7 +276,7 @@ public Schema5List getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -299,29 +298,29 @@ public Schema5List validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema5BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema5BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema5BoxedList(validate(arg, configuration)); } @Override - public Schema5Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema5Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -372,29 +371,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema6BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema6BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema6BoxedString(validate(arg, configuration)); } @Override - public Schema6Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema6Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -478,7 +477,7 @@ public static ComposedOneOfDifferentTypes1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -490,7 +489,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -502,7 +501,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -513,24 +512,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -562,7 +561,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -589,7 +588,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -597,7 +596,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -607,7 +606,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -619,7 +618,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -634,10 +633,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -652,34 +651,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedOneOfDifferentTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedVoid(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedBoolean(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedNumber(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedString(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedList(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedOneOfDifferentTypes1BoxedMap(validate(arg, configuration)); } @Override - public ComposedOneOfDifferentTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedOneOfDifferentTypes1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -695,7 +694,7 @@ public ComposedOneOfDifferentTypes1Boxed validateAndBox(@Nullable Object arg, Sc } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java index d4dc9ec084f..6128d4db5d2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ComposedString.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -83,29 +82,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ComposedString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ComposedString1BoxedString(validate(arg, configuration)); } @Override - public ComposedString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ComposedString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java index cc540c8c2f9..7fd6478f0c7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Currency.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -93,29 +92,29 @@ public String validate(StringCurrencyEnums arg,SchemaConfiguration configuration } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Currency1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Currency1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Currency1BoxedString(validate(arg, configuration)); } @Override - public Currency1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Currency1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java index 9b28b43a094..0c514e9658f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DanishPig.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -95,29 +94,29 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -136,7 +135,7 @@ public static DanishPigMap of(Map arg, Schem public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for className"); + throw new RuntimeException("Invalid value stored for className"); } return (String) value; } @@ -246,7 +245,7 @@ public DanishPigMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -254,7 +253,7 @@ public DanishPigMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -264,7 +263,7 @@ public DanishPigMap getNewInstance(Map arg, List pathToItem, PathT return new DanishPigMap(castProperties); } - public DanishPigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DanishPigMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -276,29 +275,29 @@ public DanishPigMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DanishPig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DanishPig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DanishPig1BoxedMap(validate(arg, configuration)); } @Override - public DanishPig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DanishPig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java index 5d34b2dc7b9..bfb26b9a3b0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeTest.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -72,35 +71,35 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public DateTimeTest1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeTest1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeTest1BoxedString(validate(arg, configuration)); } @Override - public DateTimeTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java index eadd8a76100..85d0db19fd4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateTimeWithValidations.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -74,29 +73,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateTimeWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeWithValidations1BoxedString(validate(arg, configuration)); } @Override - public DateTimeWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java index c30a44c17dd..0f023d66745 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/DateWithValidations.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -74,29 +73,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DateWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateWithValidations1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateWithValidations1BoxedString(validate(arg, configuration)); } @Override - public DateWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java index 4732a7167ce..26d207218d2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Dog.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +65,7 @@ public String breed() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for breed"); + throw new RuntimeException("Invalid value stored for breed"); } return (String) value; } @@ -151,7 +150,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -159,7 +158,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -169,7 +168,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -181,29 +180,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -281,7 +280,7 @@ public static Dog1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -293,7 +292,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -305,7 +304,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -316,24 +315,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -365,7 +364,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -392,7 +391,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -400,7 +399,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -410,7 +409,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -422,7 +421,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -437,10 +436,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -455,34 +454,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Dog1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedVoid(validate(arg, configuration)); } @Override - public Dog1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedBoolean(validate(arg, configuration)); } @Override - public Dog1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedNumber(validate(arg, configuration)); } @Override - public Dog1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedString(validate(arg, configuration)); } @Override - public Dog1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedList(validate(arg, configuration)); } @Override - public Dog1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Dog1BoxedMap(validate(arg, configuration)); } @Override - public Dog1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Dog1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -498,7 +497,7 @@ public Dog1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java index 9af29e766a2..d243bcfc3b9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Drawing.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -141,12 +140,12 @@ public ShapesList getNewInstance(List arg, List pathToItem, PathToSch itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((@Nullable Object) itemInstance); i += 1; @@ -166,29 +165,29 @@ public ShapesList validate(List arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ShapesBoxedList(validate(arg, configuration)); } @Override - public ShapesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -212,7 +211,7 @@ public static DrawingMap of(Map arg, SchemaC throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for mainShape"); + throw new RuntimeException("Invalid value stored for mainShape"); } return (@Nullable Object) value; } @@ -222,7 +221,7 @@ public static DrawingMap of(Map arg, SchemaC throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for shapeOrNull"); + throw new RuntimeException("Invalid value stored for shapeOrNull"); } return (@Nullable Object) value; } @@ -232,7 +231,7 @@ public static DrawingMap of(Map arg, SchemaC throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for nullableShape"); + throw new RuntimeException("Invalid value stored for nullableShape"); } return (@Nullable Object) value; } @@ -242,7 +241,7 @@ public ShapesList shapes() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ShapesList)) { - throw new InvalidTypeException("Invalid value stored for shapes"); + throw new RuntimeException("Invalid value stored for shapes"); } return (ShapesList) value; } @@ -251,7 +250,7 @@ public ShapesList shapes() throws UnsetPropertyException { throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (@Nullable Object) value; } @@ -598,7 +597,7 @@ public DrawingMap getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -606,7 +605,7 @@ public DrawingMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -616,7 +615,7 @@ public DrawingMap getNewInstance(Map arg, List pathToItem, PathToS return new DrawingMap(castProperties); } - public DrawingMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DrawingMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -628,29 +627,29 @@ public DrawingMap validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Drawing1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Drawing1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Drawing1BoxedMap(validate(arg, configuration)); } @Override - public Drawing1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Drawing1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java index 1cb148337ee..073d51bc36f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumArrays.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -99,29 +98,29 @@ public String validate(StringJustSymbolEnums arg,SchemaConfiguration configurati } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JustSymbolBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JustSymbolBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new JustSymbolBoxedString(validate(arg, configuration)); } @Override - public JustSymbolBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JustSymbolBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringItemsEnums implements StringValueMethod { @@ -190,29 +189,29 @@ public String validate(StringItemsEnums arg,SchemaConfiguration configuration) t } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedString(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -292,12 +291,12 @@ public ArrayEnumList getNewInstance(List arg, List pathToItem, PathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -317,29 +316,29 @@ public ArrayEnumList validate(List arg, SchemaConfiguration configuration) th } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayEnumBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayEnumBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayEnumBoxedList(validate(arg, configuration)); } @Override - public ArrayEnumBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayEnumBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -361,7 +360,7 @@ public String just_symbol() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for just_symbol"); + throw new RuntimeException("Invalid value stored for just_symbol"); } return (String) value; } @@ -371,7 +370,7 @@ public ArrayEnumList array_enum() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayEnumList)) { - throw new InvalidTypeException("Invalid value stored for array_enum"); + throw new RuntimeException("Invalid value stored for array_enum"); } return (ArrayEnumList) value; } @@ -484,7 +483,7 @@ public EnumArraysMap getNewInstance(Map arg, List pathToItem, Path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -492,7 +491,7 @@ public EnumArraysMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -502,7 +501,7 @@ public EnumArraysMap getNewInstance(Map arg, List pathToItem, Path return new EnumArraysMap(castProperties); } - public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -514,29 +513,29 @@ public EnumArraysMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumArrays1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumArrays1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EnumArrays1BoxedMap(validate(arg, configuration)); } @Override - public EnumArrays1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumArrays1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java index 2e135af5e31..f757027a167 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumClass.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -101,35 +100,35 @@ public String validate(StringEnumClassEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public EnumClass1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumClass1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EnumClass1BoxedString(validate(arg, configuration)); } @Override - public EnumClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java index b0ab185439e..57432f3a3d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EnumTest.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -109,29 +108,29 @@ public String validate(StringEnumStringEnums arg,SchemaConfiguration configurati } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EnumStringBoxedString(validate(arg, configuration)); } @Override - public EnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringEnumStringRequiredEnums implements StringValueMethod { @@ -202,29 +201,29 @@ public String validate(StringEnumStringRequiredEnums arg,SchemaConfiguration con } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumStringRequiredBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumStringRequiredBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EnumStringRequiredBoxedString(validate(arg, configuration)); } @Override - public EnumStringRequiredBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumStringRequiredBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum IntegerEnumIntegerEnums implements IntegerValueMethod { @@ -359,29 +358,29 @@ public double validate(DoubleEnumIntegerEnums arg,SchemaConfiguration configurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EnumIntegerBoxedNumber(validate(arg, configuration)); } @Override - public EnumIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum DoubleEnumNumberEnums implements DoubleValueMethod { @@ -475,29 +474,29 @@ public double validate(DoubleEnumNumberEnums arg,SchemaConfiguration configurati } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EnumNumberBoxedNumber(validate(arg, configuration)); } @Override - public EnumNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -525,7 +524,7 @@ public static EnumTestMap of(Map arg, Schema public String enum_string_required() { @Nullable Object value = get("enum_string_required"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for enum_string_required"); + throw new RuntimeException("Invalid value stored for enum_string_required"); } return (String) value; } @@ -535,7 +534,7 @@ public String enum_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for enum_string"); + throw new RuntimeException("Invalid value stored for enum_string"); } return (String) value; } @@ -545,7 +544,7 @@ public Number enum_integer() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for enum_integer"); + throw new RuntimeException("Invalid value stored for enum_integer"); } return (Number) value; } @@ -555,7 +554,7 @@ public Number enum_number() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for enum_number"); + throw new RuntimeException("Invalid value stored for enum_number"); } return (Number) value; } @@ -565,7 +564,7 @@ public Number enum_number() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for stringEnum"); + throw new RuntimeException("Invalid value stored for stringEnum"); } return (@Nullable String) value; } @@ -575,7 +574,7 @@ public Number IntegerEnum() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for IntegerEnum"); + throw new RuntimeException("Invalid value stored for IntegerEnum"); } return (Number) value; } @@ -585,7 +584,7 @@ public String StringEnumWithDefaultValue() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for StringEnumWithDefaultValue"); + throw new RuntimeException("Invalid value stored for StringEnumWithDefaultValue"); } return (String) value; } @@ -595,7 +594,7 @@ public Number IntegerEnumWithDefaultValue() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for IntegerEnumWithDefaultValue"); + throw new RuntimeException("Invalid value stored for IntegerEnumWithDefaultValue"); } return (Number) value; } @@ -605,7 +604,7 @@ public Number IntegerEnumOneValue() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for IntegerEnumOneValue"); + throw new RuntimeException("Invalid value stored for IntegerEnumOneValue"); } return (Number) value; } @@ -1059,7 +1058,7 @@ public EnumTestMap getNewInstance(Map arg, List pathToItem, PathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1067,7 +1066,7 @@ public EnumTestMap getNewInstance(Map arg, List pathToItem, PathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1077,7 +1076,7 @@ public EnumTestMap getNewInstance(Map arg, List pathToItem, PathTo return new EnumTestMap(castProperties); } - public EnumTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1089,29 +1088,29 @@ public EnumTestMap validate(Map arg, SchemaConfiguration configuration) th @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EnumTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EnumTest1BoxedMap(validate(arg, configuration)); } @Override - public EnumTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EnumTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java index 511d329cb47..fa4cfdf5976 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/EquilateralTriangle.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -103,29 +102,29 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleTypeBoxedString(validate(arg, configuration)); } @Override - public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -146,7 +145,7 @@ public String triangleType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for triangleType"); + throw new RuntimeException("Invalid value stored for triangleType"); } return (String) value; } @@ -237,7 +236,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -245,7 +244,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -255,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,29 +266,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -367,7 +366,7 @@ public static EquilateralTriangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -391,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -451,7 +450,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -478,7 +477,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -486,7 +485,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -508,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -523,10 +522,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -541,34 +540,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public EquilateralTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedVoid(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedBoolean(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedNumber(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedString(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedList(validate(arg, configuration)); } @Override - public EquilateralTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new EquilateralTriangle1BoxedMap(validate(arg, configuration)); } @Override - public EquilateralTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public EquilateralTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -584,7 +583,7 @@ public EquilateralTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java index 4b2eb51f91e..d91798f4e93 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/File.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ public String sourceURI() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for sourceURI"); + throw new RuntimeException("Invalid value stored for sourceURI"); } return (String) value; } @@ -150,7 +149,7 @@ public FileMap getNewInstance(Map arg, List pathToItem, PathToSche for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,7 +157,7 @@ public FileMap getNewInstance(Map arg, List pathToItem, PathToSche Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -168,7 +167,7 @@ public FileMap getNewInstance(Map arg, List pathToItem, PathToSche return new FileMap(castProperties); } - public FileMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FileMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,29 +179,29 @@ public FileMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public File1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public File1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new File1BoxedMap(validate(arg, configuration)); } @Override - public File1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public File1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java index cc4f912d614..8a07f63e2b0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FileSchemaTestClass.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -101,12 +100,12 @@ public FilesList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof File.FileMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((File.FileMap) itemInstance); i += 1; @@ -126,29 +125,29 @@ public FilesList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new FilesBoxedList(validate(arg, configuration)); } @Override - public FilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -170,7 +169,7 @@ public File.FileMap file() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof File.FileMap)) { - throw new InvalidTypeException("Invalid value stored for file"); + throw new RuntimeException("Invalid value stored for file"); } return (File.FileMap) value; } @@ -180,7 +179,7 @@ public FilesList files() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FilesList)) { - throw new InvalidTypeException("Invalid value stored for files"); + throw new RuntimeException("Invalid value stored for files"); } return (FilesList) value; } @@ -287,7 +286,7 @@ public FileSchemaTestClassMap getNewInstance(Map arg, List pathToI for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -295,7 +294,7 @@ public FileSchemaTestClassMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -305,7 +304,7 @@ public FileSchemaTestClassMap getNewInstance(Map arg, List pathToI return new FileSchemaTestClassMap(castProperties); } - public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -317,29 +316,29 @@ public FileSchemaTestClassMap validate(Map arg, SchemaConfiguration config @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FileSchemaTestClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FileSchemaTestClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FileSchemaTestClass1BoxedMap(validate(arg, configuration)); } @Override - public FileSchemaTestClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FileSchemaTestClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java index a14f1cb5451..5a2618fb230 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Foo.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -45,7 +44,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -136,7 +135,7 @@ public FooMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -144,7 +143,7 @@ public FooMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -154,7 +153,7 @@ public FooMap getNewInstance(Map arg, List pathToItem, PathToSchem return new FooMap(castProperties); } - public FooMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FooMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -166,29 +165,29 @@ public FooMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Foo1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Foo1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Foo1BoxedMap(validate(arg, configuration)); } @Override - public Foo1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Foo1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java index ed61c57c7c5..bf716753fe8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FormatTest.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DateJsonSchema; @@ -110,29 +109,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerSchemaBoxedNumber(validate(arg, configuration)); } @Override - public IntegerSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -204,29 +203,29 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Int32withValidationsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32withValidationsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int32withValidationsBoxedNumber(validate(arg, configuration)); } @Override - public Int32withValidationsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32withValidationsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -306,29 +305,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberSchemaBoxedNumber(validate(arg, configuration)); } @Override - public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -384,29 +383,29 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FloatSchemaBoxedNumber(validate(arg, configuration)); } @Override - public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -473,29 +472,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleSchemaBoxedNumber(validate(arg, configuration)); } @Override - public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -608,12 +607,12 @@ public ArrayWithUniqueItemsList getNewInstance(List arg, List pathToI itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Number) itemInstance); i += 1; @@ -633,29 +632,29 @@ public ArrayWithUniqueItemsList validate(List arg, SchemaConfiguration config } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayWithUniqueItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithUniqueItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithUniqueItemsBoxedList(validate(arg, configuration)); } @Override - public ArrayWithUniqueItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithUniqueItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -706,29 +705,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringSchemaBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringSchemaBoxedString(validate(arg, configuration)); } @Override - public StringSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -845,29 +844,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PasswordBoxedString(validate(arg, configuration)); } @Override - public PasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -917,29 +916,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternWithDigitsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternWithDigitsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PatternWithDigitsBoxedString(validate(arg, configuration)); } @Override - public PatternWithDigitsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternWithDigitsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -990,29 +989,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PatternWithDigitsAndDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternWithDigitsAndDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PatternWithDigitsAndDelimiterBoxedString(validate(arg, configuration)); } @Override - public PatternWithDigitsAndDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PatternWithDigitsAndDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1063,7 +1062,7 @@ public static FormatTestMap of(Map arg, Sche public String date() { @Nullable Object value = get("date"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for date"); + throw new RuntimeException("Invalid value stored for date"); } return (String) value; } @@ -1071,7 +1070,7 @@ public String date() { public String password() { @Nullable Object value = get("password"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for password"); + throw new RuntimeException("Invalid value stored for password"); } return (String) value; } @@ -1081,7 +1080,7 @@ public Number int32() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for int32"); + throw new RuntimeException("Invalid value stored for int32"); } return (Number) value; } @@ -1091,7 +1090,7 @@ public Number int32withValidations() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for int32withValidations"); + throw new RuntimeException("Invalid value stored for int32withValidations"); } return (Number) value; } @@ -1101,7 +1100,7 @@ public Number int64() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for int64"); + throw new RuntimeException("Invalid value stored for int64"); } return (Number) value; } @@ -1111,7 +1110,7 @@ public Number float32() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for float32"); + throw new RuntimeException("Invalid value stored for float32"); } return (Number) value; } @@ -1121,7 +1120,7 @@ public Number float64() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for float64"); + throw new RuntimeException("Invalid value stored for float64"); } return (Number) value; } @@ -1131,7 +1130,7 @@ public ArrayWithUniqueItemsList arrayWithUniqueItems() throws UnsetPropertyExcep throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayWithUniqueItemsList)) { - throw new InvalidTypeException("Invalid value stored for arrayWithUniqueItems"); + throw new RuntimeException("Invalid value stored for arrayWithUniqueItems"); } return (ArrayWithUniqueItemsList) value; } @@ -1141,7 +1140,7 @@ public String binary() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for binary"); + throw new RuntimeException("Invalid value stored for binary"); } return (String) value; } @@ -1151,7 +1150,7 @@ public String dateTime() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for dateTime"); + throw new RuntimeException("Invalid value stored for dateTime"); } return (String) value; } @@ -1161,7 +1160,7 @@ public String uuidNoExample() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for uuidNoExample"); + throw new RuntimeException("Invalid value stored for uuidNoExample"); } return (String) value; } @@ -1171,7 +1170,7 @@ public String pattern_with_digits() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for pattern_with_digits"); + throw new RuntimeException("Invalid value stored for pattern_with_digits"); } return (String) value; } @@ -1181,7 +1180,7 @@ public String pattern_with_digits_and_delimiter() throws UnsetPropertyException throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for pattern_with_digits_and_delimiter"); + throw new RuntimeException("Invalid value stored for pattern_with_digits_and_delimiter"); } return (String) value; } @@ -1191,7 +1190,7 @@ public Void noneProp() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Void)) { - throw new InvalidTypeException("Invalid value stored for noneProp"); + throw new RuntimeException("Invalid value stored for noneProp"); } return (Void) value; } @@ -1980,7 +1979,7 @@ public FormatTestMap getNewInstance(Map arg, List pathToItem, Path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1988,7 +1987,7 @@ public FormatTestMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1998,7 +1997,7 @@ public FormatTestMap getNewInstance(Map arg, List pathToItem, Path return new FormatTestMap(castProperties); } - public FormatTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FormatTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2010,29 +2009,29 @@ public FormatTestMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FormatTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FormatTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FormatTest1BoxedMap(validate(arg, configuration)); } @Override - public FormatTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FormatTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java index 5692157bda6..b708fa92058 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FromSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -70,7 +69,7 @@ public String data() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for data"); + throw new RuntimeException("Invalid value stored for data"); } return (String) value; } @@ -80,7 +79,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for id"); + throw new RuntimeException("Invalid value stored for id"); } return (Number) value; } @@ -205,7 +204,7 @@ public FromSchemaMap getNewInstance(Map arg, List pathToItem, Path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -213,7 +212,7 @@ public FromSchemaMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -223,7 +222,7 @@ public FromSchemaMap getNewInstance(Map arg, List pathToItem, Path return new FromSchemaMap(castProperties); } - public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,29 +234,29 @@ public FromSchemaMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FromSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FromSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FromSchema1BoxedMap(validate(arg, configuration)); } @Override - public FromSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FromSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java index 275d87f5474..7c50a1c4e59 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Fruit.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +65,7 @@ public String color() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for color"); + throw new RuntimeException("Invalid value stored for color"); } return (String) value; } @@ -191,7 +190,7 @@ public static Fruit1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +202,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,7 +214,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -226,24 +225,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -275,7 +274,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -302,7 +301,7 @@ public FruitMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -310,7 +309,7 @@ public FruitMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -320,7 +319,7 @@ public FruitMap getNewInstance(Map arg, List pathToItem, PathToSch return new FruitMap(castProperties); } - public FruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -332,7 +331,7 @@ public FruitMap validate(Map arg, SchemaConfiguration configuration) throw } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -347,10 +346,10 @@ public FruitMap validate(Map arg, SchemaConfiguration configuration) throw } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -365,34 +364,34 @@ public FruitMap validate(Map arg, SchemaConfiguration configuration) throw } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Fruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedVoid(validate(arg, configuration)); } @Override - public Fruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedBoolean(validate(arg, configuration)); } @Override - public Fruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedNumber(validate(arg, configuration)); } @Override - public Fruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedString(validate(arg, configuration)); } @Override - public Fruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedList(validate(arg, configuration)); } @Override - public Fruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Fruit1BoxedMap(validate(arg, configuration)); } @Override - public Fruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Fruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -408,7 +407,7 @@ public Fruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java index e5d97263a06..fccdffed6f0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/FruitReq.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -121,7 +120,7 @@ public static FruitReq1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -133,7 +132,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -145,7 +144,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -156,24 +155,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -205,7 +204,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -240,7 +239,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -250,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -262,7 +261,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -277,10 +276,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -295,34 +294,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public FruitReq1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedVoid(validate(arg, configuration)); } @Override - public FruitReq1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedBoolean(validate(arg, configuration)); } @Override - public FruitReq1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedNumber(validate(arg, configuration)); } @Override - public FruitReq1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedString(validate(arg, configuration)); } @Override - public FruitReq1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedList(validate(arg, configuration)); } @Override - public FruitReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new FruitReq1BoxedMap(validate(arg, configuration)); } @Override - public FruitReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FruitReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -338,7 +337,7 @@ public FruitReq1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java index cb3f4599c5b..4ad2cc51e1f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GmFruit.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -66,7 +65,7 @@ public String color() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for color"); + throw new RuntimeException("Invalid value stored for color"); } return (String) value; } @@ -191,7 +190,7 @@ public static GmFruit1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -203,7 +202,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -215,7 +214,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -226,24 +225,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -275,7 +274,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -302,7 +301,7 @@ public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -310,7 +309,7 @@ public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -320,7 +319,7 @@ public GmFruitMap getNewInstance(Map arg, List pathToItem, PathToS return new GmFruitMap(castProperties); } - public GmFruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruitMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -332,7 +331,7 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configuration) thr } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -347,10 +346,10 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -365,34 +364,34 @@ public GmFruitMap validate(Map arg, SchemaConfiguration configuration) thr } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public GmFruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedVoid(validate(arg, configuration)); } @Override - public GmFruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedBoolean(validate(arg, configuration)); } @Override - public GmFruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedNumber(validate(arg, configuration)); } @Override - public GmFruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedString(validate(arg, configuration)); } @Override - public GmFruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedList(validate(arg, configuration)); } @Override - public GmFruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new GmFruit1BoxedMap(validate(arg, configuration)); } @Override - public GmFruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GmFruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -408,7 +407,7 @@ public GmFruit1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java index 4734ddc65a3..bdc5b75784b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/GrandparentAnimal.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -55,7 +54,7 @@ public static GrandparentAnimalMap of(Map ar public String pet_type() { @Nullable Object value = get("pet_type"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for pet_type"); + throw new RuntimeException("Invalid value stored for pet_type"); } return (String) value; } @@ -159,7 +158,7 @@ public GrandparentAnimalMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -167,7 +166,7 @@ public GrandparentAnimalMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -177,7 +176,7 @@ public GrandparentAnimalMap getNewInstance(Map arg, List pathToIte return new GrandparentAnimalMap(castProperties); } - public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,29 +188,29 @@ public GrandparentAnimalMap validate(Map arg, SchemaConfiguration configur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public GrandparentAnimal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GrandparentAnimal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new GrandparentAnimal1BoxedMap(validate(arg, configuration)); } @Override - public GrandparentAnimal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public GrandparentAnimal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java index 4687de450d9..3e7968f1b15 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HasOnlyReadOnly.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -69,7 +68,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -79,7 +78,7 @@ public String foo() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for foo"); + throw new RuntimeException("Invalid value stored for foo"); } return (String) value; } @@ -186,7 +185,7 @@ public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -194,7 +193,7 @@ public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -204,7 +203,7 @@ public HasOnlyReadOnlyMap getNewInstance(Map arg, List pathToItem, return new HasOnlyReadOnlyMap(castProperties); } - public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,29 +215,29 @@ public HasOnlyReadOnlyMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HasOnlyReadOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HasOnlyReadOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HasOnlyReadOnly1BoxedMap(validate(arg, configuration)); } @Override - public HasOnlyReadOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HasOnlyReadOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java index a499676d162..b90d71cfee4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/HealthCheckResult.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -92,40 +91,40 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableMessageBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableMessageBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NullableMessageBoxedVoid(validate(arg, configuration)); } @Override - public NullableMessageBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableMessageBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NullableMessageBoxedString(validate(arg, configuration)); } @Override - public NullableMessageBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableMessageBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -146,7 +145,7 @@ public static HealthCheckResultMap of(Map ar throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for NullableMessage"); + throw new RuntimeException("Invalid value stored for NullableMessage"); } return (@Nullable String) value; } @@ -245,7 +244,7 @@ public HealthCheckResultMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -253,7 +252,7 @@ public HealthCheckResultMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -263,7 +262,7 @@ public HealthCheckResultMap getNewInstance(Map arg, List pathToIte return new HealthCheckResultMap(castProperties); } - public HealthCheckResultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HealthCheckResultMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -275,29 +274,29 @@ public HealthCheckResultMap validate(Map arg, SchemaConfiguration configur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HealthCheckResult1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HealthCheckResult1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HealthCheckResult1BoxedMap(validate(arg, configuration)); } @Override - public HealthCheckResult1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HealthCheckResult1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java index b20ad0b018a..3a76754f403 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnum.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -179,29 +178,29 @@ public double validate(DoubleIntegerEnumEnums arg,SchemaConfiguration configurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnum1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnum1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerEnum1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java index 74085a9268a..5d67f71f851 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumBig.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -179,29 +178,29 @@ public double validate(DoubleIntegerEnumBigEnums arg,SchemaConfiguration configu } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnumBig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumBig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerEnumBig1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnumBig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumBig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java index 3157279dfbf..c5618e31d67 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumOneValue.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -169,29 +168,29 @@ public double validate(DoubleIntegerEnumOneValueEnums arg,SchemaConfiguration co } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnumOneValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumOneValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerEnumOneValue1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnumOneValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumOneValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java index a4afc589221..ad176b517e1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerEnumWithDefaultValue.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -181,29 +180,29 @@ public double validate(DoubleIntegerEnumWithDefaultValueEnums arg,SchemaConfigur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerEnumWithDefaultValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumWithDefaultValue1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerEnumWithDefaultValue1BoxedNumber(validate(arg, configuration)); } @Override - public IntegerEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java index aca58126d3d..d5382218276 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMax10.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -89,29 +88,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerMax101BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerMax101BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerMax101BoxedNumber(validate(arg, configuration)); } @Override - public IntegerMax101Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerMax101Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java index 40f8b80b761..551489c98f8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IntegerMin15.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -89,29 +88,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerMin151BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerMin151BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerMin151BoxedNumber(validate(arg, configuration)); } @Override - public IntegerMin151Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerMin151Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java index 57a6f72619c..01a61a254d0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/IsoscelesTriangle.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -103,29 +102,29 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleTypeBoxedString(validate(arg, configuration)); } @Override - public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -146,7 +145,7 @@ public String triangleType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for triangleType"); + throw new RuntimeException("Invalid value stored for triangleType"); } return (String) value; } @@ -237,7 +236,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -245,7 +244,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -255,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,29 +266,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -367,7 +366,7 @@ public static IsoscelesTriangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -391,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -451,7 +450,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -478,7 +477,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -486,7 +485,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -508,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -523,10 +522,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -541,34 +540,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IsoscelesTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedVoid(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedBoolean(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedNumber(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedString(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedList(validate(arg, configuration)); } @Override - public IsoscelesTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new IsoscelesTriangle1BoxedMap(validate(arg, configuration)); } @Override - public IsoscelesTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IsoscelesTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -584,7 +583,7 @@ public IsoscelesTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java index 594b1fe65bc..99f46b05498 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Items.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -115,12 +114,12 @@ public ItemsList getNewInstance(List arg, List pathToItem, PathToSche itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((FrozenMap) itemInstance); i += 1; @@ -140,29 +139,29 @@ public ItemsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Items1BoxedList(validate(arg, configuration)); } @Override - public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java index 6d33dabcc9a..29a37d97892 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequest.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -103,7 +102,7 @@ public static Items getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -115,7 +114,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -127,7 +126,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -138,24 +137,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -187,7 +186,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -214,7 +213,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -222,7 +221,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -232,7 +231,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -244,7 +243,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -259,10 +258,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -277,34 +276,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedVoid(validate(arg, configuration)); } @Override - public ItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedBoolean(validate(arg, configuration)); } @Override - public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedNumber(validate(arg, configuration)); } @Override - public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedString(validate(arg, configuration)); } @Override - public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedList(validate(arg, configuration)); } @Override - public ItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ItemsBoxedMap(validate(arg, configuration)); } @Override - public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -320,7 +319,7 @@ public ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -441,7 +440,7 @@ public JSONPatchRequestList getNewInstance(List arg, List pathToItem, itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -463,29 +462,29 @@ public JSONPatchRequestList validate(List arg, SchemaConfiguration configurat } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequest1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequest1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new JSONPatchRequest1BoxedList(validate(arg, configuration)); } @Override - public JSONPatchRequest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java index 208f6dbb772..9e4766a2553 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestAddReplaceTest.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -135,29 +134,29 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OpBoxedString(validate(arg, configuration)); } @Override - public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -178,7 +177,7 @@ public static JSONPatchRequestAddReplaceTestMap of(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -466,7 +469,7 @@ public JSONPatchRequestAddReplaceTestMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -476,7 +479,7 @@ public JSONPatchRequestAddReplaceTestMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestAddReplaceTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -488,29 +491,29 @@ public JSONPatchRequestAddReplaceTestMap validate(Map arg, SchemaConfigura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequestAddReplaceTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestAddReplaceTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new JSONPatchRequestAddReplaceTest1BoxedMap(validate(arg, configuration)); } @Override - public JSONPatchRequestAddReplaceTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestAddReplaceTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java index 756770311c5..ccecd4a7216 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestMoveCopy.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -133,29 +132,29 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OpBoxedString(validate(arg, configuration)); } @Override - public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -174,19 +173,27 @@ public static JSONPatchRequestMoveCopyMap of(Map arg, SchemaConf } public String from() { - return getOrThrow("from"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public String op() { String value = get("op"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for op"); + throw new RuntimeException("Invalid value stored for op"); } return (String) value; } public String path() { - return getOrThrow("path"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -404,7 +411,7 @@ public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pa for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -412,12 +419,12 @@ public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -425,7 +432,7 @@ public JSONPatchRequestMoveCopyMap getNewInstance(Map arg, List pa return new JSONPatchRequestMoveCopyMap(castProperties); } - public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -437,29 +444,29 @@ public JSONPatchRequestMoveCopyMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequestMoveCopy1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestMoveCopy1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new JSONPatchRequestMoveCopy1BoxedMap(validate(arg, configuration)); } @Override - public JSONPatchRequestMoveCopy1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestMoveCopy1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java index e358e5e96d5..909c63f3f69 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/JSONPatchRequestRemove.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -120,29 +119,29 @@ public String validate(StringOpEnums arg,SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new OpBoxedString(validate(arg, configuration)); } @Override - public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OpBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -162,13 +161,17 @@ public static JSONPatchRequestRemoveMap of(Map arg, SchemaConfig public String op() { String value = get("op"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for op"); + throw new RuntimeException("Invalid value stored for op"); } return (String) value; } public String path() { - return getOrThrow("path"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -308,7 +311,7 @@ public JSONPatchRequestRemoveMap getNewInstance(Map arg, List path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -316,12 +319,12 @@ public JSONPatchRequestRemoveMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -329,7 +332,7 @@ public JSONPatchRequestRemoveMap getNewInstance(Map arg, List path return new JSONPatchRequestRemoveMap(castProperties); } - public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -341,29 +344,29 @@ public JSONPatchRequestRemoveMap validate(Map arg, SchemaConfiguration con @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public JSONPatchRequestRemove1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestRemove1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new JSONPatchRequestRemove1BoxedMap(validate(arg, configuration)); } @Override - public JSONPatchRequestRemove1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public JSONPatchRequestRemove1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java index 4cd47033fbd..79d6eb48d01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Mammal.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -109,7 +108,7 @@ public static Mammal1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,7 +120,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -133,7 +132,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,24 +143,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -193,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -220,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -238,7 +237,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -250,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -265,10 +264,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -283,34 +282,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Mammal1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedVoid(validate(arg, configuration)); } @Override - public Mammal1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedBoolean(validate(arg, configuration)); } @Override - public Mammal1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedNumber(validate(arg, configuration)); } @Override - public Mammal1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedString(validate(arg, configuration)); } @Override - public Mammal1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedList(validate(arg, configuration)); } @Override - public Mammal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Mammal1BoxedMap(validate(arg, configuration)); } @Override - public Mammal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Mammal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -326,7 +325,7 @@ public Mammal1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration con } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java index b0e6e922553..5c949106062 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MapTest.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -129,7 +128,7 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -137,12 +136,12 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -150,7 +149,7 @@ public AdditionalPropertiesMap getNewInstance(Map arg, List pathTo return new AdditionalPropertiesMap(castProperties); } - public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -162,29 +161,29 @@ public AdditionalPropertiesMap validate(Map arg, SchemaConfiguration confi @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalPropertiesBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalPropertiesBoxedMap(validate(arg, configuration)); } @Override - public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalPropertiesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -272,7 +271,7 @@ public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -280,12 +279,12 @@ public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof AdditionalPropertiesMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (AdditionalPropertiesMap) propertyInstance); } @@ -293,7 +292,7 @@ public MapMapOfStringMap getNewInstance(Map arg, List pathToItem, return new MapMapOfStringMap(castProperties); } - public MapMapOfStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapMapOfStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -305,29 +304,29 @@ public MapMapOfStringMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapMapOfStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapMapOfStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapMapOfStringBoxedMap(validate(arg, configuration)); } @Override - public MapMapOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapMapOfStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -397,29 +396,29 @@ public String validate(StringAdditionalPropertiesEnums arg,SchemaConfiguration c } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedString(validate(arg, configuration)); } @Override - public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -513,7 +512,7 @@ public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -521,12 +520,12 @@ public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -534,7 +533,7 @@ public MapOfEnumStringMap getNewInstance(Map arg, List pathToItem, return new MapOfEnumStringMap(castProperties); } - public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -546,29 +545,29 @@ public MapOfEnumStringMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapOfEnumStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfEnumStringBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapOfEnumStringBoxedMap(validate(arg, configuration)); } @Override - public MapOfEnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapOfEnumStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -598,7 +597,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new InvalidTypeException("Value may not be null"); + throw new RuntimeException("Value may not be null"); } return (boolean) value; } @@ -672,7 +671,7 @@ public DirectMapMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -680,12 +679,12 @@ public DirectMapMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -693,7 +692,7 @@ public DirectMapMap getNewInstance(Map arg, List pathToItem, PathT return new DirectMapMap(castProperties); } - public DirectMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DirectMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -705,29 +704,29 @@ public DirectMapMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DirectMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DirectMapBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new DirectMapBoxedMap(validate(arg, configuration)); } @Override - public DirectMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DirectMapBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -752,7 +751,7 @@ public MapMapOfStringMap map_map_of_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapMapOfStringMap)) { - throw new InvalidTypeException("Invalid value stored for map_map_of_string"); + throw new RuntimeException("Invalid value stored for map_map_of_string"); } return (MapMapOfStringMap) value; } @@ -762,7 +761,7 @@ public MapOfEnumStringMap map_of_enum_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MapOfEnumStringMap)) { - throw new InvalidTypeException("Invalid value stored for map_of_enum_string"); + throw new RuntimeException("Invalid value stored for map_of_enum_string"); } return (MapOfEnumStringMap) value; } @@ -772,7 +771,7 @@ public DirectMapMap direct_map() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof DirectMapMap)) { - throw new InvalidTypeException("Invalid value stored for direct_map"); + throw new RuntimeException("Invalid value stored for direct_map"); } return (DirectMapMap) value; } @@ -782,7 +781,7 @@ public StringBooleanMap.StringBooleanMapMap indirect_map() throws UnsetPropertyE throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof StringBooleanMap.StringBooleanMapMap)) { - throw new InvalidTypeException("Invalid value stored for indirect_map"); + throw new RuntimeException("Invalid value stored for indirect_map"); } return (StringBooleanMap.StringBooleanMapMap) value; } @@ -921,7 +920,7 @@ public MapTestMap getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -929,7 +928,7 @@ public MapTestMap getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -939,7 +938,7 @@ public MapTestMap getNewInstance(Map arg, List pathToItem, PathToS return new MapTestMap(castProperties); } - public MapTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapTestMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -951,29 +950,29 @@ public MapTestMap validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapTest1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapTest1BoxedMap(validate(arg, configuration)); } @Override - public MapTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapTest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java index 60737d39485..745291751f4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MixedPropertiesAndAdditionalPropertiesClass.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DateTimeJsonSchema; @@ -136,7 +135,7 @@ public MapMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -144,12 +143,12 @@ public MapMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Animal.AnimalMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Animal.AnimalMap) propertyInstance); } @@ -157,7 +156,7 @@ public MapMap getNewInstance(Map arg, List pathToItem, PathToSchem return new MapMap(castProperties); } - public MapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -169,29 +168,29 @@ public MapMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MapSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapSchemaBoxedMap(validate(arg, configuration)); } @Override - public MapSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -215,7 +214,7 @@ public String dateTime() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for dateTime"); + throw new RuntimeException("Invalid value stored for dateTime"); } return (String) value; } @@ -338,7 +337,7 @@ public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map a for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -346,7 +345,7 @@ public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map a Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -356,7 +355,7 @@ public MixedPropertiesAndAdditionalPropertiesClassMap getNewInstance(Map a return new MixedPropertiesAndAdditionalPropertiesClassMap(castProperties); } - public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -368,29 +367,29 @@ public MixedPropertiesAndAdditionalPropertiesClassMap validate(Map arg, Sc @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MixedPropertiesAndAdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MixedPropertiesAndAdditionalPropertiesClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MixedPropertiesAndAdditionalPropertiesClass1BoxedMap(validate(arg, configuration)); } @Override - public MixedPropertiesAndAdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MixedPropertiesAndAdditionalPropertiesClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java index 646f92ae740..8556b36f75d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Money.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -69,7 +68,7 @@ public static MoneyMap of(Map arg, SchemaCon public String amount() { @Nullable Object value = get("amount"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for amount"); + throw new RuntimeException("Invalid value stored for amount"); } return (String) value; } @@ -77,7 +76,7 @@ public String amount() { public String currency() { @Nullable Object value = get("currency"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for currency"); + throw new RuntimeException("Invalid value stored for currency"); } return (String) value; } @@ -219,7 +218,7 @@ public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +226,7 @@ public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -237,7 +236,7 @@ public MoneyMap getNewInstance(Map arg, List pathToItem, PathToSch return new MoneyMap(castProperties); } - public MoneyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MoneyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,29 +248,29 @@ public MoneyMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Money1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Money1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Money1BoxedMap(validate(arg, configuration)); } @Override - public Money1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Money1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java index b985e9350ac..49aeac11da7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/MyObjectDto.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -147,7 +146,7 @@ public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, Pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -155,12 +154,12 @@ public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, Pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -168,7 +167,7 @@ public MyObjectDtoMap getNewInstance(Map arg, List pathToItem, Pat return new MyObjectDtoMap(castProperties); } - public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,29 +179,29 @@ public MyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MyObjectDto1BoxedMap(validate(arg, configuration)); } @Override - public MyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java index 081f87d53d9..42f33135fe6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Name.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -90,7 +89,7 @@ public static NameMap of(Map arg, SchemaConf public Number name() { @Nullable Object value = get("name"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (Number) value; } @@ -100,7 +99,7 @@ public Number snake_case() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for snake_case"); + throw new RuntimeException("Invalid value stored for snake_case"); } return (Number) value; } @@ -110,7 +109,7 @@ public String property() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for property"); + throw new RuntimeException("Invalid value stored for property"); } return (String) value; } @@ -290,7 +289,7 @@ public static Name1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -302,7 +301,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,7 +313,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -325,24 +324,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -374,7 +373,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -401,7 +400,7 @@ public NameMap getNewInstance(Map arg, List pathToItem, PathToSche for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -409,7 +408,7 @@ public NameMap getNewInstance(Map arg, List pathToItem, PathToSche Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -419,7 +418,7 @@ public NameMap getNewInstance(Map arg, List pathToItem, PathToSche return new NameMap(castProperties); } - public NameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -431,7 +430,7 @@ public NameMap validate(Map arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -446,10 +445,10 @@ public NameMap validate(Map arg, SchemaConfiguration configuration) throws } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -464,34 +463,34 @@ public NameMap validate(Map arg, SchemaConfiguration configuration) throws } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Name1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedVoid(validate(arg, configuration)); } @Override - public Name1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedBoolean(validate(arg, configuration)); } @Override - public Name1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedNumber(validate(arg, configuration)); } @Override - public Name1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedString(validate(arg, configuration)); } @Override - public Name1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedList(validate(arg, configuration)); } @Override - public Name1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Name1BoxedMap(validate(arg, configuration)); } @Override - public Name1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Name1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -507,7 +506,7 @@ public Name1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration confi } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java index dec315f92ed..0500ace9a46 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NoAdditionalProperties.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -79,7 +78,11 @@ public static NoAdditionalPropertiesMap of(Map arg, SchemaConfig } public Number id() { - return getOrThrow("id"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public Number petId() throws UnsetPropertyException { @@ -229,7 +232,7 @@ public NoAdditionalPropertiesMap getNewInstance(Map arg, List path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -237,12 +240,12 @@ public NoAdditionalPropertiesMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -250,7 +253,7 @@ public NoAdditionalPropertiesMap getNewInstance(Map arg, List path return new NoAdditionalPropertiesMap(castProperties); } - public NoAdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NoAdditionalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -262,29 +265,29 @@ public NoAdditionalPropertiesMap validate(Map arg, SchemaConfiguration con @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NoAdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NoAdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NoAdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public NoAdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NoAdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java index d412dae60ee..2bc824b0de6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableClass.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -92,7 +91,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -100,7 +99,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -110,7 +109,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -122,40 +121,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties3BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties3BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties3BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties3BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties3BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties3Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -241,40 +240,40 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public IntegerPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerPropBoxedVoid(validate(arg, configuration)); } @Override - public IntegerPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntegerPropBoxedNumber(validate(arg, configuration)); } @Override - public IntegerPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntegerPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -359,40 +358,40 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NumberPropBoxedVoid(validate(arg, configuration)); } @Override - public NumberPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberPropBoxedNumber(validate(arg, configuration)); } @Override - public NumberPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -458,35 +457,35 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public BooleanPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new BooleanPropBoxedVoid(validate(arg, configuration)); } @Override - public BooleanPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BooleanPropBoxedBoolean(validate(arg, configuration)); } @Override - public BooleanPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -494,7 +493,7 @@ public BooleanPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -560,40 +559,40 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new StringPropBoxedVoid(validate(arg, configuration)); } @Override - public StringPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringPropBoxedString(validate(arg, configuration)); } @Override - public StringPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -660,40 +659,40 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DatePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DatePropBoxedVoid(validate(arg, configuration)); } @Override - public DatePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DatePropBoxedString(validate(arg, configuration)); } @Override - public DatePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -760,40 +759,40 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public DatetimePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimePropBoxedVoid(validate(arg, configuration)); } @Override - public DatetimePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DatetimePropBoxedString(validate(arg, configuration)); } @Override - public DatetimePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DatetimePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -900,12 +899,12 @@ public ArrayNullablePropList getNewInstance(List arg, List pathToItem itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((FrozenMap) itemInstance); i += 1; @@ -925,40 +924,40 @@ public ArrayNullablePropList validate(List arg, SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ArrayNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayNullablePropBoxedList(validate(arg, configuration)); } @Override - public ArrayNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1016,7 +1015,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1024,7 +1023,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1034,7 +1033,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1046,40 +1045,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Items1BoxedVoid(validate(arg, configuration)); } @Override - public Items1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Items1BoxedMap(validate(arg, configuration)); } @Override - public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1180,12 +1179,12 @@ public ArrayAndItemsNullablePropList getNewInstance(List arg, List pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance == null || itemInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((@Nullable FrozenMap) itemInstance); i += 1; @@ -1205,40 +1204,40 @@ public ArrayAndItemsNullablePropList validate(List arg, SchemaConfiguration c } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayAndItemsNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ArrayAndItemsNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayAndItemsNullablePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayAndItemsNullablePropBoxedList(validate(arg, configuration)); } @Override - public ArrayAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1296,7 +1295,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1304,7 +1303,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1314,7 +1313,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1326,40 +1325,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Items2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Items2BoxedVoid(validate(arg, configuration)); } @Override - public Items2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Items2BoxedMap(validate(arg, configuration)); } @Override - public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1439,12 +1438,12 @@ public ArrayItemsNullableList getNewInstance(List arg, List pathToIte itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance == null || itemInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((@Nullable FrozenMap) itemInstance); i += 1; @@ -1464,29 +1463,29 @@ public ArrayItemsNullableList validate(List arg, SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ArrayItemsNullableBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayItemsNullableBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayItemsNullableBoxedList(validate(arg, configuration)); } @Override - public ArrayItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1605,7 +1604,7 @@ public ObjectNullablePropMap getNewInstance(Map arg, List pathToIt for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1613,12 +1612,12 @@ public ObjectNullablePropMap getNewInstance(Map arg, List pathToIt Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (FrozenMap) propertyInstance); } @@ -1626,7 +1625,7 @@ public ObjectNullablePropMap getNewInstance(Map arg, List pathToIt return new ObjectNullablePropMap(castProperties); } - public ObjectNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1638,40 +1637,40 @@ public ObjectNullablePropMap validate(Map arg, SchemaConfiguration configu @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ObjectNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectNullablePropBoxedMap(validate(arg, configuration)); } @Override - public ObjectNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1729,7 +1728,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1737,7 +1736,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1747,7 +1746,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1759,40 +1758,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties1BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -1907,7 +1906,7 @@ public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1915,12 +1914,12 @@ public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance == null || propertyInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable FrozenMap) propertyInstance); } @@ -1928,7 +1927,7 @@ public ObjectAndItemsNullablePropMap getNewInstance(Map arg, List return new ObjectAndItemsNullablePropMap(castProperties); } - public ObjectAndItemsNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectAndItemsNullablePropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1940,40 +1939,40 @@ public ObjectAndItemsNullablePropMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectAndItemsNullablePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectAndItemsNullablePropBoxedVoid(validate(arg, configuration)); } @Override - public ObjectAndItemsNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectAndItemsNullablePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectAndItemsNullablePropBoxedMap(validate(arg, configuration)); } @Override - public ObjectAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectAndItemsNullablePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2031,7 +2030,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2039,7 +2038,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -2049,7 +2048,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2061,40 +2060,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedVoid(validate(arg, configuration)); } @Override - public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AdditionalProperties2BoxedMap(validate(arg, configuration)); } @Override - public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AdditionalProperties2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2188,7 +2187,7 @@ public ObjectItemsNullableMap getNewInstance(Map arg, List pathToI for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2196,12 +2195,12 @@ public ObjectItemsNullableMap getNewInstance(Map arg, List pathToI Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance == null || propertyInstance instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable FrozenMap) propertyInstance); } @@ -2209,7 +2208,7 @@ public ObjectItemsNullableMap getNewInstance(Map arg, List pathToI return new ObjectItemsNullableMap(castProperties); } - public ObjectItemsNullableMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectItemsNullableMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2221,29 +2220,29 @@ public ObjectItemsNullableMap validate(Map arg, SchemaConfiguration config @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectItemsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectItemsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectItemsNullableBoxedMap(validate(arg, configuration)); } @Override - public ObjectItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectItemsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -2276,7 +2275,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for integer_prop"); + throw new RuntimeException("Invalid value stored for integer_prop"); } return (@Nullable Number) value; } @@ -2286,7 +2285,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for number_prop"); + throw new RuntimeException("Invalid value stored for number_prop"); } return (@Nullable Number) value; } @@ -2296,7 +2295,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for boolean_prop"); + throw new RuntimeException("Invalid value stored for boolean_prop"); } return (@Nullable Boolean) value; } @@ -2306,7 +2305,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for string_prop"); + throw new RuntimeException("Invalid value stored for string_prop"); } return (@Nullable String) value; } @@ -2316,7 +2315,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for date_prop"); + throw new RuntimeException("Invalid value stored for date_prop"); } return (@Nullable String) value; } @@ -2326,7 +2325,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for datetime_prop"); + throw new RuntimeException("Invalid value stored for datetime_prop"); } return (@Nullable String) value; } @@ -2336,7 +2335,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ArrayNullablePropList)) { - throw new InvalidTypeException("Invalid value stored for array_nullable_prop"); + throw new RuntimeException("Invalid value stored for array_nullable_prop"); } return (@Nullable ArrayNullablePropList) value; } @@ -2346,7 +2345,7 @@ public static NullableClassMap of(Map arg, S throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ArrayAndItemsNullablePropList)) { - throw new InvalidTypeException("Invalid value stored for array_and_items_nullable_prop"); + throw new RuntimeException("Invalid value stored for array_and_items_nullable_prop"); } return (@Nullable ArrayAndItemsNullablePropList) value; } @@ -2356,7 +2355,7 @@ public ArrayItemsNullableList array_items_nullable() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ArrayItemsNullableList)) { - throw new InvalidTypeException("Invalid value stored for array_items_nullable"); + throw new RuntimeException("Invalid value stored for array_items_nullable"); } return (ArrayItemsNullableList) value; } @@ -2366,7 +2365,7 @@ public ArrayItemsNullableList array_items_nullable() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ObjectNullablePropMap)) { - throw new InvalidTypeException("Invalid value stored for object_nullable_prop"); + throw new RuntimeException("Invalid value stored for object_nullable_prop"); } return (@Nullable ObjectNullablePropMap) value; } @@ -2376,7 +2375,7 @@ public ArrayItemsNullableList array_items_nullable() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof ObjectAndItemsNullablePropMap)) { - throw new InvalidTypeException("Invalid value stored for object_and_items_nullable_prop"); + throw new RuntimeException("Invalid value stored for object_and_items_nullable_prop"); } return (@Nullable ObjectAndItemsNullablePropMap) value; } @@ -2386,7 +2385,7 @@ public ObjectItemsNullableMap object_items_nullable() throws UnsetPropertyExcept throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ObjectItemsNullableMap)) { - throw new InvalidTypeException("Invalid value stored for object_items_nullable"); + throw new RuntimeException("Invalid value stored for object_items_nullable"); } return (ObjectItemsNullableMap) value; } @@ -2395,7 +2394,7 @@ public ObjectItemsNullableMap object_items_nullable() throws UnsetPropertyExcept throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value == null || value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (@Nullable FrozenMap) value; } @@ -2773,7 +2772,7 @@ public NullableClassMap getNewInstance(Map arg, List pathToItem, P for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -2781,12 +2780,12 @@ public NullableClassMap getNewInstance(Map arg, List pathToItem, P Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance == null || propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable Object) propertyInstance); } @@ -2794,7 +2793,7 @@ public NullableClassMap getNewInstance(Map arg, List pathToItem, P return new NullableClassMap(castProperties); } - public NullableClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableClassMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -2806,29 +2805,29 @@ public NullableClassMap validate(Map arg, SchemaConfiguration configuratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableClass1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NullableClass1BoxedMap(validate(arg, configuration)); } @Override - public NullableClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java index 4a127d0c38e..a182ebc1218 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableShape.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -123,7 +122,7 @@ public static NullableShape1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,7 +134,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -147,7 +146,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -158,24 +157,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,7 +206,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -252,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -264,7 +263,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -279,10 +278,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -297,34 +296,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableShape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedVoid(validate(arg, configuration)); } @Override - public NullableShape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedBoolean(validate(arg, configuration)); } @Override - public NullableShape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedNumber(validate(arg, configuration)); } @Override - public NullableShape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedString(validate(arg, configuration)); } @Override - public NullableShape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedList(validate(arg, configuration)); } @Override - public NullableShape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NullableShape1BoxedMap(validate(arg, configuration)); } @Override - public NullableShape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableShape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -340,7 +339,7 @@ public NullableShape1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurat } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java index d52f8c2d9bb..82eff01189c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NullableString.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -89,40 +88,40 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NullableString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableString1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NullableString1BoxedVoid(validate(arg, configuration)); } @Override - public NullableString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NullableString1BoxedString(validate(arg, configuration)); } @Override - public NullableString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullableString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java index 2aec9f86eb4..40f333f0b3d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberOnly.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ public Number JustNumber() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for JustNumber"); + throw new RuntimeException("Invalid value stored for JustNumber"); } return (Number) value; } @@ -166,7 +165,7 @@ public NumberOnlyMap getNewInstance(Map arg, List pathToItem, Path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -174,7 +173,7 @@ public NumberOnlyMap getNewInstance(Map arg, List pathToItem, Path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -184,7 +183,7 @@ public NumberOnlyMap getNewInstance(Map arg, List pathToItem, Path return new NumberOnlyMap(castProperties); } - public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -196,29 +195,29 @@ public NumberOnlyMap validate(Map arg, SchemaConfiguration configuration) @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberOnly1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NumberOnly1BoxedMap(validate(arg, configuration)); } @Override - public NumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberOnly1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java index d839b2752c8..b07cf3e7b49 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithExclusiveMinMax.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -89,29 +88,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberWithExclusiveMinMax1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberWithExclusiveMinMax1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberWithExclusiveMinMax1BoxedNumber(validate(arg, configuration)); } @Override - public NumberWithExclusiveMinMax1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberWithExclusiveMinMax1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java index b859f61f42c..cf0349c6748 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/NumberWithValidations.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -89,29 +88,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public NumberWithValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberWithValidations1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberWithValidations1BoxedNumber(validate(arg, configuration)); } @Override - public NumberWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java index 7440322d228..c3d1cef070f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -55,7 +54,7 @@ public static ObjWithRequiredPropsMap of(Map public String a() { @Nullable Object value = get("a"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for a"); + throw new RuntimeException("Invalid value stored for a"); } return (String) value; } @@ -162,7 +161,7 @@ public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathTo for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -170,7 +169,7 @@ public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathTo Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -180,7 +179,7 @@ public ObjWithRequiredPropsMap getNewInstance(Map arg, List pathTo return new ObjWithRequiredPropsMap(castProperties); } - public ObjWithRequiredPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -192,29 +191,29 @@ public ObjWithRequiredPropsMap validate(Map arg, SchemaConfiguration confi @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjWithRequiredProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjWithRequiredProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjWithRequiredProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java index 8d1712ddba9..721ccab7180 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjWithRequiredPropsBase.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -55,7 +54,7 @@ public static ObjWithRequiredPropsBaseMap of(Map arg, List pa for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -167,7 +166,7 @@ public ObjWithRequiredPropsBaseMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -177,7 +176,7 @@ public ObjWithRequiredPropsBaseMap getNewInstance(Map arg, List pa return new ObjWithRequiredPropsBaseMap(castProperties); } - public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -189,29 +188,29 @@ public ObjWithRequiredPropsBaseMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjWithRequiredPropsBase1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredPropsBase1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjWithRequiredPropsBase1BoxedMap(validate(arg, configuration)); } @Override - public ObjWithRequiredPropsBase1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjWithRequiredPropsBase1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java index 2b92bc15f29..8709961bd10 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithArgAndArgsProperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -67,7 +66,7 @@ public static ObjectModelWithArgAndArgsPropertiesMap of(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -230,7 +229,7 @@ public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -240,7 +239,7 @@ public ObjectModelWithArgAndArgsPropertiesMap getNewInstance(Map arg, List return new ObjectModelWithArgAndArgsPropertiesMap(castProperties); } - public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -252,29 +251,29 @@ public ObjectModelWithArgAndArgsPropertiesMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectModelWithArgAndArgsProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithArgAndArgsProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectModelWithArgAndArgsProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectModelWithArgAndArgsProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithArgAndArgsProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java index 46d4dd148c3..8e8d69563b7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectModelWithRefProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -47,7 +46,7 @@ public Number myNumber() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for myNumber"); + throw new RuntimeException("Invalid value stored for myNumber"); } return (Number) value; } @@ -57,7 +56,7 @@ public String myString() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for myString"); + throw new RuntimeException("Invalid value stored for myString"); } return (String) value; } @@ -67,7 +66,7 @@ public boolean myBoolean() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for myBoolean"); + throw new RuntimeException("Invalid value stored for myBoolean"); } return (boolean) value; } @@ -210,7 +209,7 @@ public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,7 +217,7 @@ public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -228,7 +227,7 @@ public ObjectModelWithRefPropsMap getNewInstance(Map arg, List pat return new ObjectModelWithRefPropsMap(castProperties); } - public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,29 +239,29 @@ public ObjectModelWithRefPropsMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectModelWithRefProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithRefProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectModelWithRefProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjectModelWithRefProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectModelWithRefProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java index 83ae5af726f..e9986ba7011 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithAllOfWithReqTestPropFromUnsetAddProp.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -64,7 +63,11 @@ public static Schema1Map of(Map arg, SchemaC } public @Nullable Object test() { - return getOrThrow("test"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public String name() throws UnsetPropertyException { @@ -72,7 +75,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (String) value; } @@ -233,7 +236,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -241,7 +244,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -251,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -263,29 +266,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -363,7 +366,7 @@ public static ObjectWithAllOfWithReqTestPropFromUnsetAddProp1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -375,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -387,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -398,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -447,7 +450,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -474,7 +477,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -482,7 +485,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -492,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -504,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -519,10 +522,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -537,34 +540,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedVoid(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedBoolean(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedNumber(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedString(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedList(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAllOfWithReqTestPropFromUnsetAddProp1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -580,7 +583,7 @@ public ObjectWithAllOfWithReqTestPropFromUnsetAddProp1Boxed validateAndBox(@Null } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java index 0b16a14b9db..0b6133faf4b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithCollidingProperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -69,7 +68,7 @@ public FrozenMap someProp() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for someProp"); + throw new RuntimeException("Invalid value stored for someProp"); } return (FrozenMap) value; } @@ -79,7 +78,7 @@ public FrozenMap someprop() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for someprop"); + throw new RuntimeException("Invalid value stored for someprop"); } return (FrozenMap) value; } @@ -188,7 +187,7 @@ public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -196,7 +195,7 @@ public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -206,7 +205,7 @@ public ObjectWithCollidingPropertiesMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithCollidingPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,29 +217,29 @@ public ObjectWithCollidingPropertiesMap validate(Map arg, SchemaConfigurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithCollidingProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithCollidingProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithCollidingProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithCollidingProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithCollidingProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java index fe684c55bfe..6581484c416 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDecimalProperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DecimalJsonSchema; @@ -59,7 +58,7 @@ public String length() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for length"); + throw new RuntimeException("Invalid value stored for length"); } return (String) value; } @@ -69,7 +68,7 @@ public String width() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for width"); + throw new RuntimeException("Invalid value stored for width"); } return (String) value; } @@ -79,7 +78,7 @@ public Money.MoneyMap cost() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Money.MoneyMap)) { - throw new InvalidTypeException("Invalid value stored for cost"); + throw new RuntimeException("Invalid value stored for cost"); } return (Money.MoneyMap) value; } @@ -202,7 +201,7 @@ public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -210,7 +209,7 @@ public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -220,7 +219,7 @@ public ObjectWithDecimalPropertiesMap getNewInstance(Map arg, List return new ObjectWithDecimalPropertiesMap(castProperties); } - public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -232,29 +231,29 @@ public ObjectWithDecimalPropertiesMap validate(Map arg, SchemaConfiguratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithDecimalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDecimalProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithDecimalProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithDecimalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDecimalProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java index de3ef5c0fd5..9eaf1306f8d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithDifficultlyNamedProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -248,7 +247,7 @@ public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -256,7 +255,7 @@ public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -266,7 +265,7 @@ public ObjectWithDifficultlyNamedPropsMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDifficultlyNamedPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -278,29 +277,29 @@ public ObjectWithDifficultlyNamedPropsMap validate(Map arg, SchemaConfigur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithDifficultlyNamedProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDifficultlyNamedProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithDifficultlyNamedProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithDifficultlyNamedProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithDifficultlyNamedProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java index e5dd13be7c0..c88a642a47a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInlineCompositionProperty.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -81,29 +80,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema0BoxedString(validate(arg, configuration)); } @Override - public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -173,7 +172,7 @@ public static SomeProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,7 +184,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,24 +207,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -257,7 +256,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -284,7 +283,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -292,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -302,7 +301,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -329,10 +328,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -347,34 +346,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedVoid(validate(arg, configuration)); } @Override - public SomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedBoolean(validate(arg, configuration)); } @Override - public SomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedNumber(validate(arg, configuration)); } @Override - public SomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedString(validate(arg, configuration)); } @Override - public SomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedList(validate(arg, configuration)); } @Override - public SomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SomePropBoxedMap(validate(arg, configuration)); } @Override - public SomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -390,7 +389,7 @@ public SomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -544,7 +543,7 @@ public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -552,7 +551,7 @@ public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -562,7 +561,7 @@ public ObjectWithInlineCompositionPropertyMap getNewInstance(Map arg, List return new ObjectWithInlineCompositionPropertyMap(castProperties); } - public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -574,29 +573,29 @@ public ObjectWithInlineCompositionPropertyMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithInlineCompositionProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInlineCompositionProperty1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithInlineCompositionProperty1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithInlineCompositionProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInlineCompositionProperty1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java index 6503902e3e9..bb4e4b05c6d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithInvalidNamedRefedProperties.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -44,7 +43,7 @@ public static ObjectWithInvalidNamedRefedPropertiesMap of(Map arg, Li for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -199,7 +198,7 @@ public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(Map arg, Li Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -209,7 +208,7 @@ public ObjectWithInvalidNamedRefedPropertiesMap getNewInstance(Map arg, Li return new ObjectWithInvalidNamedRefedPropertiesMap(castProperties); } - public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -221,29 +220,29 @@ public ObjectWithInvalidNamedRefedPropertiesMap validate(Map arg, SchemaCo @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithInvalidNamedRefedProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInvalidNamedRefedProperties1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithInvalidNamedRefedProperties1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithInvalidNamedRefedProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithInvalidNamedRefedProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java index c27d1e36619..fba62004ad4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithNonIntersectingValues.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -69,7 +68,7 @@ public Number a() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for a"); + throw new RuntimeException("Invalid value stored for a"); } return (Number) value; } @@ -78,7 +77,7 @@ public String getAdditionalProperty(String name) throws UnsetPropertyException, throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (String) value; } @@ -195,7 +194,7 @@ public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -203,12 +202,12 @@ public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } @@ -216,7 +215,7 @@ public ObjectWithNonIntersectingValuesMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNonIntersectingValuesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,29 +227,29 @@ public ObjectWithNonIntersectingValuesMap validate(Map arg, SchemaConfigur @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithNonIntersectingValues1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNonIntersectingValues1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithNonIntersectingValues1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithNonIntersectingValues1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNonIntersectingValues1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java index 5f76e1a3b33..d8b8726ab28 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOnlyOptionalProps.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -83,7 +82,7 @@ public String a() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for a"); + throw new RuntimeException("Invalid value stored for a"); } return (String) value; } @@ -93,7 +92,7 @@ public Number b() throws UnsetPropertyException { throwIfKeyNotPresent(key); Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for b"); + throw new RuntimeException("Invalid value stored for b"); } return (Number) value; } @@ -210,7 +209,7 @@ public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -218,12 +217,12 @@ public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } @@ -231,7 +230,7 @@ public ObjectWithOnlyOptionalPropsMap getNewInstance(Map arg, List return new ObjectWithOnlyOptionalPropsMap(castProperties); } - public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,29 +242,29 @@ public ObjectWithOnlyOptionalPropsMap validate(Map arg, SchemaConfiguratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithOnlyOptionalProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOnlyOptionalProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithOnlyOptionalProps1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithOnlyOptionalProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOnlyOptionalProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java index 224aad5414a..fedaf9d618a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithOptionalTestProp.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ public String test() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for test"); + throw new RuntimeException("Invalid value stored for test"); } return (String) value; } @@ -148,7 +147,7 @@ public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -156,7 +155,7 @@ public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -166,7 +165,7 @@ public ObjectWithOptionalTestPropMap getNewInstance(Map arg, List return new ObjectWithOptionalTestPropMap(castProperties); } - public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -178,29 +177,29 @@ public ObjectWithOptionalTestPropMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithOptionalTestProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOptionalTestProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithOptionalTestProp1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithOptionalTestProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOptionalTestProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java index 55808b655b4..bc80404533f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ObjectWithValidations.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -66,7 +65,7 @@ public static ObjectWithValidations1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -74,7 +73,7 @@ public static ObjectWithValidations1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -84,7 +83,7 @@ public static ObjectWithValidations1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -96,29 +95,29 @@ public static ObjectWithValidations1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithValidations1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithValidations1BoxedMap(validate(arg, configuration)); } @Override - public ObjectWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithValidations1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java index de3df444595..095cd4d6adb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Order.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -147,29 +146,29 @@ public String validate(StringStatusEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StatusBoxedString(validate(arg, configuration)); } @Override - public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -206,7 +205,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for id"); + throw new RuntimeException("Invalid value stored for id"); } return (Number) value; } @@ -216,7 +215,7 @@ public Number petId() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for petId"); + throw new RuntimeException("Invalid value stored for petId"); } return (Number) value; } @@ -226,7 +225,7 @@ public Number quantity() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for quantity"); + throw new RuntimeException("Invalid value stored for quantity"); } return (Number) value; } @@ -236,7 +235,7 @@ public String shipDate() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for shipDate"); + throw new RuntimeException("Invalid value stored for shipDate"); } return (String) value; } @@ -246,7 +245,7 @@ public String status() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for status"); + throw new RuntimeException("Invalid value stored for status"); } return (String) value; } @@ -256,7 +255,7 @@ public boolean complete() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for complete"); + throw new RuntimeException("Invalid value stored for complete"); } return (boolean) value; } @@ -475,7 +474,7 @@ public OrderMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -483,7 +482,7 @@ public OrderMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -493,7 +492,7 @@ public OrderMap getNewInstance(Map arg, List pathToItem, PathToSch return new OrderMap(castProperties); } - public OrderMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public OrderMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -505,29 +504,29 @@ public OrderMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Order1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Order1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Order1BoxedMap(validate(arg, configuration)); } @Override - public Order1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Order1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java index 7341ce01c3f..4029137d41a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PaginatedResultMyObjectDto.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -126,12 +125,12 @@ public ResultsList getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof MyObjectDto.MyObjectDtoMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((MyObjectDto.MyObjectDtoMap) itemInstance); i += 1; @@ -151,29 +150,29 @@ public ResultsList validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ResultsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ResultsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ResultsBoxedList(validate(arg, configuration)); } @Override - public ResultsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ResultsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -193,7 +192,7 @@ public static PaginatedResultMyObjectDtoMap of(Map arg, SchemaCo public Number count() { Object value = get("count"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for count"); + throw new RuntimeException("Invalid value stored for count"); } return (Number) value; } @@ -201,7 +200,7 @@ public Number count() { public ResultsList results() { Object value = get("results"); if (!(value instanceof ResultsList)) { - throw new InvalidTypeException("Invalid value stored for results"); + throw new RuntimeException("Invalid value stored for results"); } return (ResultsList) value; } @@ -355,7 +354,7 @@ public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -363,12 +362,12 @@ public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Object) propertyInstance); } @@ -376,7 +375,7 @@ public PaginatedResultMyObjectDtoMap getNewInstance(Map arg, List return new PaginatedResultMyObjectDtoMap(castProperties); } - public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -388,29 +387,29 @@ public PaginatedResultMyObjectDtoMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PaginatedResultMyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PaginatedResultMyObjectDto1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PaginatedResultMyObjectDto1BoxedMap(validate(arg, configuration)); } @Override - public PaginatedResultMyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PaginatedResultMyObjectDto1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java index d9acac7bd8a..891f53e085b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ParentPet.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -68,7 +67,7 @@ public static ParentPet1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -76,7 +75,7 @@ public static ParentPet1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -86,7 +85,7 @@ public static ParentPet1 getInstance() { return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,29 +97,29 @@ public static ParentPet1 getInstance() { @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ParentPet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ParentPet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ParentPet1BoxedMap(validate(arg, configuration)); } @Override - public ParentPet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ParentPet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java index 22e72fa1bb5..6e0157524b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pet.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -140,12 +139,12 @@ public PhotoUrlsList getNewInstance(List arg, List pathToItem, PathTo itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -165,29 +164,29 @@ public PhotoUrlsList validate(List arg, SchemaConfiguration configuration) th } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PhotoUrlsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PhotoUrlsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new PhotoUrlsBoxedList(validate(arg, configuration)); } @Override - public PhotoUrlsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PhotoUrlsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringStatusEnums implements StringValueMethod { @@ -258,29 +257,29 @@ public String validate(StringStatusEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StatusBoxedString(validate(arg, configuration)); } @Override - public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -355,12 +354,12 @@ public TagsList getNewInstance(List arg, List pathToItem, PathToSchem itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof Tag.TagMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((Tag.TagMap) itemInstance); i += 1; @@ -380,29 +379,29 @@ public TagsList validate(List arg, SchemaConfiguration configuration) throws } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TagsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TagsBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new TagsBoxedList(validate(arg, configuration)); } @Override - public TagsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TagsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -427,7 +426,7 @@ public static PetMap of(Map arg, SchemaConfi public String name() { @Nullable Object value = get("name"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (String) value; } @@ -435,7 +434,7 @@ public String name() { public PhotoUrlsList photoUrls() { @Nullable Object value = get("photoUrls"); if (!(value instanceof PhotoUrlsList)) { - throw new InvalidTypeException("Invalid value stored for photoUrls"); + throw new RuntimeException("Invalid value stored for photoUrls"); } return (PhotoUrlsList) value; } @@ -445,7 +444,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for id"); + throw new RuntimeException("Invalid value stored for id"); } return (Number) value; } @@ -455,7 +454,7 @@ public Category.CategoryMap category() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Category.CategoryMap)) { - throw new InvalidTypeException("Invalid value stored for category"); + throw new RuntimeException("Invalid value stored for category"); } return (Category.CategoryMap) value; } @@ -465,7 +464,7 @@ public TagsList tags() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof TagsList)) { - throw new InvalidTypeException("Invalid value stored for tags"); + throw new RuntimeException("Invalid value stored for tags"); } return (TagsList) value; } @@ -475,7 +474,7 @@ public String status() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for status"); + throw new RuntimeException("Invalid value stored for status"); } return (String) value; } @@ -712,7 +711,7 @@ public PetMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -720,7 +719,7 @@ public PetMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -730,7 +729,7 @@ public PetMap getNewInstance(Map arg, List pathToItem, PathToSchem return new PetMap(castProperties); } - public PetMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PetMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -742,29 +741,29 @@ public PetMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Pet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pet1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Pet1BoxedMap(validate(arg, configuration)); } @Override - public Pet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java index 9a385a57d58..68fab7484ef 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Pig.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +107,7 @@ public static Pig1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +119,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +142,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -192,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -237,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +248,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,10 +263,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,34 +281,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Pig1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedVoid(validate(arg, configuration)); } @Override - public Pig1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedBoolean(validate(arg, configuration)); } @Override - public Pig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedNumber(validate(arg, configuration)); } @Override - public Pig1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedString(validate(arg, configuration)); } @Override - public Pig1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedList(validate(arg, configuration)); } @Override - public Pig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Pig1BoxedMap(validate(arg, configuration)); } @Override - public Pig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Pig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +324,7 @@ public Pig1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration config } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java index e0555909702..3908dffc525 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Player.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -58,7 +57,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (String) value; } @@ -68,7 +67,7 @@ public PlayerMap enemyPlayer() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof PlayerMap)) { - throw new InvalidTypeException("Invalid value stored for enemyPlayer"); + throw new RuntimeException("Invalid value stored for enemyPlayer"); } return (PlayerMap) value; } @@ -177,7 +176,7 @@ public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -185,7 +184,7 @@ public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -195,7 +194,7 @@ public PlayerMap getNewInstance(Map arg, List pathToItem, PathToSc return new PlayerMap(castProperties); } - public PlayerMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PlayerMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,29 +206,29 @@ public PlayerMap validate(Map arg, SchemaConfiguration configuration) thro @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Player1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Player1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Player1BoxedMap(validate(arg, configuration)); } @Override - public Player1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Player1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java index 6e03a2081a6..12a5cb206e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/PublicKey.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ public String key() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for key"); + throw new RuntimeException("Invalid value stored for key"); } return (String) value; } @@ -150,7 +149,7 @@ public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,7 +157,7 @@ public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -168,7 +167,7 @@ public PublicKeyMap getNewInstance(Map arg, List pathToItem, PathT return new PublicKeyMap(castProperties); } - public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,29 +179,29 @@ public PublicKeyMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PublicKey1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PublicKey1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PublicKey1BoxedMap(validate(arg, configuration)); } @Override - public PublicKey1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PublicKey1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java index eb0913bb7b3..c46fd11c75b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Quadrilateral.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +107,7 @@ public static Quadrilateral1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +119,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +142,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -192,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -237,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +248,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,10 +263,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,34 +281,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Quadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedVoid(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedBoolean(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedNumber(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedString(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedList(validate(arg, configuration)); } @Override - public Quadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Quadrilateral1BoxedMap(validate(arg, configuration)); } @Override - public Quadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Quadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +324,7 @@ public Quadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurat } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java index a78c73750d0..2f2db60c5e5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/QuadrilateralInterface.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -104,29 +103,29 @@ public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeTypeBoxedString(validate(arg, configuration)); } @Override - public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -157,7 +156,7 @@ public static QuadrilateralInterfaceMap of(Map> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -360,7 +359,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -372,7 +371,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -383,24 +382,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -432,7 +431,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -459,7 +458,7 @@ public QuadrilateralInterfaceMap getNewInstance(Map arg, List path for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -467,7 +466,7 @@ public QuadrilateralInterfaceMap getNewInstance(Map arg, List path Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -477,7 +476,7 @@ public QuadrilateralInterfaceMap getNewInstance(Map arg, List path return new QuadrilateralInterfaceMap(castProperties); } - public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -489,7 +488,7 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration con } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -504,10 +503,10 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -522,34 +521,34 @@ public QuadrilateralInterfaceMap validate(Map arg, SchemaConfiguration con } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QuadrilateralInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedVoid(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedBoolean(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedNumber(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedString(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedList(validate(arg, configuration)); } @Override - public QuadrilateralInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralInterface1BoxedMap(validate(arg, configuration)); } @Override - public QuadrilateralInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -565,7 +564,7 @@ public QuadrilateralInterface1Boxed validateAndBox(@Nullable Object arg, SchemaC } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java index 68e6ae7401f..6e3420867ce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReadOnlyFirst.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -69,7 +68,7 @@ public String bar() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for bar"); + throw new RuntimeException("Invalid value stored for bar"); } return (String) value; } @@ -79,7 +78,7 @@ public String baz() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for baz"); + throw new RuntimeException("Invalid value stored for baz"); } return (String) value; } @@ -186,7 +185,7 @@ public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, P for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -194,7 +193,7 @@ public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, P Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -204,7 +203,7 @@ public ReadOnlyFirstMap getNewInstance(Map arg, List pathToItem, P return new ReadOnlyFirstMap(castProperties); } - public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -216,29 +215,29 @@ public ReadOnlyFirstMap validate(Map arg, SchemaConfiguration configuratio @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReadOnlyFirst1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReadOnlyFirst1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ReadOnlyFirst1BoxedMap(validate(arg, configuration)); } @Override - public ReadOnlyFirst1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReadOnlyFirst1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java index 81d5e0b308c..0e8d8c58426 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromExplicitAddProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -53,7 +52,11 @@ public static ReqPropsFromExplicitAddPropsMap of(Map arg, Schema } public String validName() { - return getOrThrow("validName"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } public String getAdditionalProperty(String name) throws UnsetPropertyException, InvalidAdditionalPropertyException { @@ -207,7 +210,7 @@ public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -215,12 +218,12 @@ public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -228,7 +231,7 @@ public ReqPropsFromExplicitAddPropsMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromExplicitAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -240,29 +243,29 @@ public ReqPropsFromExplicitAddPropsMap validate(Map arg, SchemaConfigurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReqPropsFromExplicitAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromExplicitAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ReqPropsFromExplicitAddProps1BoxedMap(validate(arg, configuration)); } @Override - public ReqPropsFromExplicitAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromExplicitAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java index 403e71edb6c..88595c25790 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromTrueAddProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -53,7 +52,11 @@ public static ReqPropsFromTrueAddPropsMap of(Map arg, List pa for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -367,7 +370,7 @@ public ReqPropsFromTrueAddPropsMap getNewInstance(Map arg, List pa Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -377,7 +380,7 @@ public ReqPropsFromTrueAddPropsMap getNewInstance(Map arg, List pa return new ReqPropsFromTrueAddPropsMap(castProperties); } - public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -389,29 +392,29 @@ public ReqPropsFromTrueAddPropsMap validate(Map arg, SchemaConfiguration c @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReqPropsFromTrueAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromTrueAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ReqPropsFromTrueAddProps1BoxedMap(validate(arg, configuration)); } @Override - public ReqPropsFromTrueAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromTrueAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java index e35c0546b48..26a7234885a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReqPropsFromUnsetAddProps.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -41,7 +40,11 @@ public static ReqPropsFromUnsetAddPropsMap of(Map arg, List p for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -286,7 +289,7 @@ public ReqPropsFromUnsetAddPropsMap getNewInstance(Map arg, List p Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -296,7 +299,7 @@ public ReqPropsFromUnsetAddPropsMap getNewInstance(Map arg, List p return new ReqPropsFromUnsetAddPropsMap(castProperties); } - public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -308,29 +311,29 @@ public ReqPropsFromUnsetAddPropsMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReqPropsFromUnsetAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromUnsetAddProps1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ReqPropsFromUnsetAddProps1BoxedMap(validate(arg, configuration)); } @Override - public ReqPropsFromUnsetAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReqPropsFromUnsetAddProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java index cde9348b342..e09c2c586b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ReturnSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -185,7 +184,7 @@ public static ReturnSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -209,7 +208,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -220,24 +219,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -269,7 +268,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -296,7 +295,7 @@ public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSc for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -304,7 +303,7 @@ public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSc Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -314,7 +313,7 @@ public ReturnMap getNewInstance(Map arg, List pathToItem, PathToSc return new ReturnMap(castProperties); } - public ReturnMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -326,7 +325,7 @@ public ReturnMap validate(Map arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -341,10 +340,10 @@ public ReturnMap validate(Map arg, SchemaConfiguration configuration) thro } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -359,34 +358,34 @@ public ReturnMap validate(Map arg, SchemaConfiguration configuration) thro } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ReturnSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedVoid(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedNumber(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedString(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedList(validate(arg, configuration)); } @Override - public ReturnSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ReturnSchema1BoxedMap(validate(arg, configuration)); } @Override - public ReturnSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ReturnSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -402,7 +401,7 @@ public ReturnSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfigurati } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java index a3a51048188..3a6e545b3a1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ScaleneTriangle.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -103,29 +102,29 @@ public String validate(StringTriangleTypeEnums arg,SchemaConfiguration configura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleTypeBoxedString(validate(arg, configuration)); } @Override - public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -146,7 +145,7 @@ public String triangleType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for triangleType"); + throw new RuntimeException("Invalid value stored for triangleType"); } return (String) value; } @@ -237,7 +236,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -245,7 +244,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -255,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,29 +266,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -367,7 +366,7 @@ public static ScaleneTriangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -391,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -451,7 +450,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -478,7 +477,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -486,7 +485,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -508,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -523,10 +522,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -541,34 +540,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ScaleneTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedVoid(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedBoolean(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedNumber(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedString(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedList(validate(arg, configuration)); } @Override - public ScaleneTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ScaleneTriangle1BoxedMap(validate(arg, configuration)); } @Override - public ScaleneTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ScaleneTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -584,7 +583,7 @@ public ScaleneTriangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfigur } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java index 4ef90595cef..ddd41386c39 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Schema200Response.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -79,7 +78,7 @@ public Number name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (Number) value; } @@ -224,7 +223,7 @@ public static Schema200Response1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -236,7 +235,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +247,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -259,24 +258,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -308,7 +307,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -335,7 +334,7 @@ public Schema200ResponseMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -343,7 +342,7 @@ public Schema200ResponseMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -353,7 +352,7 @@ public Schema200ResponseMap getNewInstance(Map arg, List pathToIte return new Schema200ResponseMap(castProperties); } - public Schema200ResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200ResponseMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -365,7 +364,7 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -380,10 +379,10 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -398,34 +397,34 @@ public Schema200ResponseMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema200Response1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedVoid(validate(arg, configuration)); } @Override - public Schema200Response1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedBoolean(validate(arg, configuration)); } @Override - public Schema200Response1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedNumber(validate(arg, configuration)); } @Override - public Schema200Response1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedString(validate(arg, configuration)); } @Override - public Schema200Response1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedList(validate(arg, configuration)); } @Override - public Schema200Response1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema200Response1BoxedMap(validate(arg, configuration)); } @Override - public Schema200Response1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema200Response1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -441,7 +440,7 @@ public Schema200Response1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java index 391c432945d..4b3d12e860b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingArrayModel.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -100,12 +99,12 @@ public SelfReferencingArrayModelList getNewInstance(List arg, List pa itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof SelfReferencingArrayModelList)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((SelfReferencingArrayModelList) itemInstance); i += 1; @@ -125,29 +124,29 @@ public SelfReferencingArrayModelList validate(List arg, SchemaConfiguration c } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SelfReferencingArrayModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SelfReferencingArrayModel1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new SelfReferencingArrayModel1BoxedList(validate(arg, configuration)); } @Override - public SelfReferencingArrayModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SelfReferencingArrayModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java index 06512cff6c2..cf46cae884b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SelfReferencingObjectModel.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -45,7 +44,7 @@ public SelfReferencingObjectModelMap selfRef() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof SelfReferencingObjectModelMap)) { - throw new InvalidTypeException("Invalid value stored for selfRef"); + throw new RuntimeException("Invalid value stored for selfRef"); } return (SelfReferencingObjectModelMap) value; } @@ -54,7 +53,7 @@ public SelfReferencingObjectModelMap getAdditionalProperty(String name) throws U throwIfKeyKnown(name, requiredKeys, optionalKeys); var value = getOrThrow(name); if (!(value instanceof SelfReferencingObjectModelMap)) { - throw new InvalidTypeException("Invalid value stored for " + name); + throw new RuntimeException("Invalid value stored for " + name); } return (SelfReferencingObjectModelMap) value; } @@ -153,7 +152,7 @@ public SelfReferencingObjectModelMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -161,7 +160,7 @@ public SelfReferencingObjectModelMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -171,7 +170,7 @@ public SelfReferencingObjectModelMap getNewInstance(Map arg, List return new SelfReferencingObjectModelMap(castProperties); } - public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,29 +182,29 @@ public SelfReferencingObjectModelMap validate(Map arg, SchemaConfiguration @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SelfReferencingObjectModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SelfReferencingObjectModel1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SelfReferencingObjectModel1BoxedMap(validate(arg, configuration)); } @Override - public SelfReferencingObjectModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SelfReferencingObjectModel1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java index 42a01a295f5..707b7d06ec3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Shape.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -108,7 +107,7 @@ public static Shape1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -120,7 +119,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -132,7 +131,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -143,24 +142,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -192,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -219,7 +218,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -227,7 +226,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -237,7 +236,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -249,7 +248,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -264,10 +263,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -282,34 +281,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Shape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedVoid(validate(arg, configuration)); } @Override - public Shape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedBoolean(validate(arg, configuration)); } @Override - public Shape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedNumber(validate(arg, configuration)); } @Override - public Shape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedString(validate(arg, configuration)); } @Override - public Shape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedList(validate(arg, configuration)); } @Override - public Shape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Shape1BoxedMap(validate(arg, configuration)); } @Override - public Shape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Shape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -325,7 +324,7 @@ public Shape1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration conf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java index f2ee34e6eee..de5a61a3518 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ShapeOrNull.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -123,7 +122,7 @@ public static ShapeOrNull1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -135,7 +134,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -147,7 +146,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -158,24 +157,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -207,7 +206,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -242,7 +241,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -252,7 +251,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -264,7 +263,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -279,10 +278,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -297,34 +296,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapeOrNull1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedVoid(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedBoolean(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedNumber(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedString(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedList(validate(arg, configuration)); } @Override - public ShapeOrNull1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeOrNull1BoxedMap(validate(arg, configuration)); } @Override - public ShapeOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -340,7 +339,7 @@ public ShapeOrNull1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguratio } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java index e003d011a1f..21e800bc477 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SimpleQuadrilateral.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -103,29 +102,29 @@ public String validate(StringQuadrilateralTypeEnums arg,SchemaConfiguration conf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new QuadrilateralTypeBoxedString(validate(arg, configuration)); } @Override - public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QuadrilateralTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -146,7 +145,7 @@ public String quadrilateralType() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for quadrilateralType"); + throw new RuntimeException("Invalid value stored for quadrilateralType"); } return (String) value; } @@ -237,7 +236,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -245,7 +244,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -255,7 +254,7 @@ public Schema1Map getNewInstance(Map arg, List pathToItem, PathToS return new Schema1Map(castProperties); } - public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Map validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -267,29 +266,29 @@ public Schema1Map validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema1BoxedMap(validate(arg, configuration)); } @Override - public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -367,7 +366,7 @@ public static SimpleQuadrilateral1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -379,7 +378,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -391,7 +390,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -402,24 +401,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -451,7 +450,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -478,7 +477,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -486,7 +485,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -496,7 +495,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -508,7 +507,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -523,10 +522,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -541,34 +540,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SimpleQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedVoid(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedBoolean(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedNumber(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedString(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedList(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SimpleQuadrilateral1BoxedMap(validate(arg, configuration)); } @Override - public SimpleQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SimpleQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -584,7 +583,7 @@ public SimpleQuadrilateral1Boxed validateAndBox(@Nullable Object arg, SchemaConf } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java index f2be945112a..8718a67dee6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SomeObject.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -107,7 +106,7 @@ public static SomeObject1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -119,7 +118,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -131,7 +130,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -142,24 +141,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,7 +190,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -218,7 +217,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -226,7 +225,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -236,7 +235,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -248,7 +247,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -263,10 +262,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -281,34 +280,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SomeObject1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedVoid(validate(arg, configuration)); } @Override - public SomeObject1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedBoolean(validate(arg, configuration)); } @Override - public SomeObject1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedNumber(validate(arg, configuration)); } @Override - public SomeObject1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedString(validate(arg, configuration)); } @Override - public SomeObject1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedList(validate(arg, configuration)); } @Override - public SomeObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SomeObject1BoxedMap(validate(arg, configuration)); } @Override - public SomeObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -324,7 +323,7 @@ public SomeObject1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java index ded331f552f..a215bad464d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/SpecialModelname.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ public String a() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for a"); + throw new RuntimeException("Invalid value stored for a"); } return (String) value; } @@ -150,7 +149,7 @@ public SpecialModelnameMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -158,7 +157,7 @@ public SpecialModelnameMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -168,7 +167,7 @@ public SpecialModelnameMap getNewInstance(Map arg, List pathToItem return new SpecialModelnameMap(castProperties); } - public SpecialModelnameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SpecialModelnameMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -180,29 +179,29 @@ public SpecialModelnameMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SpecialModelname1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SpecialModelname1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SpecialModelname1BoxedMap(validate(arg, configuration)); } @Override - public SpecialModelname1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SpecialModelname1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java index a68c7c2ef85..3cd9d77465b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringBooleanMap.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -53,7 +52,7 @@ public boolean getAdditionalProperty(String name) throws UnsetPropertyException throwIfKeyNotPresent(name); Boolean value = get(name); if (value == null) { - throw new InvalidTypeException("Value may not be null"); + throw new RuntimeException("Value may not be null"); } return (boolean) value; } @@ -133,7 +132,7 @@ public StringBooleanMapMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -141,12 +140,12 @@ public StringBooleanMapMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Boolean)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Boolean) propertyInstance); } @@ -154,7 +153,7 @@ public StringBooleanMapMap getNewInstance(Map arg, List pathToItem return new StringBooleanMapMap(castProperties); } - public StringBooleanMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringBooleanMapMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -166,29 +165,29 @@ public StringBooleanMapMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringBooleanMap1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringBooleanMap1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new StringBooleanMap1BoxedMap(validate(arg, configuration)); } @Override - public StringBooleanMap1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringBooleanMap1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java index 2be475bc0f4..75aa221d691 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnum.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -142,40 +141,40 @@ public String validate(StringStringEnumEnums arg,SchemaConfiguration configurati } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringEnum1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringEnum1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new StringEnum1BoxedVoid(validate(arg, configuration)); } @Override - public StringEnum1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringEnum1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringEnum1BoxedString(validate(arg, configuration)); } @Override - public StringEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringEnum1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java index ea6617a8b7a..995121cb014 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringEnumWithDefaultValue.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -97,35 +96,35 @@ public String validate(StringStringEnumWithDefaultValueEnums arg,SchemaConfigura } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public StringEnumWithDefaultValue1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringEnumWithDefaultValue1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringEnumWithDefaultValue1BoxedString(validate(arg, configuration)); } @Override - public StringEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringEnumWithDefaultValue1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java index c618fe0a225..8cb16f298db 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/StringWithValidation.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -69,29 +68,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public StringWithValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringWithValidation1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringWithValidation1BoxedString(validate(arg, configuration)); } @Override - public StringWithValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringWithValidation1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java index bb7cc4c9bf1..6b1b1a88433 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Tag.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -70,7 +69,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for id"); + throw new RuntimeException("Invalid value stored for id"); } return (Number) value; } @@ -80,7 +79,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (String) value; } @@ -205,7 +204,7 @@ public TagMap getNewInstance(Map arg, List pathToItem, PathToSchem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -213,7 +212,7 @@ public TagMap getNewInstance(Map arg, List pathToItem, PathToSchem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -223,7 +222,7 @@ public TagMap getNewInstance(Map arg, List pathToItem, PathToSchem return new TagMap(castProperties); } - public TagMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TagMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -235,29 +234,29 @@ public TagMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Tag1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Tag1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Tag1BoxedMap(validate(arg, configuration)); } @Override - public Tag1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Tag1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java index 9a6a0546bd6..3bc2f282022 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Triangle.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -109,7 +108,7 @@ public static Triangle1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,7 +120,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -133,7 +132,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -144,24 +143,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -193,7 +192,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -220,7 +219,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -228,7 +227,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -238,7 +237,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -250,7 +249,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -265,10 +264,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -283,34 +282,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Triangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedVoid(validate(arg, configuration)); } @Override - public Triangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedBoolean(validate(arg, configuration)); } @Override - public Triangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedNumber(validate(arg, configuration)); } @Override - public Triangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedString(validate(arg, configuration)); } @Override - public Triangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedList(validate(arg, configuration)); } @Override - public Triangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Triangle1BoxedMap(validate(arg, configuration)); } @Override - public Triangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Triangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -326,7 +325,7 @@ public Triangle1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java index 8e0505b9eb8..56a2cbfeeb5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/TriangleInterface.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -104,29 +103,29 @@ public String validate(StringShapeTypeEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeTypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ShapeTypeBoxedString(validate(arg, configuration)); } @Override - public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ShapeTypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -157,7 +156,7 @@ public static TriangleInterfaceMap of(Map ar public String shapeType() { @Nullable Object value = get("shapeType"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for shapeType"); + throw new RuntimeException("Invalid value stored for shapeType"); } return (String) value; } @@ -165,7 +164,7 @@ public String shapeType() { public String triangleType() { @Nullable Object value = get("triangleType"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for triangleType"); + throw new RuntimeException("Invalid value stored for triangleType"); } return (String) value; } @@ -348,7 +347,7 @@ public static TriangleInterface1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -360,7 +359,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -372,7 +371,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -383,24 +382,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -432,7 +431,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -459,7 +458,7 @@ public TriangleInterfaceMap getNewInstance(Map arg, List pathToIte for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -467,7 +466,7 @@ public TriangleInterfaceMap getNewInstance(Map arg, List pathToIte Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -477,7 +476,7 @@ public TriangleInterfaceMap getNewInstance(Map arg, List pathToIte return new TriangleInterfaceMap(castProperties); } - public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -489,7 +488,7 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configur } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -504,10 +503,10 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -522,34 +521,34 @@ public TriangleInterfaceMap validate(Map arg, SchemaConfiguration configur } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TriangleInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedVoid(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedBoolean(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedNumber(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedString(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedList(validate(arg, configuration)); } @Override - public TriangleInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new TriangleInterface1BoxedMap(validate(arg, configuration)); } @Override - public TriangleInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TriangleInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -565,7 +564,7 @@ public TriangleInterface1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java index 3f8a3975eb4..8455abea757 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/UUIDString.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -71,29 +70,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public UUIDString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UUIDString1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UUIDString1BoxedString(validate(arg, configuration)); } @Override - public UUIDString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UUIDString1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java index feca1011e62..ff051614480 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/User.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -196,7 +195,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -204,7 +203,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -214,7 +213,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -226,40 +225,40 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ObjectWithNoDeclaredPropsNullableBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNoDeclaredPropsNullableBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithNoDeclaredPropsNullableBoxedVoid(validate(arg, configuration)); } @Override - public ObjectWithNoDeclaredPropsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNoDeclaredPropsNullableBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithNoDeclaredPropsNullableBoxedMap(validate(arg, configuration)); } @Override - public ObjectWithNoDeclaredPropsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithNoDeclaredPropsNullableBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -349,7 +348,7 @@ public static AnyTypeExceptNullProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -361,7 +360,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -373,7 +372,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -384,24 +383,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -433,7 +432,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -460,7 +459,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -468,7 +467,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -478,7 +477,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -490,7 +489,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -505,10 +504,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -523,34 +522,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public AnyTypeExceptNullPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedString(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedList(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeExceptNullPropBoxedMap(validate(arg, configuration)); } @Override - public AnyTypeExceptNullPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeExceptNullPropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -566,7 +565,7 @@ public AnyTypeExceptNullPropBoxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -610,7 +609,7 @@ public Number id() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for id"); + throw new RuntimeException("Invalid value stored for id"); } return (Number) value; } @@ -620,7 +619,7 @@ public String username() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for username"); + throw new RuntimeException("Invalid value stored for username"); } return (String) value; } @@ -630,7 +629,7 @@ public String firstName() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for firstName"); + throw new RuntimeException("Invalid value stored for firstName"); } return (String) value; } @@ -640,7 +639,7 @@ public String lastName() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for lastName"); + throw new RuntimeException("Invalid value stored for lastName"); } return (String) value; } @@ -650,7 +649,7 @@ public String email() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for email"); + throw new RuntimeException("Invalid value stored for email"); } return (String) value; } @@ -660,7 +659,7 @@ public String password() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for password"); + throw new RuntimeException("Invalid value stored for password"); } return (String) value; } @@ -670,7 +669,7 @@ public String phone() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for phone"); + throw new RuntimeException("Invalid value stored for phone"); } return (String) value; } @@ -680,7 +679,7 @@ public Number userStatus() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for userStatus"); + throw new RuntimeException("Invalid value stored for userStatus"); } return (Number) value; } @@ -690,7 +689,7 @@ public FrozenMap objectWithNoDeclaredProps() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for objectWithNoDeclaredProps"); + throw new RuntimeException("Invalid value stored for objectWithNoDeclaredProps"); } return (FrozenMap) value; } @@ -700,7 +699,7 @@ public FrozenMap objectWithNoDeclaredProps() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value == null || value instanceof FrozenMap)) { - throw new InvalidTypeException("Invalid value stored for objectWithNoDeclaredPropsNullable"); + throw new RuntimeException("Invalid value stored for objectWithNoDeclaredPropsNullable"); } return (@Nullable FrozenMap) value; } @@ -1169,7 +1168,7 @@ public UserMap getNewInstance(Map arg, List pathToItem, PathToSche for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1177,7 +1176,7 @@ public UserMap getNewInstance(Map arg, List pathToItem, PathToSche Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1187,7 +1186,7 @@ public UserMap getNewInstance(Map arg, List pathToItem, PathToSche return new UserMap(castProperties); } - public UserMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UserMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1199,29 +1198,29 @@ public UserMap validate(Map arg, SchemaConfiguration configuration) throws @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public User1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public User1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new User1BoxedMap(validate(arg, configuration)); } @Override - public User1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public User1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java index ae2e8a60d52..10d89abd9fd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Whale.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.BooleanJsonSchema; @@ -118,29 +117,29 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -162,7 +161,7 @@ public static WhaleMap of(Map arg, SchemaCon public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for className"); + throw new RuntimeException("Invalid value stored for className"); } return (String) value; } @@ -172,7 +171,7 @@ public boolean hasBaleen() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for hasBaleen"); + throw new RuntimeException("Invalid value stored for hasBaleen"); } return (boolean) value; } @@ -182,7 +181,7 @@ public boolean hasTeeth() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Boolean)) { - throw new InvalidTypeException("Invalid value stored for hasTeeth"); + throw new RuntimeException("Invalid value stored for hasTeeth"); } return (boolean) value; } @@ -324,7 +323,7 @@ public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -332,7 +331,7 @@ public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -342,7 +341,7 @@ public WhaleMap getNewInstance(Map arg, List pathToItem, PathToSch return new WhaleMap(castProperties); } - public WhaleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public WhaleMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -354,29 +353,29 @@ public WhaleMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Whale1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Whale1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Whale1BoxedMap(validate(arg, configuration)); } @Override - public Whale1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Whale1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java index 168d9e099dd..0b9d57cfa03 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/Zebra.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -111,29 +110,29 @@ public String validate(StringTypeEnums arg,SchemaConfiguration configuration) th } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public TypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TypeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new TypeBoxedString(validate(arg, configuration)); } @Override - public TypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public TypeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringClassNameEnums implements StringValueMethod { @@ -200,29 +199,29 @@ public String validate(StringClassNameEnums arg,SchemaConfiguration configuratio } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ClassNameBoxedString(validate(arg, configuration)); } @Override - public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ClassNameBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -243,7 +242,7 @@ public static ZebraMap of(Map arg, SchemaCon public String className() { @Nullable Object value = get("className"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for className"); + throw new RuntimeException("Invalid value stored for className"); } return (String) value; } @@ -253,7 +252,7 @@ public String type() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for type"); + throw new RuntimeException("Invalid value stored for type"); } return (String) value; } @@ -454,7 +453,7 @@ public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSch for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -462,7 +461,7 @@ public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSch Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -472,7 +471,7 @@ public ZebraMap getNewInstance(Map arg, List pathToItem, PathToSch return new ZebraMap(castProperties); } - public ZebraMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ZebraMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -484,29 +483,29 @@ public ZebraMap validate(Map arg, SchemaConfiguration configuration) throw @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Zebra1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Zebra1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Zebra1BoxedMap(validate(arg, configuration)); } @Override - public Zebra1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Zebra1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java index 9b64de10f0c..3413af1911e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/configurations/ApiConfiguration.java @@ -21,6 +21,7 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PetpetiduploadimagePostSecurityInfo; import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; import org.openapijsonschematools.client.securityschemes.SecurityScheme; +import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.checkerframework.checker.nullness.qual.Nullable; import java.time.Duration; @@ -31,6 +32,7 @@ public class ApiConfiguration { private final ServerInfo serverInfo; + private final ServerIndexInfo serverIndexInfo; private final SecurityInfo securityInfo; private final SecurityIndexInfo securityIndexInfo; private final @Nullable Duration timeout; @@ -38,14 +40,16 @@ public class ApiConfiguration { public ApiConfiguration() { serverInfo = new ServerInfo(); + serverIndexInfo = new ServerIndexInfo(); securityInfo = new SecurityInfo(); securityIndexInfo = new SecurityIndexInfo(); securitySchemeInfo = new HashMap<>(); timeout = null; } - public ApiConfiguration(ServerInfo serverInfo, SecurityIndexInfo securityIndexInfo, List securitySchemes, Duration timeout) { + public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo, List securitySchemes, SecurityIndexInfo securityIndexInfo, Duration timeout) { this.serverInfo = serverInfo; + this.serverIndexInfo = serverIndexInfo; this.securityInfo = new SecurityInfo(); this.securityIndexInfo = securityIndexInfo; securitySchemeInfo = new HashMap<>(); @@ -56,35 +60,83 @@ public ApiConfiguration(ServerInfo serverInfo, SecurityIndexInfo securityIndexIn } public static class ServerInfo { - protected final RootServerInfo rootServerInfo; - protected final FooGetServerInfo fooGetServerInfo; - protected final PetfindbystatusServerInfo petfindbystatusServerInfo; + protected final RootServerInfo.RootServerInfo1 rootServerInfo; + protected final FooGetServerInfo.FooGetServerInfo1 fooGetServerInfo; + protected final PetfindbystatusServerInfo.PetfindbystatusServerInfo1 petfindbystatusServerInfo; public ServerInfo() { - rootServerInfo = new RootServerInfo(); - fooGetServerInfo = new FooGetServerInfo(); - petfindbystatusServerInfo = new PetfindbystatusServerInfo(); + rootServerInfo = new RootServerInfo.RootServerInfo1(); + fooGetServerInfo = new FooGetServerInfo.FooGetServerInfo1(); + petfindbystatusServerInfo = new PetfindbystatusServerInfo.PetfindbystatusServerInfo1(); } public ServerInfo( - @Nullable RootServerInfo rootServerInfo, - @Nullable FooGetServerInfo fooGetServerInfo, - @Nullable PetfindbystatusServerInfo petfindbystatusServerInfo + RootServerInfo. @Nullable RootServerInfo1 rootServerInfo, + FooGetServerInfo. @Nullable FooGetServerInfo1 fooGetServerInfo, + PetfindbystatusServerInfo. @Nullable PetfindbystatusServerInfo1 petfindbystatusServerInfo ) { - this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo::new); - this.fooGetServerInfo = Objects.requireNonNullElseGet(fooGetServerInfo, FooGetServerInfo::new); - this.petfindbystatusServerInfo = Objects.requireNonNullElseGet(petfindbystatusServerInfo, PetfindbystatusServerInfo::new); + this.rootServerInfo = Objects.requireNonNullElseGet(rootServerInfo, RootServerInfo.RootServerInfo1::new); + this.fooGetServerInfo = Objects.requireNonNullElseGet(fooGetServerInfo, FooGetServerInfo.FooGetServerInfo1::new); + this.petfindbystatusServerInfo = Objects.requireNonNullElseGet(petfindbystatusServerInfo, PetfindbystatusServerInfo.PetfindbystatusServerInfo1::new); + } + } + + public static class ServerIndexInfo { + protected RootServerInfo. @Nullable ServerIndex rootServerInfoServerIndex; + protected FooGetServerInfo. @Nullable ServerIndex fooGetServerInfoServerIndex; + protected PetfindbystatusServerInfo. @Nullable ServerIndex petfindbystatusServerInfoServerIndex; + public ServerIndexInfo() {} + + public ServerIndexInfo rootServerInfoServerIndex(RootServerInfo.ServerIndex serverIndex) { + this.rootServerInfoServerIndex = serverIndex; + return this; + } + + public ServerIndexInfo fooGetServerInfoServerIndex(FooGetServerInfo.ServerIndex serverIndex) { + this.fooGetServerInfoServerIndex = serverIndex; + return this; + } + + public ServerIndexInfo petfindbystatusServerInfoServerIndex(PetfindbystatusServerInfo.ServerIndex serverIndex) { + this.petfindbystatusServerInfoServerIndex = serverIndex; + return this; } } public Server getServer(RootServerInfo. @Nullable ServerIndex serverIndex) { - return serverInfo.rootServerInfo.getServer(serverIndex); + var serverProvider = serverInfo.rootServerInfo; + if (serverIndex == null) { + RootServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.rootServerInfoServerIndex; + if (configServerIndex == null) { + throw new RuntimeException("rootServerInfoServerIndex is unset"); + } + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); } + public Server getServer(FooGetServerInfo. @Nullable ServerIndex serverIndex) { - return serverInfo.fooGetServerInfo.getServer(serverIndex); + var serverProvider = serverInfo.fooGetServerInfo; + if (serverIndex == null) { + FooGetServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.fooGetServerInfoServerIndex; + if (configServerIndex == null) { + throw new RuntimeException("fooGetServerInfoServerIndex is unset"); + } + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); } + public Server getServer(PetfindbystatusServerInfo. @Nullable ServerIndex serverIndex) { - return serverInfo.petfindbystatusServerInfo.getServer(serverIndex); + var serverProvider = serverInfo.petfindbystatusServerInfo; + if (serverIndex == null) { + PetfindbystatusServerInfo. @Nullable ServerIndex configServerIndex = serverIndexInfo.petfindbystatusServerInfoServerIndex; + if (configServerIndex == null) { + throw new RuntimeException("petfindbystatusServerInfoServerIndex is unset"); + } + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); } public static class SecurityInfo { @@ -122,20 +174,20 @@ public SecurityInfo() { } public static class SecurityIndexInfo { - protected FakeDeleteSecurityInfo. @Nullable SecurityIndex fakeDeleteSecurityInfoSecurityIndex; - protected FakePostSecurityInfo. @Nullable SecurityIndex fakePostSecurityInfoSecurityIndex; - protected FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex; - protected FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; - protected FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex; - protected PetPostSecurityInfo. @Nullable SecurityIndex petPostSecurityInfoSecurityIndex; - protected PetPutSecurityInfo. @Nullable SecurityIndex petPutSecurityInfoSecurityIndex; - protected PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex; - protected PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex; - protected PetpetidDeleteSecurityInfo. @Nullable SecurityIndex petpetidDeleteSecurityInfoSecurityIndex; - protected PetpetidGetSecurityInfo. @Nullable SecurityIndex petpetidGetSecurityInfoSecurityIndex; - protected PetpetidPostSecurityInfo. @Nullable SecurityIndex petpetidPostSecurityInfoSecurityIndex; - protected PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex; - protected StoreinventoryGetSecurityInfo. @Nullable SecurityIndex storeinventoryGetSecurityInfoSecurityIndex; + public FakeDeleteSecurityInfo. @Nullable SecurityIndex fakeDeleteSecurityInfoSecurityIndex; + public FakePostSecurityInfo. @Nullable SecurityIndex fakePostSecurityInfoSecurityIndex; + public FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex fakemultiplesecuritiesGetSecurityInfoSecurityIndex; + public FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; + public FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex fakeclassnametestPatchSecurityInfoSecurityIndex; + public PetPostSecurityInfo. @Nullable SecurityIndex petPostSecurityInfoSecurityIndex; + public PetPutSecurityInfo. @Nullable SecurityIndex petPutSecurityInfoSecurityIndex; + public PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex petfindbystatusGetSecurityInfoSecurityIndex; + public PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex petfindbytagsGetSecurityInfoSecurityIndex; + public PetpetidDeleteSecurityInfo. @Nullable SecurityIndex petpetidDeleteSecurityInfoSecurityIndex; + public PetpetidGetSecurityInfo. @Nullable SecurityIndex petpetidGetSecurityInfoSecurityIndex; + public PetpetidPostSecurityInfo. @Nullable SecurityIndex petpetidPostSecurityInfoSecurityIndex; + public PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex petpetiduploadimagePostSecurityInfoSecurityIndex; + public StoreinventoryGetSecurityInfo. @Nullable SecurityIndex storeinventoryGetSecurityInfoSecurityIndex; public SecurityIndexInfo() {} @@ -210,155 +262,155 @@ public SecurityIndexInfo storeinventoryGetSecurityInfoSecurityIndex(Storeinvento } } - public SecurityRequirementObject getSecurityRequirementObject(FakeDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(FakeDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.fakeDeleteSecurityInfo; if (securityIndex == null) { FakeDeleteSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakeDeleteSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("fakeDeleteSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("fakeDeleteSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakePostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(FakePostSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.fakePostSecurityInfo; if (securityIndex == null) { FakePostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakePostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("fakePostSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("fakePostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.fakemultiplesecuritiesGetSecurityInfo; if (securityIndex == null) { FakemultiplesecuritiesGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakemultiplesecuritiesGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("fakemultiplesecuritiesGetSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("fakemultiplesecuritiesGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.fakepetiduploadimagewithrequiredfilePostSecurityInfo; if (securityIndex == null) { FakepetiduploadimagewithrequiredfilePostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("fakepetiduploadimagewithrequiredfilePostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.fakeclassnametestPatchSecurityInfo; if (securityIndex == null) { FakeclassnametestPatchSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.fakeclassnametestPatchSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("fakeclassnametestPatchSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("fakeclassnametestPatchSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetPostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetPostSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petPostSecurityInfo; if (securityIndex == null) { PetPostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petPostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petPostSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petPostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetPutSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetPutSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petPutSecurityInfo; if (securityIndex == null) { PetPutSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petPutSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petPutSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petPutSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petfindbystatusGetSecurityInfo; if (securityIndex == null) { PetfindbystatusGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petfindbystatusGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petfindbystatusGetSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petfindbystatusGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petfindbytagsGetSecurityInfo; if (securityIndex == null) { PetfindbytagsGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petfindbytagsGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petfindbytagsGetSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petfindbytagsGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetpetidDeleteSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petpetidDeleteSecurityInfo; if (securityIndex == null) { PetpetidDeleteSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetidDeleteSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petpetidDeleteSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petpetidDeleteSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetpetidGetSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petpetidGetSecurityInfo; if (securityIndex == null) { PetpetidGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetidGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petpetidGetSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petpetidGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetidPostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetpetidPostSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petpetidPostSecurityInfo; if (securityIndex == null) { PetpetidPostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetidPostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petpetidPostSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petpetidPostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.petpetiduploadimagePostSecurityInfo; if (securityIndex == null) { PetpetiduploadimagePostSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.petpetiduploadimagePostSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("petpetiduploadimagePostSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("petpetiduploadimagePostSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } return securityInfoInstance.getSecurityRequirementObject(securityIndex); } - public SecurityRequirementObject getSecurityRequirementObject(StoreinventoryGetSecurityInfo. @Nullable SecurityIndex securityIndex) throws UnsetPropertyException { + public SecurityRequirementObject getSecurityRequirementObject(StoreinventoryGetSecurityInfo. @Nullable SecurityIndex securityIndex) { var securityInfoInstance = securityInfo.storeinventoryGetSecurityInfo; if (securityIndex == null) { StoreinventoryGetSecurityInfo. @Nullable SecurityIndex configSecurityIndex = securityIndexInfo.storeinventoryGetSecurityInfoSecurityIndex; if (configSecurityIndex == null) { - throw new UnsetPropertyException("storeinventoryGetSecurityInfoSecurityIndex is unset"); + throw new RuntimeException("storeinventoryGetSecurityInfoSecurityIndex is unset"); } return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); } @@ -377,7 +429,7 @@ public Map> getDefaultHeaders() { return new HashMap<>(); } - public@Nullable Duration getTimeout() { + public @Nullable Duration getTimeout() { return timeout; } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java index 3bea6999da1..268e9373289 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/exceptions/BaseException.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.exceptions; @SuppressWarnings("serial") -public class BaseException extends RuntimeException { +public class BaseException extends Exception { public BaseException(String s) { super(s); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java index 2b09f2f77df..0fc91100784 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/ContentHeader.java @@ -5,18 +5,21 @@ import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.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 Map> content; + public final AbstractMap.SimpleEntry> content; - public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, Map> content) { + public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, AbstractMap.SimpleEntry> content) { super(required, ParameterStyle.SIMPLE, explode, allowReserved); this.content = content; } @@ -28,34 +31,28 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { - for (Map.Entry> entry: content.entrySet()) { - var castInData = validate ? entry.getValue().schema().validate(inData, configuration) : inData ; - String contentType = entry.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - var value = ContentTypeSerializer.toJson(castInData); - return toHeaders(name, value); - } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } @Override - public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) { + 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) { - for (Map.Entry> entry: content.entrySet()) { - String contentType = entry.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - return entry.getValue().schema().validate(deserializedJson, configuration); - } else { - throw new RuntimeException("Header deserialization of "+contentType+" has not yet been implemented"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } return deserializedJson; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java index ac9f6274b0d..42387a7859b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Header.java @@ -2,11 +2,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.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); - @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration); + 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/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java index 7bac0c8a6be..11707301d30 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java @@ -1,26 +1,22 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.AbstractMap; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; -import static java.util.stream.Collectors.toList; -import static java.util.stream.Collectors.toMap; - public class Rfc6570Serializer { private static final String ENCODING = "UTF-8"; private static final Set namedParameterSeparators = Set.of("&", ";"); - private static String percentEncode(String s) { + private static String percentEncode(String s) throws NotImplementedException { if (s == null) { return ""; } @@ -31,11 +27,11 @@ private static String percentEncode(String s) { .replace("%7E", "~"); // This could be done faster with more hand-crafted code. } catch (UnsupportedEncodingException wow) { - throw new RuntimeException(wow.getMessage(), wow); + throw new NotImplementedException(wow.getMessage()); } } - private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) { + 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= @@ -62,7 +58,7 @@ private static String percentEncode(String s) { // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 return null; } - throw new InvalidTypeException("Unable to generate a rfc6570 item representation of "+item); + throw new NotImplementedException("Unable to generate a rfc6570 item representation of "+item); } private static String rfc6570StrNumberExpansion( @@ -71,7 +67,7 @@ private static String rfc6570StrNumberExpansion( 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; @@ -87,11 +83,15 @@ private static String rfc6570ListExpansion( PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { - var itemValues = inData.stream() - .map(v -> rfc6570ItemValue(v, percentEncode)) - .filter(Objects::nonNull) - .collect(toList()); + ) 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 ""; @@ -116,12 +116,19 @@ private static String rfc6570MapExpansion( PrefixSeparatorIterator prefixSeparatorIterator, String varNamePiece, boolean namedParameterExpansion - ) { - var inDataMap = inData.entrySet().stream() - .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), rfc6570ItemValue(entry.getValue(), percentEncode))) - .filter(entry -> entry.getValue() != null) - .collect(toMap(Map.Entry::getKey, Map.Entry::getValue, (x, y) -> y, LinkedHashMap::new)); - + ) 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 ""; @@ -143,7 +150,7 @@ protected static String rfc6570Expansion( boolean explode, boolean percentEncode, PrefixSeparatorIterator prefixSeparatorIterator - ) { + ) throws NotImplementedException { /* Separator is for separate variables like dict with explode true, not for array item separation @@ -181,6 +188,6 @@ protected static String rfc6570Expansion( ); } // bool, bytes, etc - throw new InvalidTypeException("Unable to generate a rfc6570 representation of "+inData); + throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java index e4fcfd99924..0f929d9c63b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/SchemaHeader.java @@ -3,6 +3,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.parameter.ParameterStyle; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; @@ -30,7 +32,7 @@ private static HttpHeaders toHeaders(String name, String value) { } @Override - public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) { + 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); @@ -49,7 +51,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid 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) { + 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<>(); @@ -60,7 +62,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return castList; } - private @Nullable Object getCastInData(JsonSchema schema, List inData) { + private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { if (schema.type == null) { if (inData.size() == 1) { return inData.get(0); @@ -68,7 +70,7 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid return getList(schema, inData); } else if (schema.type.size() == 1) { if (schema.type.equals(BOOLEAN_TYPES)) { - throw new RuntimeException("Boolean serialization is not defined in Rfc6570, there is no agreed upon way to sent a boolean, send a string enum instead"); + 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) { @@ -76,16 +78,16 @@ public HttpHeaders serialize(@Nullable Object inData, String name, boolean valid } else if (schema.type.equals(LIST_TYPES)) { return getList(schema, inData); } else if (schema.type.equals(MAP_TYPES)) { - throw new RuntimeException("Header map deserialization has not yet been implemented"); + 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 RuntimeException("Header deserialization for schemas with multiple types has not yet been implemented"); + 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) { + 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); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java index d18be288684..f5fa5a0a75b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/header/StyleSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.header; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; public class StyleSerializer extends Rfc6570Serializer { public static String serializeSimple( @@ -8,7 +9,7 @@ public static String serializeSimple( String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); return rfc6570Expansion( name, @@ -24,7 +25,7 @@ public static String serializeForm( String name, boolean explode, boolean percentEncode - ) { + ) throws NotImplementedException { // todo check that the prefix and suffix matches this one PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); return rfc6570Expansion( @@ -40,7 +41,7 @@ public static String serializeMatrix( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); return rfc6570Expansion( name, @@ -55,7 +56,7 @@ public static String serializeLabel( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); return rfc6570Expansion( name, @@ -70,7 +71,7 @@ public static String serializeSpaceDelimited( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); return rfc6570Expansion( name, @@ -85,7 +86,7 @@ public static String serializePipeDelimited( @Nullable Object inData, String name, boolean explode - ) { + ) throws NotImplementedException { PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); return rfc6570Expansion( name, diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java index 79a3e781051..d5e00cc2fa9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/ContentParameter.java @@ -3,30 +3,28 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import java.util.Map; import java.util.AbstractMap; public class ContentParameter extends ParameterBase implements Parameter { - public final Map> content; + public final AbstractMap.SimpleEntry> content; - public ContentParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, Map> 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) { - for (Map.Entry> entry: content.entrySet()) { - String contentType = entry.getKey(); - if (ContentTypeDetector.contentTypeIsJson(contentType)) { - var value = ContentTypeSerializer.toJson(inData); - return new AbstractMap.SimpleEntry<>(name, value); - } else { - throw new RuntimeException("Serialization of "+contentType+" has not yet been implemented"); - } + 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"); } - throw new RuntimeException("Invalid value for content, it was empty and must have 1 key value pair"); } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java index b04b2ca1754..dcd3b6faf6b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.Map; @@ -13,7 +14,7 @@ protected CookieSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData) { + public String serialize(Map inData) throws NotImplementedException { String result = ""; Map sortedData = new TreeMap<>(inData); for (Map.Entry entry: sortedData.entrySet()) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java index b4a23229944..1969f2c0b21 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/HeadersSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.LinkedHashMap; @@ -14,7 +15,7 @@ protected HeadersSerializer(Map parameters) { this.parameters = parameters; } - public Map> serialize(Map inData) { + public Map> serialize(Map inData) throws NotImplementedException { Map> results = new LinkedHashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java index 9fe0745417c..adf3896d557 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/Parameter.java @@ -1,9 +1,10 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; public interface Parameter { - AbstractMap.SimpleEntry serialize(@Nullable Object inData); + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java index 5864f89c901..78015037211 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/PathSerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.Map; @@ -12,7 +13,7 @@ protected PathSerializer(Map parameters) { this.parameters = parameters; } - public String serialize(Map inData, String pathWithPlaceholders) { + public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException { String result = pathWithPlaceholders; for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java index 91ea0b041bb..880151ed144 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/QuerySerializer.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.parameter; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.AbstractMap; import java.util.HashMap; @@ -14,7 +15,7 @@ protected QuerySerializer(Map parameters) { this.parameters = parameters; } - public Map getQueryMap(Map inData) { + public Map getQueryMap(Map inData) throws NotImplementedException { Map results = new HashMap<>(); for (Map.Entry entry: inData.entrySet()) { String mapKey = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java index 8acfdafcc8a..eef0b6bc371 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/parameter/SchemaParameter.java @@ -2,6 +2,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.header.StyleSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import java.util.AbstractMap; @@ -26,7 +27,7 @@ private ParameterStyle getStyle() { } @Override - public AbstractMap.SimpleEntry serialize(@Nullable Object inData) { + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { ParameterStyle usedStyle = getStyle(); boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; String value; @@ -52,7 +53,7 @@ public AbstractMap.SimpleEntry serialize(@Nullable Object inData } else { // usedStyle == ParameterStyle.DEEP_OBJECT // query - throw new RuntimeException("Style deep object serialization has not yet been implemented."); + throw new NotImplementedException("Style deep object serialization has not yet been implemented."); } return new AbstractMap.SimpleEntry<>(name, value); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java index 185309045a1..b6dd1d97b37 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/Patch.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.RequestBody; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Anotherfakedummy; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +62,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java index e7c62840101..ee80dad1860 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java index 27ad3c01c6a..b01a73ce335 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/anotherfakedummy/patch/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.anotherfakedummy.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java index ca28ef6c947..475bc216c9f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Delete.java @@ -6,10 +6,13 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.delete.PathParameters; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.Parameters; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; import java.io.IOException; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -62,7 +65,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java index 596022972c9..84e1e36efe5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Get.java @@ -6,10 +6,13 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.get.PathParameters; import org.openapijsonschematools.client.paths.commonparamsubdir.get.Parameters; import org.openapijsonschematools.client.paths.commonparamsubdir.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; import java.io.IOException; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -63,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java index 8abf71cc65e..113973108cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/Post.java @@ -6,10 +6,13 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.post.PathParameters; import org.openapijsonschematools.client.paths.commonparamsubdir.post.Parameters; import org.openapijsonschematools.client.paths.commonparamsubdir.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Commonparamsubdir; import java.io.IOException; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -62,7 +65,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java index e8300624dfc..a721eaf3fb8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter0.Schema0; @@ -130,7 +129,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +137,12 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -151,7 +150,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,29 +162,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java index f7821fd56ce..0dc2b07dfaf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.delete.parameters.parameter1.Schema1; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String subDir() { - return getOrThrow("subDir"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -146,7 +149,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -154,12 +157,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -167,7 +170,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -179,29 +182,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java index ac61599b023..3a0905419c6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.delete.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java index 4f908c5276b..4110959c0e3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -87,29 +86,29 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema11BoxedString(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java index 662156732d6..9fbb4015a95 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String subDir() { - return getOrThrow("subDir"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -146,7 +149,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -154,12 +157,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -167,7 +170,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -179,29 +182,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java index dac75cd1483..e8c5c6bd329 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.get.parameters.parameter0.Schema0; @@ -130,7 +129,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +137,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -151,7 +150,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,29 +162,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java index 2e9856cd26e..a491608f72f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java index d8f4f419e84..b6b17e739c3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/parameters/routeparameter0/RouteParamSchema0.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -87,29 +86,29 @@ public String validate(StringRouteParamSchemaEnums0 arg,SchemaConfiguration conf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public RouteParamSchema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RouteParamSchema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new RouteParamSchema01BoxedString(validate(arg, configuration)); } @Override - public RouteParamSchema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public RouteParamSchema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java index ceba836e2ef..4bdf41e9a2f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.post.parameters.parameter0.Schema0; @@ -130,7 +129,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +137,12 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -151,7 +150,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,29 +162,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java index a37a27cda32..f0dcd660250 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.commonparamsubdir.parameters.routeparameter0.RouteParamSchema0; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String subDir() { - return getOrThrow("subDir"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -146,7 +149,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -154,12 +157,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -167,7 +170,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -179,29 +182,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java index 3ac09dfbbb6..12bcf6c08de 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/commonparamsubdir/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.commonparamsubdir.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java index 06270fdd0cc..64e2a73038f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Delete.java @@ -7,10 +7,13 @@ import org.openapijsonschematools.client.paths.fake.delete.QueryParameters; import org.openapijsonschematools.client.paths.fake.delete.Parameters; import org.openapijsonschematools.client.paths.fake.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fake; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -31,7 +34,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -74,7 +77,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java index f31068710a5..94d40088458 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Get.java @@ -7,10 +7,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.get.Parameters; import org.openapijsonschematools.client.paths.fake.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fake; @@ -31,7 +34,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -79,7 +82,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java index 0bc3c524f25..913a462909d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Patch.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.patch.RequestBody; import org.openapijsonschematools.client.paths.fake.patch.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fake; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +62,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java index 5a370e1d851..18da6442b7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/Post.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fake.post.FakePostSecurityInfo; import org.openapijsonschematools.client.paths.fake.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fake; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -31,7 +34,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -76,7 +79,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java index 143eff49895..1d8502b4091 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/FakeDeleteSecurityInfo.java @@ -4,22 +4,17 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class FakeDeleteSecurityInfo { public static class FakeDeleteSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final FakeDeleteSecurityRequirementObject0 security0; public FakeDeleteSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakeDeleteSecurityRequirementObject0()) - )); + security0 = new FakeDeleteSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java index 1cd54a34b9b..85b788d456c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter1.Schema1; @@ -60,7 +59,7 @@ public static HeaderParametersMap of(Map arg public String required_boolean_group() { @Nullable Object value = get("required_boolean_group"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for required_boolean_group"); + throw new RuntimeException("Invalid value stored for required_boolean_group"); } return (String) value; } @@ -70,7 +69,7 @@ public String boolean_group() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for boolean_group"); + throw new RuntimeException("Invalid value stored for boolean_group"); } return (String) value; } @@ -188,7 +187,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -196,7 +195,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -206,7 +205,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -218,29 +217,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java index 338a0580300..17b5e6d69e9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.delete.parameters.parameter0.Schema0; @@ -64,7 +63,7 @@ public static QueryParametersMap of(Map arg, public Number required_int64_group() { @Nullable Object value = get("required_int64_group"); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for required_int64_group"); + throw new RuntimeException("Invalid value stored for required_int64_group"); } return (Number) value; } @@ -72,7 +71,7 @@ public Number required_int64_group() { public String required_string_group() { @Nullable Object value = get("required_string_group"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for required_string_group"); + throw new RuntimeException("Invalid value stored for required_string_group"); } return (String) value; } @@ -82,7 +81,7 @@ public Number int64_group() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for int64_group"); + throw new RuntimeException("Invalid value stored for int64_group"); } return (Number) value; } @@ -92,7 +91,7 @@ public String string_group() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for string_group"); + throw new RuntimeException("Invalid value stored for string_group"); } return (String) value; } @@ -293,7 +292,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -301,7 +300,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -311,7 +310,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -323,29 +322,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java index 5e220e5decd..1ea719d635f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fake.delete.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java index 0fc48284aa6..417a8c466fb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter1/Schema1.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -87,29 +86,29 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema11BoxedString(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java index 1bb4d6193c5..595c106806d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/delete/parameters/parameter4/Schema4.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.JsonSchema; @@ -87,29 +86,29 @@ public String validate(StringSchemaEnums4 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema41BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema41BoxedString(validate(arg, configuration)); } @Override - public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java index f58e04d481f..6e85c71e181 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.get.parameters.parameter0.Schema0; @@ -61,7 +60,7 @@ public String enum_header_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for enum_header_string"); + throw new RuntimeException("Invalid value stored for enum_header_string"); } return (String) value; } @@ -71,7 +70,7 @@ public Schema0.SchemaList0 enum_header_string_array() throws UnsetPropertyExcept throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Schema0.SchemaList0)) { - throw new InvalidTypeException("Invalid value stored for enum_header_string_array"); + throw new RuntimeException("Invalid value stored for enum_header_string_array"); } return (Schema0.SchemaList0) value; } @@ -170,7 +169,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -178,7 +177,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -188,7 +187,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -200,29 +199,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java index 9e6ff8205ec..837ef9d55d7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fake.get.parameters.parameter2.Schema2; @@ -65,7 +64,7 @@ public Number enum_query_double() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for enum_query_double"); + throw new RuntimeException("Invalid value stored for enum_query_double"); } return (Number) value; } @@ -75,7 +74,7 @@ public String enum_query_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for enum_query_string"); + throw new RuntimeException("Invalid value stored for enum_query_string"); } return (String) value; } @@ -85,7 +84,7 @@ public Number enum_query_integer() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Number)) { - throw new InvalidTypeException("Invalid value stored for enum_query_integer"); + throw new RuntimeException("Invalid value stored for enum_query_integer"); } return (Number) value; } @@ -95,7 +94,7 @@ public Schema2.SchemaList2 enum_query_string_array() throws UnsetPropertyExcepti throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Schema2.SchemaList2)) { - throw new InvalidTypeException("Invalid value stored for enum_query_string_array"); + throw new RuntimeException("Invalid value stored for enum_query_string_array"); } return (Schema2.SchemaList2) value; } @@ -286,7 +285,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -294,7 +293,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -304,7 +303,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -316,29 +315,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java index c14807b0629..3f8f13a779a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fake.get; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java index 4216c774363..6027d75594f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.fake.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fake.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java index 8d4b0be69ff..2b31d119440 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter0/Schema0.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -93,35 +92,35 @@ public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Items0BoxedString(validate(arg, configuration)); } @Override - public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -201,12 +200,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -226,29 +225,29 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java index d3e4cdf4429..02907bcc352 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter1/Schema1.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -91,35 +90,35 @@ public String validate(StringSchemaEnums1 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema11BoxedString(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java index df2e535ac26..ffb41afbb75 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter2/Schema2.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -93,35 +92,35 @@ public String validate(StringItemsEnums2 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Items2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Items2BoxedString(validate(arg, configuration)); } @Override - public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items2Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -201,12 +200,12 @@ public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -226,29 +225,29 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema21BoxedList(validate(arg, configuration)); } @Override - public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java index cdf9d19c5f3..37fb6b578b6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter3/Schema3.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -91,35 +90,35 @@ public String validate(StringSchemaEnums3 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Schema31BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema31BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema31BoxedString(validate(arg, configuration)); } @Override - public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java index 1e2d7c15b13..e7762fe4493 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter4/Schema4.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -160,29 +159,29 @@ public double validate(DoubleSchemaEnums4 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema41BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema41BoxedNumber(validate(arg, configuration)); } @Override - public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java index d726146199c..18dcf62eda7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/parameters/parameter5/Schema5.java @@ -8,7 +8,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator; @@ -115,29 +114,29 @@ public double validate(DoubleSchemaEnums5 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema51BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema51BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema51BoxedNumber(validate(arg, configuration)); } @Override - public Schema51Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema51Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index bbe2de005a6..ea8f9b6295e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -101,35 +100,35 @@ public String validate(StringApplicationxwwwformurlencodedItemsEnums arg,SchemaC } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public ApplicationxwwwformurlencodedItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedItemsBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -209,12 +208,12 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList getNewInstance(List< itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -234,29 +233,29 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList validate(List arg } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedEnumFormStringArrayBoxedList(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedEnumFormStringArrayBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedEnumFormStringArrayBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringApplicationxwwwformurlencodedEnumFormStringEnums implements StringValueMethod { @@ -328,35 +327,35 @@ public String validate(StringApplicationxwwwformurlencodedEnumFormStringEnums ar } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public ApplicationxwwwformurlencodedEnumFormStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedEnumFormStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedEnumFormStringBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedEnumFormStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedEnumFormStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -378,7 +377,7 @@ public ApplicationxwwwformurlencodedEnumFormStringArrayList enum_form_string_arr throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof ApplicationxwwwformurlencodedEnumFormStringArrayList)) { - throw new InvalidTypeException("Invalid value stored for enum_form_string_array"); + throw new RuntimeException("Invalid value stored for enum_form_string_array"); } return (ApplicationxwwwformurlencodedEnumFormStringArrayList) value; } @@ -388,7 +387,7 @@ public String enum_form_string() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for enum_form_string"); + throw new RuntimeException("Invalid value stored for enum_form_string"); } return (String) value; } @@ -495,7 +494,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -503,7 +502,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -513,7 +512,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -525,29 +524,29 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java index bad071e523a..34af3ea2174 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/get/responses/Code404Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fake.get.responses.code404response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code404Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java index 903ab9cd2b1..5ea188b2480 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fake.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java index dcd5c9d2941..9e368e1e05c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/patch/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fake.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java index feaf2d3706d..013b581a6d4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/FakePostSecurityInfo.java @@ -4,22 +4,17 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class FakePostSecurityInfo { public static class FakePostSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final FakePostSecurityRequirementObject0 security0; public FakePostSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakePostSecurityRequirementObject0()) - )); + security0 = new FakePostSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java index 818941bb213..f1df9eb31ed 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fake.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java index 0347ac523e0..7a2562b0a60 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.fake.post.responses.Code200Response; import org.openapijsonschematools.client.paths.fake.post.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 20f4442dd32..bb231ecf95e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.DateJsonSchema; @@ -101,29 +100,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedIntegerBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedIntegerBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedIntegerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -184,29 +183,29 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedInt32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedInt32BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedInt32BoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedInt32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedInt32Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -285,29 +284,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedNumberBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedNumberBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedNumberBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -362,29 +361,29 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedFloatBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedFloatBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedFloatBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedFloatBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedFloatBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -440,29 +439,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedDoubleBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedDoubleBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedDoubleBoxedNumber(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedDoubleBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedDoubleBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -513,29 +512,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedStringBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedStringBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedStringBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -585,29 +584,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedPatternWithoutDelimiterBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -690,35 +689,35 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public ApplicationxwwwformurlencodedDateTimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedDateTimeBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedDateTimeBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedDateTimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedDateTimeBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -768,29 +767,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedPasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedPasswordBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedPasswordBoxedString(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedPasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedPasswordBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -834,7 +833,7 @@ public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1541,7 +1540,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1551,7 +1550,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1563,29 +1562,29 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java index fb498802410..4e6abc094e0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fake/post/responses/Code404Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java index 51b9bccff48..07c73d4f887 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/Get.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeadditionalpropertieswitharrayofenums; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java index c1f5f3adacd..b58e901cf8c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java index fd1ec82a26a..be8ef287de3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java index 5a4986b6599..0a17d85055f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeadditionalpropertieswitharrayofenums/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeadditionalpropertieswitharrayofenums.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java index 24fc177d34a..ddc35d6146a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/Put.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.RequestBody; import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakebodywithfileschema; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +62,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java index 3ce0af9cb18..a46287e74b1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakebodywithfileschema.put; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java index cc35746e142..0beb85a7c98 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithfileschema/put/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakebodywithfileschema.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java index 6a6f5e33381..ba8cd1a869b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/Put.java @@ -6,10 +6,13 @@ import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.QueryParameters; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.Parameters; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakebodywithqueryparams; @@ -30,7 +33,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -65,7 +68,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java index 24e01b5b448..03360b53511 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.parameters.parameter0.Schema0; @@ -55,7 +54,11 @@ public static QueryParametersMap of(Map arg, SchemaConfiguration } public String query() { - return getOrThrow("query"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -140,7 +143,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -148,12 +151,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -161,7 +164,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -173,29 +176,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java index ec82360b6dd..8d9663e8ef7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakebodywithqueryparams.put; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java index cd75c88f985..6109b533036 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakebodywithqueryparams/put/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakebodywithqueryparams.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java index 5629b6ac700..9740580cca0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/Put.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.QueryParameters; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.Parameters; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakecasesensitiveparams; import java.io.IOException; @@ -27,7 +30,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -56,7 +59,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java index 4b7ad8f27be..f3482c8b143 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.parameters.parameter0.Schema0; @@ -61,7 +60,7 @@ public static QueryParametersMap of(Map arg, public String SomeVar() { @Nullable Object value = get("SomeVar"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for SomeVar"); + throw new RuntimeException("Invalid value stored for SomeVar"); } return (String) value; } @@ -69,7 +68,7 @@ public String SomeVar() { public String someVar() { @Nullable Object value = get("someVar"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for someVar"); + throw new RuntimeException("Invalid value stored for someVar"); } return (String) value; } @@ -77,7 +76,7 @@ public String someVar() { public String some_var() { @Nullable Object value = get("some_var"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for some_var"); + throw new RuntimeException("Invalid value stored for some_var"); } return (String) value; } @@ -285,7 +284,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -293,7 +292,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -303,7 +302,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -315,29 +314,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java index a82cea7d6d7..657dc7e0feb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakecasesensitiveparams/put/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakecasesensitiveparams.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java index f718be09069..dd5ea58f497 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/Patch.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.fakeclassnametest.patch.FakeclassnametestPatchSecurityInfo; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.RequestBody; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeclassnametest; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -31,7 +34,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -72,7 +75,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java index 3d2274ab9ac..a4a739aad43 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/FakeclassnametestPatchSecurityInfo.java @@ -4,22 +4,17 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class FakeclassnametestPatchSecurityInfo { public static class FakeclassnametestPatchSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final FakeclassnametestPatchSecurityRequirementObject0 security0; public FakeclassnametestPatchSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakeclassnametestPatchSecurityRequirementObject0()) - )); + security0 = new FakeclassnametestPatchSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java index 20b70774ed5..6c0629531b3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java index aa4e6dc53e3..89d40f66041 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeclassnametest/patch/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeclassnametest.patch.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java index d63e6878058..cedaa59345b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/Delete.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.PathParameters; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.Parameters; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakedeletecoffeeid; import java.io.IOException; @@ -27,7 +30,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -55,7 +58,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java index 086a2e9a146..afb07c84f67 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.parameters.parameter0.Schema0; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String id() { - return getOrThrow("id"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -140,7 +143,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -148,12 +151,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -161,7 +164,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -173,29 +176,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java index 4707c2d13b3..992b7a97bbf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.Code200Response; import org.openapijsonschematools.client.paths.fakedeletecoffeeid.delete.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -44,7 +46,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java index e770ec7cffa..1035e7e22d1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakedeletecoffeeid/delete/responses/CodedefaultResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java index ae08b521620..9e1fcb44bc3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/Get.java @@ -3,10 +3,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakehealth.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakehealth; import java.io.IOException; @@ -25,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java index 06d52e39237..60cdc4cf144 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakehealth.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java index c627ade2788..1de1e383c20 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakehealth/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakehealth.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java index 7e6343f7f04..6b9aec9067f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.RequestBody; import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeinlineadditionalproperties; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java index 628b1efee55..85529afa41c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java index 37c62eb8e53..aa94f2fbb73 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakeinlineadditionalproperties.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 76ae9ff97d4..552865b8b4c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlineadditionalproperties/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -122,7 +121,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -130,12 +129,12 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -143,7 +142,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -155,29 +154,29 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java index 58b236864ec..06f4d279174 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/Post.java @@ -6,10 +6,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.Parameters; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeinlinecomposition; @@ -30,7 +33,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -72,7 +75,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java index e562508fcb9..144b9be7749 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.parameters.parameter0.Schema0; @@ -61,7 +60,7 @@ public static QueryParametersMap of(Map arg, throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Object)) { - throw new InvalidTypeException("Invalid value stored for compositionAtRoot"); + throw new RuntimeException("Invalid value stored for compositionAtRoot"); } return (@Nullable Object) value; } @@ -71,7 +70,7 @@ public Schema1.SchemaMap1 compositionInProperty() throws UnsetPropertyException throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof Schema1.SchemaMap1)) { - throw new InvalidTypeException("Invalid value stored for compositionInProperty"); + throw new RuntimeException("Invalid value stored for compositionInProperty"); } return (Schema1.SchemaMap1) value; } @@ -212,7 +211,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -220,7 +219,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -230,7 +229,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -242,29 +241,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java index 062e79c82e3..0264be90b7b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeinlinecomposition.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -48,7 +49,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java index eca3f947dfa..ce85d87ccd8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java index ccc4f70f4e3..2ce60fa7be0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter0/Schema0.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -79,29 +78,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema00BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema00BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema00BoxedString(validate(arg, configuration)); } @Override - public Schema00Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema00Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -171,7 +170,7 @@ public static Schema01 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,7 +194,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,24 +205,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -255,7 +254,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -282,7 +281,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -290,7 +289,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -300,7 +299,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -312,7 +311,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -327,10 +326,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -345,34 +344,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedVoid(validate(arg, configuration)); } @Override - public Schema01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedBoolean(validate(arg, configuration)); } @Override - public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedNumber(validate(arg, configuration)); } @Override - public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedString(validate(arg, configuration)); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedMap(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -388,7 +387,7 @@ public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration co } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java index 53b54f01e86..44cb10452d6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/parameters/parameter1/Schema1.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -81,29 +80,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedString(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -173,7 +172,7 @@ public static SomeProp1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,7 +184,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,24 +207,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -257,7 +256,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -284,7 +283,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -292,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -302,7 +301,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -329,10 +328,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -347,34 +346,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public SomeProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedVoid(validate(arg, configuration)); } @Override - public SomeProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedBoolean(validate(arg, configuration)); } @Override - public SomeProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedNumber(validate(arg, configuration)); } @Override - public SomeProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedString(validate(arg, configuration)); } @Override - public SomeProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedList(validate(arg, configuration)); } @Override - public SomeProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new SomeProp1BoxedMap(validate(arg, configuration)); } @Override - public SomeProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SomeProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -390,7 +389,7 @@ public SomeProp1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration c } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -538,7 +537,7 @@ public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -546,7 +545,7 @@ public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -556,7 +555,7 @@ public SchemaMap1 getNewInstance(Map arg, List pathToItem, PathToS return new SchemaMap1(castProperties); } - public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -568,29 +567,29 @@ public SchemaMap1 validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema11BoxedMap(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 2c96cc9523d..90eeb11bea9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -79,29 +78,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Applicationjson0BoxedString(validate(arg, configuration)); } @Override - public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -171,7 +170,7 @@ public static ApplicationjsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,7 +194,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,24 +205,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -255,7 +254,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -282,7 +281,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -290,7 +289,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -300,7 +299,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -312,7 +311,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -327,10 +326,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -345,34 +344,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedString(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -388,7 +387,7 @@ public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCo } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 21b63d62157..469b099493b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -81,29 +80,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Multipartformdata0BoxedString(validate(arg, configuration)); } @Override - public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -173,7 +172,7 @@ public static MultipartformdataSomeProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,7 +184,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,24 +207,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -257,7 +256,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -284,7 +283,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -292,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -302,7 +301,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -329,10 +328,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -347,34 +346,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedVoid(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedBoolean(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedNumber(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedString(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedList(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -390,7 +389,7 @@ public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, Schem } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -538,7 +537,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -546,7 +545,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -556,7 +555,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -568,29 +567,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java index 27d0bbde2b1..d8bdbbf90a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; import org.openapijsonschematools.client.paths.fakeinlinecomposition.post.responses.code200response.content.multipartformdata.MultipartformdataSchema; @@ -50,19 +52,15 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + 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 ApplicationjsonResponseBody(deserializedBody); - } else if (mediaType instanceof MultipartformdataMediaType thisMediaType) { + } else { + MultipartformdataMediaType thisMediaType = (MultipartformdataMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new MultipartformdataResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java index 695b0da9c5b..168cbeb975c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter; @@ -79,29 +78,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Applicationjson0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Applicationjson0BoxedString(validate(arg, configuration)); } @Override - public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Applicationjson0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -171,7 +170,7 @@ public static ApplicationjsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -183,7 +182,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -195,7 +194,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -206,24 +205,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -255,7 +254,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -282,7 +281,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -290,7 +289,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -300,7 +299,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -312,7 +311,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -327,10 +326,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -345,34 +344,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedString(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -388,7 +387,7 @@ public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCo } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java index 2a1e790f1a2..68748fd1603 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeinlinecomposition/post/responses/code200response/content/multipartformdata/MultipartformdataSchema.java @@ -14,7 +14,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -81,29 +80,29 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Multipartformdata0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Multipartformdata0BoxedString(validate(arg, configuration)); } @Override - public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Multipartformdata0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -173,7 +172,7 @@ public static MultipartformdataSomeProp getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -185,7 +184,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -208,24 +207,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return castArg; } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -257,7 +256,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -284,7 +283,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -292,7 +291,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -302,7 +301,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return castProperties; } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -314,7 +313,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -329,10 +328,10 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } else if (arg instanceof Boolean) { @@ -347,34 +346,34 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedVoid(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedBoolean(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedNumber(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedString(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedList(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSomePropBoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -390,7 +389,7 @@ public MultipartformdataSomePropBoxed validateAndBox(@Nullable Object arg, Schem } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -538,7 +537,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -546,7 +545,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -556,7 +555,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -568,29 +567,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java index 9f77930f8c5..7f09ba7a1f4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/Get.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakejsonformdata.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakejsonformdata.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakejsonformdata; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java index d7fbbcbadcb..50a121737b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakejsonformdata.get; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java index c33a942e753..f583e035a7d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakejsonformdata.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 6ecf0882708..9a70e8487d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -67,7 +66,7 @@ public static ApplicationxwwwformurlencodedSchemaMap of(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -224,7 +223,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -234,7 +233,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -246,29 +245,29 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java index 3fab6a5ef14..11acaae5b01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/Patch.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakejsonpatch.patch.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakejsonpatch.patch.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakejsonpatch; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse patch( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PatchOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse patch(PatchRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PatchProvider.patch(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java index 468041f351a..f9b1f076f6b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakejsonpatch.patch; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonpatchjsonRequestBody requestBody0 = (ApplicationjsonpatchjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java index d2adc74ceed..8b8c72ea1e2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonpatch/patch/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakejsonpatch.patch.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java index 15f87d7ccda..256707d6c16 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakejsonwithcharset; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java index 5ae2a3289b0..6843dc22e74 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakejsonwithcharset.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { Applicationjsoncharsetutf8RequestBody requestBody0 = (Applicationjsoncharsetutf8RequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java index 2c6b3699664..c4ad7ae4d22 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java index a8ca91508c2..d1c8cfba01a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakejsonwithcharset/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakejsonwithcharset.post.responses.code200response.content.applicationjsoncharsetutf8.Applicationjsoncharsetutf8Schema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof Applicationjsoncharsetutf8MediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new Applicationjsoncharsetutf8ResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + Applicationjsoncharsetutf8MediaType thisMediaType = (Applicationjsoncharsetutf8MediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new Applicationjsoncharsetutf8ResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java index ffa442b65ff..eec76f14d75 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakemultiplerequestbodycontenttypes; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java index bfc18b8c3f8..0566e226c14 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -48,7 +49,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java index a9d9f512c9a..0eeb2290be0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java index 7abe38bfe8a..16a494f8b3d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/applicationjson/ApplicationjsonSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ public String a() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for a"); + throw new RuntimeException("Invalid value stored for a"); } return (String) value; } @@ -142,7 +141,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -150,7 +149,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -160,7 +159,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,29 +171,29 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 79627668a08..684ede7bd69 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ public String b() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for b"); + throw new RuntimeException("Invalid value stored for b"); } return (String) value; } @@ -142,7 +141,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -150,7 +149,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -160,7 +159,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,29 +171,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java index 9f1305f5a53..30659d828c6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplerequestbodycontenttypes/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultiplerequestbodycontenttypes.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java index 803c41e74f4..c741ed63ddb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/Get.java @@ -3,10 +3,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakemultipleresponsebodies; import java.io.IOException; @@ -25,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java index 1a783d3ac7b..3325b9085a8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.Code200Response; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.Code202Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -45,7 +47,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java index 512d493671e..567d4148b74 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java index d1636e41852..2783f09c99f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultipleresponsebodies/get/responses/Code202Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultipleresponsebodies.get.responses.code202response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code202Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java index b8228e447f7..d7db1ca4247 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/Get.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.FakemultiplesecuritiesGetSecurityInfo; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakemultiplesecurities; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -63,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java index 0a641952eca..ed1fd5216aa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.java @@ -6,24 +6,28 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class FakemultiplesecuritiesGetSecurityInfo { public static class FakemultiplesecuritiesGetSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final FakemultiplesecuritiesGetSecurityRequirementObject0 security0; + public final FakemultiplesecuritiesGetSecurityRequirementObject1 security1; + public final FakemultiplesecuritiesGetSecurityRequirementObject2 security2; public FakemultiplesecuritiesGetSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakemultiplesecuritiesGetSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new FakemultiplesecuritiesGetSecurityRequirementObject1()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new FakemultiplesecuritiesGetSecurityRequirementObject2()) - )); + security0 = new FakemultiplesecuritiesGetSecurityRequirementObject0(); + security1 = new FakemultiplesecuritiesGetSecurityRequirementObject1(); + security2 = new FakemultiplesecuritiesGetSecurityRequirementObject2(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + case SECURITY_1: + return security1; + default: + return security2; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java index ce504a325bf..94d796bdc3c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java index e7e77c03021..14964db98f2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakemultiplesecurities/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakemultiplesecurities.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java index 45ba37fafc8..e4f5836bd16 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/Get.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeobjinquery.get.Parameters; import org.openapijsonschematools.client.paths.fakeobjinquery.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakeobjinquery; import java.io.IOException; @@ -27,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +62,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java index b5adb891967..351fd68acab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeobjinquery.get.parameters.parameter0.Schema0; @@ -130,7 +129,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +137,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Schema0.SchemaMap0)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Schema0.SchemaMap0) propertyInstance); } @@ -151,7 +150,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,29 +162,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java index e17ef11e287..1cb6c0ca42e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakeobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java index de7150e15d9..f94e9fadd7a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeobjinquery/get/parameters/parameter0/Schema0.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -57,7 +56,7 @@ public String keyword() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for keyword"); + throw new RuntimeException("Invalid value stored for keyword"); } return (String) value; } @@ -142,7 +141,7 @@ public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToS for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -150,7 +149,7 @@ public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToS Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -160,7 +159,7 @@ public SchemaMap0 getNewInstance(Map arg, List pathToItem, PathToS return new SchemaMap0(castProperties); } - public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,29 +171,29 @@ public SchemaMap0 validate(Map arg, SchemaConfiguration configuration) thr @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedMap(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java index 81a3f7cf9c1..6f8f32dcdab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/Post.java @@ -9,10 +9,13 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.PathParameters; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Parameters; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeparametercollisions1ababselfab; @@ -33,7 +36,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -91,7 +94,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java index aa7682206d1..0acba3877bc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/CookieParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter14.Schema14; @@ -67,7 +66,7 @@ public String aB() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for aB"); + throw new RuntimeException("Invalid value stored for aB"); } return (String) value; } @@ -77,7 +76,7 @@ public String Ab() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for Ab"); + throw new RuntimeException("Invalid value stored for Ab"); } return (String) value; } @@ -87,7 +86,7 @@ public String self() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for self"); + throw new RuntimeException("Invalid value stored for self"); } return (String) value; } @@ -228,7 +227,7 @@ public CookieParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +235,7 @@ public CookieParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -246,7 +245,7 @@ public CookieParametersMap getNewInstance(Map arg, List pathToItem return new CookieParametersMap(castProperties); } - public CookieParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CookieParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,29 +257,29 @@ public CookieParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public CookieParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CookieParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new CookieParameters1BoxedMap(validate(arg, configuration)); } @Override - public CookieParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public CookieParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java index 0e2a00abf38..904e373ed76 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter5.Schema5; @@ -65,7 +64,7 @@ public String aB() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for aB"); + throw new RuntimeException("Invalid value stored for aB"); } return (String) value; } @@ -75,7 +74,7 @@ public String self() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for self"); + throw new RuntimeException("Invalid value stored for self"); } return (String) value; } @@ -200,7 +199,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -208,7 +207,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -218,7 +217,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -230,29 +229,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java index f71498c6051..8e4742efa0f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter10.Schema10; @@ -65,7 +64,7 @@ public static PathParametersMap of(Map arg, public String Ab() { @Nullable Object value = get("Ab"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for Ab"); + throw new RuntimeException("Invalid value stored for Ab"); } return (String) value; } @@ -73,7 +72,7 @@ public String Ab() { public String aB() { @Nullable Object value = get("aB"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for aB"); + throw new RuntimeException("Invalid value stored for aB"); } return (String) value; } @@ -81,7 +80,7 @@ public String aB() { public String self() { @Nullable Object value = get("self"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for self"); + throw new RuntimeException("Invalid value stored for self"); } return (String) value; } @@ -761,7 +760,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -769,7 +768,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -779,7 +778,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -791,29 +790,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java index c4613b418f0..0a9975c014b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.parameters.parameter0.Schema0; @@ -67,7 +66,7 @@ public String aB() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for aB"); + throw new RuntimeException("Invalid value stored for aB"); } return (String) value; } @@ -77,7 +76,7 @@ public String Ab() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for Ab"); + throw new RuntimeException("Invalid value stored for Ab"); } return (String) value; } @@ -87,7 +86,7 @@ public String self() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for self"); + throw new RuntimeException("Invalid value stored for self"); } return (String) value; } @@ -228,7 +227,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -236,7 +235,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -246,7 +245,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -258,29 +257,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java index 61c0cb2c691..a51c3ec8a0d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java index 6f9f5877987..63bb9a16183 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java index 6cb92112b23..7cda67e481f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeparametercollisions1ababselfab.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java index cdf5aef2647..76762c2106d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/Get.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakepemcontenttype.get.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakepemcontenttype.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakepemcontenttype; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java index ff68a6c95d5..1f480bb4f6c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakepemcontenttype.get; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationxpemfileRequestBody requestBody0 = (ApplicationxpemfileRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java index 617d012d016..c0cddd94174 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java index 35ea54800af..499c915f8f3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.code200response.content.applicationxpemfile.ApplicationxpemfileSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationxpemfileMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationxpemfileResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationxpemfileMediaType thisMediaType = (ApplicationxpemfileMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationxpemfileResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java index 9b74bbfdf80..bc14ed14094 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/Post.java @@ -7,10 +7,13 @@ import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.PathParameters; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.Parameters; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakepetiduploadimagewithrequiredfile; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -33,7 +36,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -81,7 +84,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java index c06bb045cf8..8dab76a488c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/FakepetiduploadimagewithrequiredfilePostSecurityInfo.java @@ -4,22 +4,17 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class FakepetiduploadimagewithrequiredfilePostSecurityInfo { public static class FakepetiduploadimagewithrequiredfilePostSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0 security0; public FakepetiduploadimagewithrequiredfilePostSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0()) - )); + security0 = new FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java index 136cee7d885..a568880cab5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.parameters.parameter0.Schema0; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number petId() { - return getOrThrow("petId"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -158,7 +161,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -166,12 +169,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -179,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,29 +194,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java index 3fc03d40157..0788c7362cb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java index 10353a08dc3..ae1b734dfce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index ff272e85252..50a815585cb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -69,7 +68,7 @@ public static MultipartformdataSchemaMap of(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -201,7 +200,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -211,7 +210,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,29 +222,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java index df5ef4ffa28..e12ad3e1ff1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakepetiduploadimagewithrequiredfile.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java index 265b436de28..1d2525666c8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/Get.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.QueryParameters; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.Parameters; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakequeryparamwithjsoncontenttype; import java.io.IOException; @@ -27,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -56,7 +59,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java index 8cd9c1628ed..12618cb5ee0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson.Schema0; @@ -55,7 +54,11 @@ public static QueryParametersMap of(Map arg, } public @Nullable Object someParam() { - return getOrThrow("someParam"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -188,7 +191,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -196,12 +199,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Object)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (@Nullable Object) propertyInstance); } @@ -209,7 +212,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -221,29 +224,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java index dc6b9ebe721..67fcc96df1a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java index 0195dc24e67..ac6cbea3c13 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/parameters/Parameter0.java @@ -6,7 +6,6 @@ import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.parameters.parameter0.content.applicationjson.Schema0; import java.util.AbstractMap; -import java.util.Map; public class Parameter0 { @@ -29,9 +28,7 @@ public Parameter01() { null, null, false, - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java index 44a7d6d9a17..1c25969ab61 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakequeryparamwithjsoncontenttype/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakequeryparamwithjsoncontenttype.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java index 63643897a3f..79bfed8fe0c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/Get.java @@ -3,10 +3,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeredirection.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakeredirection; import java.io.IOException; @@ -25,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java index 1678ade8102..addd1e3384e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.fakeredirection.get.responses.Code303Response; import org.openapijsonschematools.client.paths.fakeredirection.get.responses.Code3XXResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -50,7 +52,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java index fe6da3290d3..80bbe5222cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code303Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code303Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java index 0bceda71429..fc5125abeca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeredirection/get/responses/Code3XXResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code3XXResponse1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java index 34eafefc4d0..d640b1e04c5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/Get.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefobjinquery.get.Parameters; import org.openapijsonschematools.client.paths.fakerefobjinquery.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakerefobjinquery; import java.io.IOException; @@ -27,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -59,7 +62,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java index b8e5f47e5e7..5f291a86045 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/QueryParameters.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.schemas.Foo; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -130,7 +129,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +137,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Foo.FooMap)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Foo.FooMap) propertyInstance); } @@ -151,7 +150,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,29 +162,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java index 1a8dca8dcdd..fa40e5c878e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefobjinquery/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakerefobjinquery.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java index 5d30e214a16..3b1dad9974c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsarraymodel; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java index 331c85336ed..cd7db4c428b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsarraymodel.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java index da739f84545..dbe304b8a0f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java index d2fa881818b..c6902020026 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarraymodel/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsarraymodel.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java index a9b53d07eb6..13d1ccbab8f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsarrayofenums; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java index 614bd30d021..b9c573e092d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsarrayofenums.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java index 3c02dbbae03..4e054707d20 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java index 9b5ea0b64fb..9ee1287a9d1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsarrayofenums/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsarrayofenums.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java index 0176df73b8d..95db0847da6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakerefsboolean.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsboolean.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsboolean; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java index 892772867fc..7d6c5aea5e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsboolean.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java index ef2da8a829a..755d4d97568 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java index 390ac805456..2f85215f463 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsboolean/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsboolean.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java index a5b8064bca9..97d3e46b39c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefscomposedoneofnumberwithvalidations; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java index 705f750a6d0..9c7d24a6e84 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java index bffd6a98a2a..bdc96d2297e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java index 2261c15e675..aa7d008cb6e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefscomposedoneofnumberwithvalidations/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefscomposedoneofnumberwithvalidations.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java index 59028a026b9..02719172619 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakerefsenum.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsenum.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsenum; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java index f149f2bc22f..4166ca11c2b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsenum.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java index c2b067d4643..9668bb4535f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java index 8e6a2da362b..23ed2009366 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsenum/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsenum.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java index 7b153f79789..278c82a493c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsmammal.post.RequestBody; import org.openapijsonschematools.client.paths.fakerefsmammal.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsmammal; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java index c5b28579c34..7fba66cb6d8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsmammal.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java index de909f096bc..47df1517739 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java index 2d9310a09b8..6565afc0de3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsmammal/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsmammal.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java index aa78925f60b..1eaba218885 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakerefsnumber.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsnumber.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsnumber; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java index dd306ec59bd..8494dd01aaa 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsnumber.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java index 622310c701c..64721d3dfb9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java index bb1a8ebb079..9e8e93aca7f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsnumber/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsnumber.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java index 5d619094fd5..a8a554dc678 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsobjectmodelwithrefprops; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java index c00f02f2221..36aacc1eb10 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java index 838601e6f24..cf4c1d15769 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java index 83e7c808d89..a2b03d8a56d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsobjectmodelwithrefprops/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsobjectmodelwithrefprops.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java index 764b6e55111..c2b331a1125 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakerefsstring.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakerefsstring.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakerefsstring; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java index ba47936d312..8cbfffaff80 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakerefsstring.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java index 331a3bc8816..c2d043e5a24 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java index 7642e09bbab..78842227518 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakerefsstring/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakerefsstring.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java index 87003260f1b..58e670e37cc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/Get.java @@ -3,10 +3,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakeresponsewithoutschema; import java.io.IOException; @@ -25,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java index 0c0edb117cd..829ad9e8208 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakeresponsewithoutschema.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java index d9cc9ea080e..01622b70b62 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeresponsewithoutschema/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.AbstractMap; @@ -24,7 +26,7 @@ public Code200Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java index c93f7b5e452..98a0fd0f5e2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/Put.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.faketestqueryparamters.put.QueryParameters; import org.openapijsonschematools.client.paths.faketestqueryparamters.put.Parameters; import org.openapijsonschematools.client.paths.faketestqueryparamters.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Faketestqueryparamters; import java.io.IOException; @@ -27,7 +30,7 @@ public static Responses.EndpointResponse put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -56,7 +59,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java index 8c8a5f005bf..c4573b4f79d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/QueryParameters.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.schemas.StringWithValidation; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.faketestqueryparamters.put.parameters.parameter0.Schema0; @@ -67,7 +66,7 @@ public static QueryParametersMap of(Map arg, public Schema4.SchemaList4 context() { @Nullable Object value = get("context"); if (!(value instanceof Schema4.SchemaList4)) { - throw new InvalidTypeException("Invalid value stored for context"); + throw new RuntimeException("Invalid value stored for context"); } return (Schema4.SchemaList4) value; } @@ -75,7 +74,7 @@ public Schema4.SchemaList4 context() { public Schema2.SchemaList2 http() { @Nullable Object value = get("http"); if (!(value instanceof Schema2.SchemaList2)) { - throw new InvalidTypeException("Invalid value stored for http"); + throw new RuntimeException("Invalid value stored for http"); } return (Schema2.SchemaList2) value; } @@ -83,7 +82,7 @@ public Schema2.SchemaList2 http() { public Schema1.SchemaList1 ioutil() { @Nullable Object value = get("ioutil"); if (!(value instanceof Schema1.SchemaList1)) { - throw new InvalidTypeException("Invalid value stored for ioutil"); + throw new RuntimeException("Invalid value stored for ioutil"); } return (Schema1.SchemaList1) value; } @@ -91,7 +90,7 @@ public Schema1.SchemaList1 ioutil() { public Schema0.SchemaList0 pipe() { @Nullable Object value = get("pipe"); if (!(value instanceof Schema0.SchemaList0)) { - throw new InvalidTypeException("Invalid value stored for pipe"); + throw new RuntimeException("Invalid value stored for pipe"); } return (Schema0.SchemaList0) value; } @@ -99,7 +98,7 @@ public Schema0.SchemaList0 pipe() { public String refParam() { @Nullable Object value = get("refParam"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for refParam"); + throw new RuntimeException("Invalid value stored for refParam"); } return (String) value; } @@ -107,7 +106,7 @@ public String refParam() { public Schema3.SchemaList3 url() { @Nullable Object value = get("url"); if (!(value instanceof Schema3.SchemaList3)) { - throw new InvalidTypeException("Invalid value stored for url"); + throw new RuntimeException("Invalid value stored for url"); } return (Schema3.SchemaList3) value; } @@ -1457,7 +1456,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -1465,7 +1464,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -1475,7 +1474,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -1487,29 +1486,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java index 68868dd0442..e24c9f4f38b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.faketestqueryparamters.put.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java index 0c364247e83..6a6b47f4a85 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter0/Schema0.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -105,12 +104,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -130,29 +129,29 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java index 53e9e106e7b..c386c6cd560 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter1/Schema1.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -105,12 +104,12 @@ public SchemaList1 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -130,29 +129,29 @@ public SchemaList1 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema11BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema11BoxedList(validate(arg, configuration)); } @Override - public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema11Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java index 8b001cea7dc..b9a650f1e17 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter2/Schema2.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -105,12 +104,12 @@ public SchemaList2 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -130,29 +129,29 @@ public SchemaList2 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema21BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema21BoxedList(validate(arg, configuration)); } @Override - public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema21Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java index 6f94b32c521..2e44f938af9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter3/Schema3.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -105,12 +104,12 @@ public SchemaList3 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -130,29 +129,29 @@ public SchemaList3 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema31BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema31BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema31BoxedList(validate(arg, configuration)); } @Override - public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema31Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java index 92352108c2d..5dcc583172d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/faketestqueryparamters/put/parameters/parameter4/Schema4.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -105,12 +104,12 @@ public SchemaList4 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -130,29 +129,29 @@ public SchemaList4 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema41BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema41BoxedList(validate(arg, configuration)); } @Override - public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema41Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java index 2af6f43a3cf..0cfde8026ef 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.RequestBody; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeuploaddownloadfile; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java index 0dbaf136d1e..480f5c0801a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationoctetstreamRequestBody requestBody0 = (ApplicationoctetstreamRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java index f7be0054859..2a8598335a0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java index ed9e9a5ddd3..f9b8bd33e16 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploaddownloadfile/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploaddownloadfile.post.responses.code200response.content.applicationoctetstream.ApplicationoctetstreamSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationoctetstreamMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationoctetstreamResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationoctetstreamMediaType thisMediaType = (ApplicationoctetstreamMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationoctetstreamResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java index 15587ef4551..87f187dd7e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakeuploadfile.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeuploadfile.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeuploadfile; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java index 972187e5cca..c9165873f80 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeuploadfile.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java index 033ad2c8f72..d57c98d7c24 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 36009ea124b..bc7210852e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -69,7 +68,7 @@ public static MultipartformdataSchemaMap of(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -201,7 +200,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -211,7 +210,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -223,29 +222,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java index 28e807c4652..5ef05875230 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfile/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploadfile.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java index d5ebe401be7..7be8841da1e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.paths.fakeuploadfiles.post.RequestBody; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakeuploadfiles.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Fakeuploadfiles; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -63,7 +66,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java index 221c62968d4..418dbfd9b9a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.fakeuploadfiles.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java index 1fa96a8e7e1..2507eff62d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index 08b9aaee4b3..ceefe884ce3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -114,12 +113,12 @@ public MultipartformdataFilesList getNewInstance(List arg, List pathT itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -139,29 +138,29 @@ public MultipartformdataFilesList validate(List arg, SchemaConfiguration conf } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataFilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataFilesBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataFilesBoxedList(validate(arg, configuration)); } @Override - public MultipartformdataFilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataFilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -182,7 +181,7 @@ public MultipartformdataFilesList files() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof MultipartformdataFilesList)) { - throw new InvalidTypeException("Invalid value stored for files"); + throw new RuntimeException("Invalid value stored for files"); } return (MultipartformdataFilesList) value; } @@ -267,7 +266,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -275,7 +274,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -285,7 +284,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -297,29 +296,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java index 3a6ae53b8c7..8491068775e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakeuploadfiles/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakeuploadfiles.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java index 05d40d58ab6..fe290c34307 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/Get.java @@ -3,10 +3,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Fakewildcardresponses; import java.io.IOException; @@ -25,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java index 2070a4ae1db..70451e1cb4c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/Responses.java @@ -7,6 +7,8 @@ import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code4XXResponse; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.Code5XXResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -80,7 +82,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer != null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java index 5ff45188ea1..4bb1a115b72 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code1XXResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code1xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code1XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java index d3071a30f8b..8138d8bc1a7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java index f228579433a..3d9e6eb5638 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code2XXResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code2xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code2XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java index ed9d6a23972..5a177c3e8ae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code3XXResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code3xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code3XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java index eb7716a00f8..944465a02ea 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code4XXResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code4xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code4XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java index 9f7c642f907..46d31fd8f01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/fakewildcardresponses/get/responses/Code5XXResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.fakewildcardresponses.get.responses.code5xxresponse.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public Code5XXResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java index bcb2ea6f22e..ca58d9e23fe 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/Get.java @@ -3,10 +3,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.paths.foo.get.FooGetServerInfo; import org.openapijsonschematools.client.paths.foo.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Foo; import java.io.IOException; @@ -25,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java index 45d598bb653..2a4ba33c38a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/FooGetServerInfo.java @@ -1,72 +1,39 @@ package org.openapijsonschematools.client.paths.foo.get; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer0; import org.openapijsonschematools.client.paths.foo.get.servers.FooGetServer1; import org.openapijsonschematools.client.servers.Server; import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.AbstractMap; -import java.util.Map; import java.util.Objects; -import java.util.EnumMap; -public class FooGetServerInfo implements ServerProvider { - final private Servers servers; - final private ServerIndex serverIndex; +public class FooGetServerInfo { + public static class FooGetServerInfo1 implements ServerProvider { + public final FooGetServer0 server0; + public final FooGetServer1 server1; - public FooGetServerInfo() { - this.servers = new Servers(); - this.serverIndex = ServerIndex.SERVER_0; - } - - public FooGetServerInfo(Servers servers, ServerIndex serverIndex) { - this.servers = servers; - this.serverIndex = serverIndex; - } - - public static class Servers { - private final EnumMap servers; - - public Servers() { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - new FooGetServer0() - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - new FooGetServer1() - ) - ) - ); + public FooGetServerInfo1() { + server0 = new FooGetServer0(); + server1 = new FooGetServer1(); } - public Servers( + public FooGetServerInfo1( @Nullable FooGetServer0 server0, @Nullable FooGetServer1 server1 ) { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - Objects.requireNonNullElseGet(server0, FooGetServer0::new) - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - Objects.requireNonNullElseGet(server1, FooGetServer1::new) - ) - ) - ); + this.server0 = Objects.requireNonNullElseGet(server0, FooGetServer0::new); + this.server1 = Objects.requireNonNullElseGet(server1, FooGetServer1::new); } - public Server get(ServerIndex serverIndex) { - if (servers.containsKey(serverIndex)) { - return get(serverIndex); + @Override + public Server getServer(ServerIndex serverIndex) { + switch (serverIndex) { + case SERVER_0: + return server0; + default: + return server1; } - throw new UnsetPropertyException(serverIndex+" is unset"); } } @@ -74,11 +41,4 @@ public enum ServerIndex { SERVER_0, SERVER_1 } - - public Server getServer(@Nullable ServerIndex serverIndex) { - if (serverIndex == null) { - return servers.get(this.serverIndex); - } - return servers.get(serverIndex); - } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java index 21bffb7e427..63a2d1d6c22 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.foo.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -27,7 +29,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java index 91752fd80e6..28ef2eae71c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/CodedefaultResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.foo.get.responses.codedefaultresponse.content.applicationjson.ApplicationjsonSchema; @@ -37,16 +39,10 @@ public CodedefaultResponse1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } - if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { - var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); - return new ApplicationjsonResponseBody(deserializedBody); - } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonResponseBody(deserializedBody); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java index 8e89dece1b4..860a1e86279 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/responses/codedefaultresponse/content/applicationjson/ApplicationjsonSchema.java @@ -12,7 +12,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -121,7 +120,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -129,7 +128,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -139,7 +138,7 @@ public ApplicationjsonSchemaMap getNewInstance(Map arg, List pathT return new ApplicationjsonSchemaMap(castProperties); } - public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -151,29 +150,29 @@ public ApplicationjsonSchemaMap validate(Map arg, SchemaConfiguration conf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationjsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationjsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java index 4c00686226e..336ea6edf71 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/FooGetServer1.java @@ -2,6 +2,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.servers.ServerWithVariables; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.paths.foo.get.servers.server1.Variables; @@ -9,16 +10,23 @@ import java.util.AbstractMap; public class FooGetServer1 extends ServerWithVariables { - - public FooGetServer1() { - super( - "https://petstore.swagger.io/{version}", - Variables.Variables1.getInstance().validate( + private static Variables.VariablesMap getVariables() { + try { + return Variables.Variables1.getInstance().validate( MapUtils.makeMap( new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ) + ); + } catch (ValidationException e) { + throw new RuntimeException(e); + } + } + + public FooGetServer1() { + super( + "https://petstore.swagger.io/{version}", + getVariables() ); } public FooGetServer1(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java index 58d5f36188c..8cc25687164 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/foo/get/servers/server1/Variables.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -112,35 +111,35 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new VersionBoxedString(validate(arg, configuration)); } @Override - public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -157,7 +156,11 @@ public static VariablesMap of(Map arg, SchemaConfiguration confi } public String version() { - return getOrThrow("version"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -248,7 +251,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -256,12 +259,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -269,7 +272,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -281,29 +284,29 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java index 4f3edb0706a..8ac322b163d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Post.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.pet.post.PetPostSecurityInfo; import org.openapijsonschematools.client.paths.pet.post.RequestBody; import org.openapijsonschematools.client.paths.pet.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Pet; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -31,7 +34,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -72,7 +75,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java index 60f2021f717..e75a9b792d3 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/Put.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.pet.put.PetPutSecurityInfo; import org.openapijsonschematools.client.paths.pet.put.RequestBody; import org.openapijsonschematools.client.paths.pet.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Pet; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -31,7 +34,7 @@ public static Void put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -72,7 +75,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void put(PutRequest request) throws IOException, InterruptedException { + default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java index 33c0fb012db..91df6b3f3e8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/PetPostSecurityInfo.java @@ -6,24 +6,28 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetPostSecurityInfo { public static class PetPostSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetPostSecurityRequirementObject0 security0; + public final PetPostSecurityRequirementObject1 security1; + public final PetPostSecurityRequirementObject2 security2; public PetPostSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetPostSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetPostSecurityRequirementObject1()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new PetPostSecurityRequirementObject2()) - )); + security0 = new PetPostSecurityRequirementObject0(); + security1 = new PetPostSecurityRequirementObject1(); + security2 = new PetPostSecurityRequirementObject2(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + case SECURITY_1: + return security1; + default: + return security2; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java index db2e91906cc..1e44c96d53e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.pet.post.responses.Code200Response; import org.openapijsonschematools.client.paths.pet.post.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java index 539923899ea..207a4ef554f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/post/responses/Code405Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code405Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java index a8276f457ba..35d27e66846 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/PetPutSecurityInfo.java @@ -5,23 +5,24 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetPutSecurityInfo { public static class PetPutSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetPutSecurityRequirementObject0 security0; + public final PetPutSecurityRequirementObject1 security1; public PetPutSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetPutSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetPutSecurityRequirementObject1()) - )); + security0 = new PetPutSecurityRequirementObject0(); + security1 = new PetPutSecurityRequirementObject1(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java index 73c9bfd8cd1..c5ef091d53a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/Responses.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.paths.pet.put.responses.Code404Response; import org.openapijsonschematools.client.paths.pet.put.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -33,7 +35,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java index e94b1366c9a..27021cdf728 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code400Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java index 15458d50d4f..b74b875389c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code404Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java index e3ba5312b16..350e155a9c0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/pet/put/responses/Code405Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code405Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java index 50f9742a8b3..aa30e9bf00f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/Get.java @@ -6,10 +6,13 @@ import org.openapijsonschematools.client.paths.petfindbystatus.get.QueryParameters; import org.openapijsonschematools.client.paths.petfindbystatus.get.Parameters; import org.openapijsonschematools.client.paths.petfindbystatus.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petfindbystatus; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -30,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -69,7 +72,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java index 6e499330caf..03839fc4b75 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/PetfindbystatusServerInfo.java @@ -1,72 +1,39 @@ package org.openapijsonschematools.client.paths.petfindbystatus; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer0; import org.openapijsonschematools.client.paths.petfindbystatus.servers.PetfindbystatusServer1; import org.openapijsonschematools.client.servers.Server; import org.openapijsonschematools.client.servers.ServerProvider; import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.AbstractMap; -import java.util.Map; import java.util.Objects; -import java.util.EnumMap; -public class PetfindbystatusServerInfo implements ServerProvider { - final private Servers servers; - final private ServerIndex serverIndex; +public class PetfindbystatusServerInfo { + public static class PetfindbystatusServerInfo1 implements ServerProvider { + public final PetfindbystatusServer0 server0; + public final PetfindbystatusServer1 server1; - public PetfindbystatusServerInfo() { - this.servers = new Servers(); - this.serverIndex = ServerIndex.SERVER_0; - } - - public PetfindbystatusServerInfo(Servers servers, ServerIndex serverIndex) { - this.servers = servers; - this.serverIndex = serverIndex; - } - - public static class Servers { - private final EnumMap servers; - - public Servers() { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - new PetfindbystatusServer0() - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - new PetfindbystatusServer1() - ) - ) - ); + public PetfindbystatusServerInfo1() { + server0 = new PetfindbystatusServer0(); + server1 = new PetfindbystatusServer1(); } - public Servers( + public PetfindbystatusServerInfo1( @Nullable PetfindbystatusServer0 server0, @Nullable PetfindbystatusServer1 server1 ) { - servers = new EnumMap<>( - Map.ofEntries( - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_0, - Objects.requireNonNullElseGet(server0, PetfindbystatusServer0::new) - ), - new AbstractMap.SimpleEntry<>( - ServerIndex.SERVER_1, - Objects.requireNonNullElseGet(server1, PetfindbystatusServer1::new) - ) - ) - ); + this.server0 = Objects.requireNonNullElseGet(server0, PetfindbystatusServer0::new); + this.server1 = Objects.requireNonNullElseGet(server1, PetfindbystatusServer1::new); } - public Server get(ServerIndex serverIndex) { - if (servers.containsKey(serverIndex)) { - return get(serverIndex); + @Override + public Server getServer(ServerIndex serverIndex) { + switch (serverIndex) { + case SERVER_0: + return server0; + default: + return server1; } - throw new UnsetPropertyException(serverIndex+" is unset"); } } @@ -74,11 +41,4 @@ public enum ServerIndex { SERVER_0, SERVER_1 } - - public Server getServer(@Nullable ServerIndex serverIndex) { - if (serverIndex == null) { - return servers.get(this.serverIndex); - } - return servers.get(serverIndex); - } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java index feb7a695ede..7e2dd18d844 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.java @@ -6,24 +6,28 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetfindbystatusGetSecurityInfo { public static class PetfindbystatusGetSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetfindbystatusGetSecurityRequirementObject0 security0; + public final PetfindbystatusGetSecurityRequirementObject1 security1; + public final PetfindbystatusGetSecurityRequirementObject2 security2; public PetfindbystatusGetSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetfindbystatusGetSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetfindbystatusGetSecurityRequirementObject1()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new PetfindbystatusGetSecurityRequirementObject2()) - )); + security0 = new PetfindbystatusGetSecurityRequirementObject0(); + security1 = new PetfindbystatusGetSecurityRequirementObject1(); + security2 = new PetfindbystatusGetSecurityRequirementObject2(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + case SECURITY_1: + return security1; + default: + return security2; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java index 7ce798858e4..90468bd21f2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petfindbystatus.get.parameters.parameter0.Schema0; @@ -56,7 +55,11 @@ public static QueryParametersMap of(Map> arg, SchemaConfigu } public Schema0.SchemaList0 status() { - return getOrThrow("status"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -141,7 +144,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -149,12 +152,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Schema0.SchemaList0)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Schema0.SchemaList0) propertyInstance); } @@ -162,7 +165,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -174,29 +177,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java index bb6a09ea78c..4e008e2a33b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.Code200Response; import org.openapijsonschematools.client.paths.petfindbystatus.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java index 5594071aee6..d45479cd0dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/parameters/parameter0/Schema0.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.SetMaker; import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod; @@ -95,35 +94,35 @@ public String validate(StringItemsEnums0 arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items0BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new Items0BoxedString(validate(arg, configuration)); } @Override - public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Items0Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -203,12 +202,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -228,29 +227,29 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java index 43e52729869..3ea6e1da098 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/get/responses/Code400Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java index 365a0597ded..e36810b4c40 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/PetfindbystatusServer1.java @@ -2,6 +2,7 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.servers.ServerWithVariables; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.openapijsonschematools.client.paths.petfindbystatus.servers.server1.Variables; @@ -9,16 +10,23 @@ import java.util.AbstractMap; public class PetfindbystatusServer1 extends ServerWithVariables { - - public PetfindbystatusServer1() { - super( - "https://petstore.swagger.io/{version}", - Variables.Variables1.getInstance().validate( + private static Variables.VariablesMap getVariables() { + try { + return Variables.Variables1.getInstance().validate( MapUtils.makeMap( new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ) + ); + } catch (ValidationException e) { + throw new RuntimeException(e); + } + } + + public PetfindbystatusServer1() { + super( + "https://petstore.swagger.io/{version}", + getVariables() ); } public PetfindbystatusServer1(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java index e622b7ac02a..402b2e4be8b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbystatus/servers/server1/Variables.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -112,35 +111,35 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new VersionBoxedString(validate(arg, configuration)); } @Override - public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -157,7 +156,11 @@ public static VariablesMap of(Map arg, SchemaConfiguration confi } public String version() { - return getOrThrow("version"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -248,7 +251,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -256,12 +259,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -269,7 +272,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -281,29 +284,29 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java index 0ce665bc5e0..f29d6b59081 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/Get.java @@ -6,10 +6,13 @@ import org.openapijsonschematools.client.paths.petfindbytags.get.QueryParameters; import org.openapijsonschematools.client.paths.petfindbytags.get.Parameters; import org.openapijsonschematools.client.paths.petfindbytags.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petfindbytags; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -30,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -69,7 +72,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java index 7005499fb3e..4c4856f98eb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.java @@ -5,23 +5,24 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetfindbytagsGetSecurityInfo { public static class PetfindbytagsGetSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetfindbytagsGetSecurityRequirementObject0 security0; + public final PetfindbytagsGetSecurityRequirementObject1 security1; public PetfindbytagsGetSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetfindbytagsGetSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetfindbytagsGetSecurityRequirementObject1()) - )); + security0 = new PetfindbytagsGetSecurityRequirementObject0(); + security1 = new PetfindbytagsGetSecurityRequirementObject1(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java index c4ef93d3f01..11bb6b1896d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petfindbytags.get.parameters.parameter0.Schema0; @@ -56,7 +55,11 @@ public static QueryParametersMap of(Map> arg, SchemaConfigu } public Schema0.SchemaList0 tags() { - return getOrThrow("tags"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -141,7 +144,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -149,12 +152,12 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Schema0.SchemaList0)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Schema0.SchemaList0) propertyInstance); } @@ -162,7 +165,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -174,29 +177,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java index 82003a8b683..b29be24d716 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.petfindbytags.get.responses.Code200Response; import org.openapijsonschematools.client.paths.petfindbytags.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java index 1660a363a63..420ca7fe8b4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/parameters/parameter0/Schema0.java @@ -9,7 +9,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.schemas.validation.FrozenList; @@ -105,12 +104,12 @@ public SchemaList0 getNewInstance(List arg, List pathToItem, PathToSc itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object itemInstance = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(itemInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } items.add((String) itemInstance); i += 1; @@ -130,29 +129,29 @@ public SchemaList0 validate(List arg, SchemaConfiguration configuration) thro } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedList(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java index 7d7ae379884..b674ee9ab33 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petfindbytags/get/responses/Code400Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java index 4d3f69226eb..4504536c416 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Delete.java @@ -7,10 +7,13 @@ import org.openapijsonschematools.client.paths.petpetid.delete.PathParameters; import org.openapijsonschematools.client.paths.petpetid.delete.Parameters; import org.openapijsonschematools.client.paths.petpetid.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petpetid; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -31,7 +34,7 @@ public static Void delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -75,7 +78,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void delete(DeleteRequest request) throws IOException, InterruptedException { + default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java index f3dc2ac9e94..d61d683a408 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Get.java @@ -6,10 +6,13 @@ import org.openapijsonschematools.client.paths.petpetid.get.PathParameters; import org.openapijsonschematools.client.paths.petpetid.get.Parameters; import org.openapijsonschematools.client.paths.petpetid.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Petpetid; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -30,7 +33,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -68,7 +71,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java index 0d1433ab2ae..b9ad09b7104 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/Post.java @@ -7,10 +7,13 @@ import org.openapijsonschematools.client.paths.petpetid.post.PathParameters; import org.openapijsonschematools.client.paths.petpetid.post.Parameters; import org.openapijsonschematools.client.paths.petpetid.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Petpetid; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -33,7 +36,7 @@ public static Void post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -81,7 +84,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void post(PostRequest request) throws IOException, InterruptedException { + default Void post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java index e35183de207..044c81974e6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/HeaderParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter0.Schema0; @@ -130,7 +129,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -138,12 +137,12 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -151,7 +150,7 @@ public HeaderParametersMap getNewInstance(Map arg, List pathToItem return new HeaderParametersMap(castProperties); } - public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,29 +162,29 @@ public HeaderParametersMap validate(Map arg, SchemaConfiguration configura @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new HeaderParameters1BoxedMap(validate(arg, configuration)); } @Override - public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public HeaderParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java index 59fe1814cc8..ed599dfe636 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.delete.parameters.parameter1.Schema1; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number petId() { - return getOrThrow("petId"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -158,7 +161,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -166,12 +169,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -179,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,29 +194,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java index c71ee0107bc..941f3f23abf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/PetpetidDeleteSecurityInfo.java @@ -5,23 +5,24 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetpetidDeleteSecurityInfo { public static class PetpetidDeleteSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetpetidDeleteSecurityRequirementObject0 security0; + public final PetpetidDeleteSecurityRequirementObject1 security1; public PetpetidDeleteSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetidDeleteSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetpetidDeleteSecurityRequirementObject1()) - )); + security0 = new PetpetidDeleteSecurityRequirementObject0(); + security1 = new PetpetidDeleteSecurityRequirementObject1(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java index 5211c9c2cd3..6c5d7573a1a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.petpetid.delete.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -25,7 +27,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java index 1fdfd986a90..48b687555cd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/delete/responses/Code400Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java index d6dc72541d6..65b7c41a406 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.get.parameters.parameter0.Schema0; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number petId() { - return getOrThrow("petId"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -158,7 +161,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -166,12 +169,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -179,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,29 +194,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java index ea5c2dfa9c2..4d21d88f82e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/PetpetidGetSecurityInfo.java @@ -4,22 +4,17 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetpetidGetSecurityInfo { public static class PetpetidGetSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetpetidGetSecurityRequirementObject0 security0; public PetpetidGetSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetidGetSecurityRequirementObject0()) - )); + security0 = new PetpetidGetSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java index 9717fcb81d3..b0be031e585 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/Responses.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.paths.petpetid.get.responses.Code400Response; import org.openapijsonschematools.client.paths.petpetid.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -42,7 +44,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java index ebd39fc2a6e..2e28a301c5d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.petpetid.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -50,19 +52,15 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java index 7a6c696b19d..5bbc55f84a2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code400Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java index 58e9da0d7dc..0aa19c5d169 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/get/responses/Code404Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java index 8b31aa07e75..a4306745deb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetid.post.parameters.parameter0.Schema0; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number petId() { - return getOrThrow("petId"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -158,7 +161,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -166,12 +169,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -179,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,29 +194,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java index 192ccc51c6c..3763c38088a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/PetpetidPostSecurityInfo.java @@ -5,23 +5,24 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetpetidPostSecurityInfo { public static class PetpetidPostSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetpetidPostSecurityRequirementObject0 security0; + public final PetpetidPostSecurityRequirementObject1 security1; public PetpetidPostSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetidPostSecurityRequirementObject0()), - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new PetpetidPostSecurityRequirementObject1()) - )); + security0 = new PetpetidPostSecurityRequirementObject0(); + security1 = new PetpetidPostSecurityRequirementObject1(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + switch (securityIndex) { + case SECURITY_0: + return security0; + default: + return security1; + } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java index bcfe59527bb..00ba6ed79f2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.petpetid.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationxwwwformurlencodedRequestBody requestBody0 = (ApplicationxwwwformurlencodedRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java index b0e7a2d9012..0f129ddcc1d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.petpetid.post.responses.Code405Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -25,7 +27,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java index 0d9bbc0816a..0b10b8675bd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -69,7 +68,7 @@ public String name() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for name"); + throw new RuntimeException("Invalid value stored for name"); } return (String) value; } @@ -79,7 +78,7 @@ public String status() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for status"); + throw new RuntimeException("Invalid value stored for status"); } return (String) value; } @@ -180,7 +179,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -188,7 +187,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -198,7 +197,7 @@ public ApplicationxwwwformurlencodedSchemaMap getNewInstance(Map arg, List return new ApplicationxwwwformurlencodedSchemaMap(castProperties); } - public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -210,29 +209,29 @@ public ApplicationxwwwformurlencodedSchemaMap validate(Map arg, SchemaConf @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ApplicationxwwwformurlencodedSchema1BoxedMap(validate(arg, configuration)); } @Override - public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ApplicationxwwwformurlencodedSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java index 62d6a28f1be..4dfaf36ff01 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetid/post/responses/Code405Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code405Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java index f628d4069c0..372c6fffde0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/Post.java @@ -7,10 +7,13 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.PathParameters; import org.openapijsonschematools.client.paths.petpetiduploadimage.post.Parameters; import org.openapijsonschematools.client.paths.petpetiduploadimage.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Petpetiduploadimage; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; @@ -33,7 +36,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); @Nullable SerializedRequestBody serializedRequestBody; @@ -81,7 +84,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java index 8621fb63da8..9418fd079ae 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.petpetiduploadimage.post.parameters.parameter0.Schema0; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number petId() { - return getOrThrow("petId"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -158,7 +161,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -166,12 +169,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -179,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,29 +194,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java index 1ec53a24fb0..0418c7b90c0 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.java @@ -4,22 +4,17 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class PetpetiduploadimagePostSecurityInfo { public static class PetpetiduploadimagePostSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final PetpetiduploadimagePostSecurityRequirementObject0 security0; public PetpetiduploadimagePostSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new PetpetiduploadimagePostSecurityRequirementObject0()) - )); + security0 = new PetpetiduploadimagePostSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java index 8fd7c0f6302..81fe04dc837 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.petpetiduploadimage.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { MultipartformdataRequestBody requestBody0 = (MultipartformdataRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java index 2510fe73af5..ed5b656f912 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.petpetiduploadimage.post.responses.Code200Response; import org.openapijsonschematools.client.components.responses.successwithjsonapiresponse.SuccessWithJsonApiResponseHeadersSchema; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -35,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java index f809a516e10..e6b3f39636f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.GenericBuilder; @@ -70,7 +69,7 @@ public String additionalMetadata() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for additionalMetadata"); + throw new RuntimeException("Invalid value stored for additionalMetadata"); } return (String) value; } @@ -80,7 +79,7 @@ public String file() throws UnsetPropertyException { throwIfKeyNotPresent(key); @Nullable Object value = get(key); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for file"); + throw new RuntimeException("Invalid value stored for file"); } return (String) value; } @@ -181,7 +180,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -189,7 +188,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -199,7 +198,7 @@ public MultipartformdataSchemaMap getNewInstance(Map arg, List pat return new MultipartformdataSchemaMap(castProperties); } - public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -211,29 +210,29 @@ public MultipartformdataSchemaMap validate(Map arg, SchemaConfiguration co @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MultipartformdataSchema1BoxedMap(validate(arg, configuration)); } @Override - public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MultipartformdataSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java index 6670ce4e8dd..111e91bdcf4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/Get.java @@ -3,10 +3,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.solidus.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Solidus; import java.io.IOException; @@ -25,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java index 8f8f1f3fc78..2c1b302e62b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/solidus/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.solidus.get.responses.Code200Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -34,7 +36,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java index d6aefad8f01..49e7b1d5ab7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/Get.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.storeinventory.get.StoreinventoryGetSecurityInfo; import org.openapijsonschematools.client.paths.storeinventory.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Storeinventory; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.AuthApplier; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -63,7 +66,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java index ce5360d0cdb..1390a3b9d94 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.storeinventory.get.responses.Code200Response; import org.openapijsonschematools.client.components.responses.successinlinecontentandheader.SuccessInlineContentAndHeaderHeadersSchema; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -35,7 +37,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java index c263a4e51f8..5c661cfd67c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeinventory/get/StoreinventoryGetSecurityInfo.java @@ -4,22 +4,17 @@ import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObject; import org.openapijsonschematools.client.securityrequirementobjects.SecurityRequirementObjectProvider; -import java.util.AbstractMap; -import java.util.Map; -import java.util.EnumMap; - public class StoreinventoryGetSecurityInfo { public static class StoreinventoryGetSecurityInfo1 implements SecurityRequirementObjectProvider { - final public EnumMap securities; + public final StoreinventoryGetSecurityRequirementObject0 security0; public StoreinventoryGetSecurityInfo1() { - this.securities = new EnumMap<>(Map.ofEntries( - new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new StoreinventoryGetSecurityRequirementObject0()) - )); + security0 = new StoreinventoryGetSecurityRequirementObject0(); } + @Override public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { - return securities.get(securityIndex); + return security0; } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java index b357d8afaf0..ba0d5c15793 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.storeorder.post.RequestBody; import org.openapijsonschematools.client.paths.storeorder.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Storeorder; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java index fa09117b1c6..917836e859f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.storeorder.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java index 22f2bd6a7f1..c62c12edaf2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.storeorder.post.responses.Code200Response; import org.openapijsonschematools.client.paths.storeorder.post.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java index 955c9af34c2..fc535ab3955 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.storeorder.post.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -50,19 +52,15 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java index bf641ab9529..3d9ae44d402 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorder/post/responses/Code400Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java index d3afe2ab708..12139abd4b9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Delete.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.storeorderorderid.delete.PathParameters; import org.openapijsonschematools.client.paths.storeorderorderid.delete.Parameters; import org.openapijsonschematools.client.paths.storeorderorderid.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Storeorderorderid; import java.io.IOException; @@ -27,7 +30,7 @@ public static Void delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -55,7 +58,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void delete(DeleteRequest request) throws IOException, InterruptedException { + default Void delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java index 67fd560dc7c..e585a91d120 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/Get.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.storeorderorderid.get.PathParameters; import org.openapijsonschematools.client.paths.storeorderorderid.get.Parameters; import org.openapijsonschematools.client.paths.storeorderorderid.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Storeorderorderid; import java.io.IOException; @@ -27,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -55,7 +58,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java index 52aaca5fe26..d1a63779d53 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.storeorderorderid.delete.parameters.parameter0.Schema0; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String order_id() { - return getOrThrow("order_id"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -140,7 +143,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -148,12 +151,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -161,7 +164,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -173,29 +176,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java index f811aab1d28..5e9f34d93b7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code400Response; import org.openapijsonschematools.client.paths.storeorderorderid.delete.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -29,7 +31,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java index a0291a06814..7ad936566fc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code400Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java index 99efb7324e5..565b71b9a4f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/delete/responses/Code404Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java index d52c74e5c24..106faf07142 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/PathParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.storeorderorderid.get.parameters.parameter0.Schema0; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public Number order_id() { - return getOrThrow("order_id"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -158,7 +161,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -166,12 +169,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof Number)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (Number) propertyInstance); } @@ -179,7 +182,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -191,29 +194,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java index 9aa9e0eb735..5c23d3cc14c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/Responses.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code400Response; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -42,7 +44,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java index 44fca5e5ac4..9d05f93bfb2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/parameters/parameter0/Schema0.java @@ -7,7 +7,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -84,29 +83,29 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Schema01BoxedNumber(validate(arg, configuration)); } @Override - public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Schema01Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java index 44e93fc81e5..e0cea6e6191 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.storeorderorderid.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -50,19 +52,15 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java index 00aa94771da..c3304e02b39 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code400Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java index eb7b27cea75..5de14a5ccd1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/storeorderorderid/get/responses/Code404Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java index 596a04b8a31..51f43cc60ac 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.user.post.RequestBody; import org.openapijsonschematools.client.paths.user.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.User; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java index 9db899fe59e..52a467ba8dd 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.user.post; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java index cd6bedeaa49..c1cc62b43da 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.user.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -27,7 +29,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java index e3555812d7d..20148c56e39 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/user/post/responses/CodedefaultResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java index b227be4320d..a2d805d6d78 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.usercreatewitharray.post.RequestBody; import org.openapijsonschematools.client.paths.usercreatewitharray.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Usercreatewitharray; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java index 90079ade7ee..79c988e4f1b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.usercreatewitharray.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -27,7 +29,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java index 1de3940666e..bd617d9262d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewitharray/post/responses/CodedefaultResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java index 664e4d200f5..f8f78fabe13 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/Post.java @@ -4,10 +4,13 @@ import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.usercreatewithlist.post.RequestBody; import org.openapijsonschematools.client.paths.usercreatewithlist.post.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Usercreatewithlist; @@ -28,7 +31,7 @@ public static Responses.EndpointResponse post( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -59,7 +62,7 @@ public interface PostOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse post(PostRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PostProvider.post(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java index 4d37cf3af39..8c24f5ea31e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.usercreatewithlist.post.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -27,7 +29,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java index 71c7481101d..a8989114b04 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/usercreatewithlist/post/responses/CodedefaultResponse.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public CodedefaultResponse1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java index 97207e125a0..c2660417c71 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/Get.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.userlogin.get.QueryParameters; import org.openapijsonschematools.client.paths.userlogin.get.Parameters; import org.openapijsonschematools.client.paths.userlogin.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userlogin; import java.io.IOException; @@ -27,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -56,7 +59,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java index 8c5b619443c..01dd3860ee8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/QueryParameters.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.userlogin.get.parameters.parameter0.Schema0; @@ -59,7 +58,7 @@ public static QueryParametersMap of(Map arg, public String password() { @Nullable Object value = get("password"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for password"); + throw new RuntimeException("Invalid value stored for password"); } return (String) value; } @@ -67,7 +66,7 @@ public String password() { public String username() { @Nullable Object value = get("username"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for username"); + throw new RuntimeException("Invalid value stored for username"); } return (String) value; } @@ -197,7 +196,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -205,7 +204,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -215,7 +214,7 @@ public QueryParametersMap getNewInstance(Map arg, List pathToItem, return new QueryParametersMap(castProperties); } - public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -227,29 +226,29 @@ public QueryParametersMap validate(Map arg, SchemaConfiguration configurat @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new QueryParameters1BoxedMap(validate(arg, configuration)); } @Override - public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public QueryParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java index f31d4fdabf4..0df32af2421 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/Responses.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.Code200ResponseHeadersSchema; import org.openapijsonschematools.client.paths.userlogin.get.responses.Code400Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -39,7 +41,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java index fc6f3fd1454..399cc9fd94f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -52,23 +54,19 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override - protected Code200ResponseHeadersSchema.Code200ResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + protected Code200ResponseHeadersSchema.Code200ResponseHeadersSchemaMap getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { return new Headers().deserialize(headers, configuration); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java index ff44cd75c14..a30d61bec1a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/Code400Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java index 5d9afd9e8f9..4b54d1e388b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/Code200ResponseHeadersSchema.java @@ -13,7 +13,6 @@ import org.openapijsonschematools.client.components.schemas.StringWithValidation; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xexpiresafter.XExpiresAfterSchema; @@ -66,7 +65,7 @@ public static Code200ResponseHeadersSchemaMap of(Map arg, List entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -339,7 +338,7 @@ public Code200ResponseHeadersSchemaMap getNewInstance(Map arg, List, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -349,7 +348,7 @@ public Code200ResponseHeadersSchemaMap getNewInstance(Map arg, List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Code200ResponseHeadersSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -361,29 +360,29 @@ public Code200ResponseHeadersSchemaMap validate(Map arg, SchemaConfigurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Code200ResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Code200ResponseHeadersSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Code200ResponseHeadersSchema1BoxedMap(validate(arg, configuration)); } @Override - public Code200ResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Code200ResponseHeadersSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java index 0bc9ca1d34c..f7e9a714406 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogin/get/responses/code200response/headers/XRateLimit.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.paths.userlogin.get.responses.code200response.headers.xratelimit.content.applicationjson.XRateLimitSchema; import java.util.AbstractMap; -import java.util.Map; public class XRateLimit { @@ -25,9 +24,7 @@ public XRateLimit1() { true, null, false, - Map.ofEntries( - new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) - ) + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType()) ); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java index d11d947f0b9..efc687945ab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/Get.java @@ -3,10 +3,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.RootServerInfo; import org.openapijsonschematools.client.paths.userlogout.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userlogout; import java.io.IOException; @@ -25,7 +28,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); // TODO set this to a map if there is a query security scheme @@ -50,7 +53,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java index 9bf34248b51..0093801140c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userlogout/get/Responses.java @@ -2,6 +2,8 @@ import org.openapijsonschematools.client.paths.userlogout.get.responses.CodedefaultResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -27,7 +29,7 @@ public Responses1() { this.defaultResponseDeserializer = new CodedefaultResponse.CodedefaultResponse1(); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); return new EndpointCodedefaultResponse(response, deserializedResponse.body(), deserializedResponse.headers()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java index 0b3743c7e0a..223efea0cce 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Delete.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.userusername.delete.PathParameters; import org.openapijsonschematools.client.paths.userusername.delete.Parameters; import org.openapijsonschematools.client.paths.userusername.delete.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userusername; import java.io.IOException; @@ -27,7 +30,7 @@ public static Responses.EndpointResponse delete( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -55,7 +58,7 @@ public interface DeleteOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse delete(DeleteRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return DeleteProvider.delete(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java index 759d511e42a..503ec431719 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Get.java @@ -5,10 +5,13 @@ import org.openapijsonschematools.client.paths.userusername.get.PathParameters; import org.openapijsonschematools.client.paths.userusername.get.Parameters; import org.openapijsonschematools.client.paths.userusername.get.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.paths.Userusername; import java.io.IOException; @@ -27,7 +30,7 @@ public static Responses.EndpointResponse get( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); @@ -55,7 +58,7 @@ public interface GetOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException { + default Responses.EndpointResponse get(GetRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return GetProvider.get(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java index 81a5f385aab..748d806d396 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/Put.java @@ -6,10 +6,13 @@ import org.openapijsonschematools.client.paths.userusername.put.PathParameters; import org.openapijsonschematools.client.paths.userusername.put.Parameters; import org.openapijsonschematools.client.paths.userusername.put.Responses; +import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.configurations.ApiConfiguration; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.restclient.RestClient; -import org.openapijsonschematools.client.apiclient.ApiClient; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; import org.openapijsonschematools.client.paths.Userusername; @@ -30,7 +33,7 @@ public static Void put( ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration, HttpClient client - ) throws IOException, InterruptedException { + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { Map> headers = apiConfiguration.getDefaultHeaders(); SerializedRequestBody serializedRequestBody = new RequestBody.RequestBody1().serialize( @@ -64,7 +67,7 @@ public interface PutOperation { ApiConfiguration getApiConfiguration(); SchemaConfiguration getSchemaConfiguration(); HttpClient getClient(); - default Void put(PutRequest request) throws IOException, InterruptedException { + default Void put(PutRequest request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { return PutProvider.put(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java index a8d9f3c2972..75de97ae0ee 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/PathParameters.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.parameters.pathusername.Schema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String username() { - return getOrThrow("username"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -140,7 +143,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -148,12 +151,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -161,7 +164,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -173,29 +176,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java index 5effba4ddc7..e5020958495 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.userusername.delete.responses.Code200Response; import org.openapijsonschematools.client.paths.userusername.delete.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -38,7 +40,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java index c456e073d08..ab220b57b21 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/delete/responses/Code404Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java index 084596e13a7..cf14e31de9d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/PathParameters.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.parameters.pathusername.Schema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String username() { - return getOrThrow("username"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -140,7 +143,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -148,12 +151,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -161,7 +164,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -173,29 +176,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java index 7be14427d06..320fedb631d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/Responses.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.paths.userusername.get.responses.Code400Response; import org.openapijsonschematools.client.paths.userusername.get.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ApiResponse; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; @@ -42,7 +44,7 @@ public Responses1() { ); } - public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public EndpointResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java index 3086e739dfb..e83a0bb7634 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code200Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationxml.ApplicationxmlSchema; import org.openapijsonschematools.client.paths.userusername.get.responses.code200response.content.applicationjson.ApplicationjsonSchema; @@ -50,19 +52,15 @@ public Code200Response1() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { if (mediaType instanceof ApplicationxmlMediaType thisMediaType) { var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationxmlResponseBody(deserializedBody); - } else if (mediaType instanceof ApplicationjsonMediaType thisMediaType) { + } else { + ApplicationjsonMediaType thisMediaType = (ApplicationjsonMediaType) mediaType; var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); return new ApplicationjsonResponseBody(deserializedBody); } - throw new RuntimeException("contentType="+contentType+" returned by the server is unknown and does not exist in the openapi document"); } @Override diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java index 1612e8c8da1..4fcdb4ca075 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code400Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java index 7533ab39e11..cfa381bd2a1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/get/responses/Code404Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java index 96b11df0969..a45316dbab8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/PathParameters.java @@ -11,7 +11,6 @@ import org.openapijsonschematools.client.components.parameters.pathusername.Schema; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -55,7 +54,11 @@ public static PathParametersMap of(Map arg, SchemaConfiguration } public String username() { - return getOrThrow("username"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -140,7 +143,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -148,12 +151,12 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -161,7 +164,7 @@ public PathParametersMap getNewInstance(Map arg, List pathToItem, return new PathParametersMap(castProperties); } - public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParametersMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -173,29 +176,29 @@ public PathParametersMap validate(Map arg, SchemaConfiguration configurati @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new PathParameters1BoxedMap(validate(arg, configuration)); } @Override - public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PathParameters1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java index 22d0e1f9007..5efb70e1d9b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/RequestBody.java @@ -4,6 +4,7 @@ package org.openapijsonschematools.client.paths.userusername.put; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.requestbody.RequestBodySerializer; import org.openapijsonschematools.client.requestbody.GenericRequestBody; import org.openapijsonschematools.client.requestbody.SerializedRequestBody; @@ -36,7 +37,7 @@ public RequestBody1() { ); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { ApplicationjsonRequestBody requestBody0 = (ApplicationjsonRequestBody) requestBody; return serialize(requestBody0.contentType(), requestBody0.body().getData()); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java index 996c3423963..732033d8a06 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/Responses.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.paths.userusername.put.responses.Code400Response; import org.openapijsonschematools.client.paths.userusername.put.responses.Code404Response; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.response.ResponsesDeserializer; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.checkerframework.checker.nullness.qual.Nullable; @@ -29,7 +31,7 @@ public Responses1() { ); } - public Void deserialize(HttpResponse response, SchemaConfiguration configuration) { + public Void deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { String statusCode = String.valueOf(response.statusCode()); @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); if (statusCodeDeserializer == null) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java index a9207b46b15..600fd3fe1df 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code400Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code400Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java index 6226880fa67..c7aea37db95 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/paths/userusername/put/responses/Code404Response.java @@ -4,6 +4,8 @@ import org.openapijsonschematools.client.response.ResponseDeserializer; import org.openapijsonschematools.client.response.DeserializedHttpResponse; import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import java.util.Map; @@ -21,7 +23,7 @@ public Code404Response1() { } @Override - protected Void getBody(String contentType, byte[] body, SchemaConfiguration configuration) { + protected Void getBody(String contentType, Void mediaType, byte[] body, SchemaConfiguration configuration) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java index 37fb90cd4f2..6be6cbffd80 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/requestbody/RequestBodySerializer.java @@ -5,6 +5,7 @@ import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeSerializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import java.util.Map; @@ -33,14 +34,14 @@ private SerializedRequestBody serializeTextPlain(String contentType, @Nullable O 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) { + 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 RuntimeException("Serialization has not yet been implemented for contentType="+contentType+". If you need it please file a PR"); + 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); + public abstract SerializedRequestBody serialize(T requestBody) throws NotImplementedException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java index bbd744abebc..9ec3e3c44a6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/HeadersDeserializer.java @@ -2,6 +2,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.header.Header; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; @@ -18,7 +20,7 @@ public HeadersDeserializer(Map headers, MapSchemaValidator headersToValidate = new HashMap<>(); for (Map.Entry> entry: responseHeaders.map().entrySet()) { String headerName = entry.getKey(); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java index 59079f9f1a1..640f2a96415 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponseDeserializer.java @@ -7,31 +7,27 @@ import java.util.Optional; import org.checkerframework.checker.nullness.qual.Nullable; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.ToNumberPolicy; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; import org.openapijsonschematools.client.contenttype.ContentTypeDeserializer; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ApiException; import org.openapijsonschematools.client.header.Header; public abstract class ResponseDeserializer { public final Map content; public final @Nullable Map headers; - private static final Gson gson = new GsonBuilder() - .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) - .create(); public ResponseDeserializer(Map content) { this.content = content; this.headers = null; } - protected abstract SealedBodyClass getBody(String contentType, byte[] body, SchemaConfiguration configuration); - protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration); + 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); @@ -42,7 +38,7 @@ protected String deserializeTextPlain(byte[] body) { return new String(body, StandardCharsets.UTF_8); } - protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) { + 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); @@ -50,23 +46,28 @@ protected T deserializeBody(String contentType, byte[] body, JsonSchema s String bodyData = deserializeTextPlain(body); return schema.validateAndBox(bodyData, configuration); } - throw new RuntimeException("Deserialization for contentType="+contentType+" has not yet been implemented."); + throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); } - public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) { + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { Optional contentTypeInfo = response.headers().firstValue("Content-Type"); if (contentTypeInfo.isEmpty()) { - throw new RuntimeException("Invalid response returned, Content-Type header is missing and it must be included"); + throw new ApiException( + "Invalid response returned, Content-Type header is missing and it must be included", + response + ); } String contentType = contentTypeInfo.get(); - if (content != null && !content.containsKey(contentType)) { - throw new RuntimeException( - "Invalid contentType returned. contentType="+contentType+" was returned "+ - "when only "+content.keySet()+" are defined for statusCode="+response.statusCode() + @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, bodyBytes, configuration); + SealedBodyClass body = getBody(contentType, mediaType, bodyBytes, configuration); HeaderClass headers = getHeaders(response.headers(), configuration); return new DeserializedHttpResponse<>(body, headers); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java index 20b56db17da..f72be2313af 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/response/ResponsesDeserializer.java @@ -2,7 +2,10 @@ import org.openapijsonschematools.client.configurations.SchemaConfiguration; import java.net.http.HttpResponse; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.ApiException; public interface ResponsesDeserializer { - SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration); + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java index 0ffcae114bd..7990efaa995 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -86,7 +85,7 @@ public static AnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -98,7 +97,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -110,7 +109,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -121,24 +120,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -170,7 +169,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -180,7 +179,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -197,7 +196,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -205,7 +204,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -214,7 +213,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -241,11 +240,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -260,41 +259,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -310,7 +309,7 @@ public AnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfig } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java index 2cceae9d49f..12af2ba8196 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/BooleanJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -44,7 +43,7 @@ public static BooleanJsonSchema1 getInstance() { } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,30 +59,30 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V boolean boolArg = (Boolean) arg; return getNewInstance(boolArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean) { boolean boolArg = (Boolean) arg; return validate(boolArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public BooleanJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Boolean booleanArg) { boolean castArg = booleanArg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java index 15b5ca67f26..4853a27dee8 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static DateJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -66,30 +65,30 @@ public String validate(LocalDate arg, SchemaConfiguration configuration) throws if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof LocalDate) { return validate((LocalDate) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java index e695f3c2ac9..a5b4f50d788 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static DateTimeJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -66,30 +65,30 @@ public String validate(ZonedDateTime arg, SchemaConfiguration configuration) thr if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } else if (arg instanceof ZonedDateTime) { return validate((ZonedDateTime) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DateTimeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DateTimeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java index f961e94f802..6651aa44497 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DecimalJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static DecimalJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,28 +60,28 @@ public String validate(String arg, SchemaConfiguration configuration) throws Val if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DecimalJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new DecimalJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DecimalJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java index 56f7894f670..9bcb31d2068 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/DoubleJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static DoubleJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -56,7 +55,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -65,28 +64,28 @@ public double validate(double arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new DoubleJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public DoubleJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java index 65221627b46..101b2ea1f57 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/FloatJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -46,7 +45,7 @@ public static FloatJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -56,7 +55,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } @@ -65,28 +64,28 @@ public float validate(float arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new FloatJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FloatJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java index 836fa1db724..2938d08bf21 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int32JsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -49,7 +48,7 @@ public static Int32JsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -59,7 +58,7 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } @@ -72,28 +71,28 @@ public float validate(float arg, SchemaConfiguration configuration) throws Valid if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int32JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int32JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java index da3f9d8d5f7..c17217a89ab 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/Int64JsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -51,7 +50,7 @@ public static Int64JsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,11 +60,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } @@ -82,28 +81,28 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64JsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new Int64JsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Int64JsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java index 6205c5b4380..34b79da8f66 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/IntJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -51,7 +50,7 @@ public static IntJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -61,11 +60,11 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } @@ -82,28 +81,28 @@ public double validate(double arg, SchemaConfiguration configuration) throws Val if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new IntJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public IntJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java index 7ebb3106467..8135ed020cf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/ListJsonSchema.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -56,7 +55,7 @@ public static ListJsonSchema1 getInstance() { itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -66,7 +65,7 @@ public static ListJsonSchema1 getInstance() { return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -82,28 +81,28 @@ public static ListJsonSchema1 getInstance() { if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ListJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ListJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ListJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java index 47e141dac53..85396cda11a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/MapJsonSchema.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -54,7 +53,7 @@ public static MapJsonSchema1 getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -62,7 +61,7 @@ public static MapJsonSchema1 getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -71,7 +70,7 @@ public static MapJsonSchema1 getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -86,28 +85,28 @@ public static MapJsonSchema1 getInstance() { if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new MapJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public MapJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java index de1ed91b0cd..7a1a3367d78 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.FrozenList; import org.openapijsonschematools.client.schemas.validation.FrozenMap; @@ -88,7 +87,7 @@ public static NotAnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -100,7 +99,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -112,7 +111,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -123,24 +122,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -172,7 +171,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -182,7 +181,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -199,7 +198,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -207,7 +206,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -216,7 +215,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -243,11 +242,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -262,41 +261,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -312,7 +311,7 @@ public NotAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaCon } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java index d028dbf295e..af32938007e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NullJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.JsonSchema; import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo; @@ -45,7 +44,7 @@ public static NullJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,29 +59,29 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat if (arg == null) { return getNewInstance((Void) null, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new NullJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NullJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java index 5c33b047d95..57629ac9557 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/NumberJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -50,7 +49,7 @@ public static NumberJsonSchema1 getInstance() { } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -60,19 +59,19 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @@ -81,28 +80,28 @@ public double validate(double arg, SchemaConfiguration configuration) { if (arg instanceof Number) { return getNewInstance((Number) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number) { return validate((Number) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new NumberJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public NumberJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Number castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java index 749f5faba63..7185ac28496 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/StringJsonSchema.java @@ -2,12 +2,11 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static StringJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -74,11 +73,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof LocalDate) { @@ -88,20 +87,20 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new StringJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public StringJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java index c2087929db7..2502602642f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/UuidJsonSchema.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import org.checkerframework.checker.nullness.qual.Nullable; @@ -47,7 +46,7 @@ public static UuidJsonSchema1 getInstance() { } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -66,30 +65,30 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof UUID) { return validate((UUID) arg, configuration); } else if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UuidJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UuidJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java index 64d9f476798..b7afc854c15 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.java @@ -1,5 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -11,7 +13,7 @@ public class AdditionalPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java index eb6bcf21d4a..4b969c68a20 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AllOfValidator.java @@ -1,11 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; + import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; public class AllOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var allOf = data.schema().allOf; if (allOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java index d466518d3fe..19d4e0337c9 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.java @@ -10,7 +10,7 @@ public class AnyOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var anyOf = data.schema().anyOf; if (anyOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java index cb28fcb9662..639d32e889e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.java @@ -5,7 +5,7 @@ import java.math.BigDecimal; public abstract class BigDecimalValidator { - protected BigDecimal getBigDecimal(Number arg) { + protected BigDecimal getBigDecimal(Number arg) throws ValidationException { if (arg instanceof Integer) { return new BigDecimal((Integer) arg); } else if (arg instanceof Long) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java index cbf6ed9ddbf..7e80fd207c2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface BooleanEnumValidator { - boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + boolean validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java index 7bade32a205..96c69f5a7a2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface BooleanSchemaValidator { - boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java index 6409a23e5ca..93872adcc2f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ConstValidator.java @@ -10,7 +10,7 @@ public class ConstValidator extends BigDecimalValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!data.schema().constValueSet) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java index fbfd1c9c700..41565577d58 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ContainsValidator.java @@ -9,7 +9,7 @@ public class ContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof List)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java index 43fe8423969..1f1d1ba5e68 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.java @@ -1,5 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; +import org.openapijsonschematools.client.exceptions.ValidationException; + public interface DefaultValueMethod { - T defaultValue(); + T defaultValue() throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java index 77b21ca801d..2640e2f6d8d 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.java @@ -11,7 +11,7 @@ public class DependentRequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java index e329529fe8a..f51b5eaf339 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashSet; import java.util.Map; @@ -10,7 +11,7 @@ public class DependentSchemasValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { if (!(data.arg() instanceof Map mapArg)) { return null; } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java index aa59920f5ac..f2b8b1e7d74 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface DoubleEnumValidator { - double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + double validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java index 3f50d9326c4..18573a77ef7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ElseValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var elseSchema = data.schema().elseSchema; if (elseSchema == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java index 8af756619bd..66563d80960 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/EnumValidator.java @@ -15,7 +15,7 @@ private static boolean enumContainsArg(Set<@Nullable Object> enumValues, @Nullab @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var enumValues = data.schema().enumValues; if (enumValues == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java index 7d05ff65546..e05df98079f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMaximum = data.schema().exclusiveMaximum; if (exclusiveMaximum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java index 73eb1e547c3..0e06f391f62 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.java @@ -7,7 +7,7 @@ public class ExclusiveMinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var exclusiveMinimum = data.schema().exclusiveMinimum; if (exclusiveMinimum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java index 33d4834731d..17317003a34 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface FloatEnumValidator { - float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + float validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java index c1ca45e44f3..35c089a03c7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/FormatValidator.java @@ -18,7 +18,7 @@ public class FormatValidator implements KeywordValidator { private final static BigDecimal doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308d); private final static BigDecimal doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308d); - private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) { + private static void validateNumericFormat(Number arg, ValidationMetadata validationMetadata, String format) throws ValidationException { if (format.startsWith("int")) { // there is a json schema test where 1.0 validates as an integer BigInteger intArg; @@ -85,7 +85,7 @@ private static void validateNumericFormat(Number arg, ValidationMetadata validat } } - private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) { + private static void validateStringFormat(String arg, ValidationMetadata validationMetadata, String format) throws ValidationException { switch (format) { case "uuid" -> { try { @@ -133,7 +133,7 @@ private static void validateStringFormat(String arg, ValidationMetadata validati @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var format = data.schema().format; if (format == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java index b145ab8007a..2a05893a22a 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IfValidator.java @@ -7,7 +7,7 @@ public class IfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var ifSchema = data.schema().ifSchema; if (ifSchema == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java index 491cb228f18..cb20c832f9b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface IntegerEnumValidator { - int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + int validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java index 1b03c0b3094..68d62107337 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class ItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var items = data.schema().items; if (items == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java index beb7460b86c..a597533422f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/JsonSchema.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; +import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.checkerframework.checker.nullness.qual.Nullable; import java.math.BigDecimal; import java.time.LocalDate; @@ -221,9 +220,9 @@ protected JsonSchema(JsonSchemaInfo jsonSchemaInfo) { this.keywordToValidator = keywordToValidator; } - public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException; - public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; - public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException; + public abstract @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas); + public abstract @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; + public abstract T validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException; private List getContainsPathToSchemas( @Nullable Object arg, @@ -262,7 +261,7 @@ private List getContainsPathToSchemas( private PathToSchemasMap getPatternPropertiesPathToSchemas( @Nullable Object arg, ValidationMetadata validationMetadata - ) { + ) throws ValidationException { if (!(arg instanceof Map mapArg) || patternProperties == null) { return new PathToSchemasMap(); } @@ -270,7 +269,7 @@ private PathToSchemasMap getPatternPropertiesPathToSchemas( for (Map.Entry entry: mapArg.entrySet()) { Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new InvalidTypeException("Invalid non-string type for map key"); + throw new ValidationException("Invalid non-string type for map key"); } List propPathToItem = new ArrayList<>(validationMetadata.pathToItem()); propPathToItem.add(key); @@ -306,7 +305,7 @@ private PathToSchemasMap getIfPathToSchemas( try { var otherPathToSchemas = JsonSchema.validate(ifSchemaInstance, arg, validationMetadata); pathToSchemas.update(otherPathToSchemas); - } catch (ValidationException | InvalidTypeException ignored) {} + } catch (ValidationException ignored) {} return pathToSchemas; } @@ -389,7 +388,7 @@ protected Void castToAllowedTypes(Void arg, List pathToItem, Set castToAllowedTypes(List arg, List pathToItem, Set> pathSet) { + protected List castToAllowedTypes(List arg, List pathToItem, Set> pathSet) throws ValidationException { pathSet.add(pathToItem); List<@Nullable Object> argFixed = new ArrayList<>(); int i =0; @@ -403,13 +402,13 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) { + protected Map castToAllowedTypes(Map arg, List pathToItem, Set> pathSet) throws ValidationException { pathSet.add(pathToItem); LinkedHashMap argFixed = new LinkedHashMap<>(); for (Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String key)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new ValidationException("Invalid non-string key value"); } Object val = entry.getValue(); List newPathToItem = new ArrayList<>(pathToItem); @@ -420,7 +419,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set pathToItem, Set> pathSet) { + private @Nullable Object castToAllowedObjectTypes(@Nullable Object arg, List pathToItem, Set> pathSet) throws ValidationException { if (arg == null) { return castToAllowedTypes((Void) null, pathToItem, pathSet); } else if (arg instanceof String) { @@ -448,7 +447,7 @@ protected List castToAllowedTypes(List arg, List pathToItem, Set argClass = arg.getClass(); - throw new InvalidTypeException("Invalid type passed in for input="+arg+" type="+argClass); + throw new ValidationException("Invalid type passed in for input="+arg+" type="+argClass); } } @@ -468,7 +467,7 @@ public String getNewInstance(String arg, List pathToItem, PathToSchemasM return arg; } - protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) { + protected static PathToSchemasMap getPathToSchemas(JsonSchema jsonSchema, @Nullable Object arg, ValidationMetadata validationMetadata, Set> pathSet) throws ValidationException { PathToSchemasMap pathToSchemasMap = new PathToSchemasMap(); // todo add check of validationMetadata.validationRanEarlier(this) PathToSchemasMap otherPathToSchemas = validate(jsonSchema, arg, validationMetadata); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java index d0ff52b29c8..a7752b37595 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.java @@ -1,13 +1,12 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; public interface ListSchemaValidator { - OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas); - OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + OutType getNewInstance(List arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; + OutType validate(List arg, SchemaConfiguration configuration) throws ValidationException; + BoxedType validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java index 88410ffc5e2..6b6bcd88c47 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface LongEnumValidator { - long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + long validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java index 984693428e8..9bd7d432165 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; import java.util.Map; public interface MapSchemaValidator { - OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas); - OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + OutType getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) throws ValidationException; + OutType validate(Map arg, SchemaConfiguration configuration) throws ValidationException; + BoxedType validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java index 9e9b3b92c18..315771b9e0c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.java @@ -9,7 +9,7 @@ public class MaxContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxContains = data.schema().maxContains; if (maxContains == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java index 98ed5cb4ff4..2749843cbf2 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.java @@ -9,7 +9,7 @@ public class MaxItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxItems = data.schema().maxItems; if (maxItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java index 08d91666c5d..f2a77fa91f6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.java @@ -7,7 +7,7 @@ public class MaxLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxLength = data.schema().maxLength; if (maxLength == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java index d117f1688e2..57a53e71be5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.java @@ -9,7 +9,7 @@ public class MaxPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maxProperties = data.schema().maxProperties; if (maxProperties == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java index 702f09686dc..df1c7f5c338 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MaximumValidator.java @@ -7,7 +7,7 @@ public class MaximumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var maximum = data.schema().maximum; if (maximum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java index 1827e95cc83..6ea4404dc1f 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.java @@ -9,7 +9,7 @@ public class MinContainsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minContains = data.schema().minContains; if (minContains == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java index d1933ca7750..25bae60bda7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.java @@ -9,7 +9,7 @@ public class MinItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minItems = data.schema().minItems; if (minItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java index 1defdc891e3..f4639e8a207 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.java @@ -7,7 +7,7 @@ public class MinLengthValidator extends LengthValidator implements KeywordValida @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minLength = data.schema().minLength; if (minLength == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java index c0b99e7fb7d..011ac76dd31 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java @@ -9,7 +9,7 @@ public class MinPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minProperties = data.schema().minProperties; if (minProperties == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java index 3b539120e42..76065fe50b5 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java @@ -7,7 +7,7 @@ public class MinimumValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var minimum = data.schema().minimum; if (minimum == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java index eebc07a0f10..d8273d04d9c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java @@ -9,7 +9,7 @@ public class MultipleOfValidator extends BigDecimalValidator implements KeywordV @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var multipleOf = data.schema().multipleOf; if (multipleOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java index b077e2056a1..3e6b8e91e7c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java @@ -7,7 +7,7 @@ public class NotValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var not = data.schema().not; if (not == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java index 96b52a74b9f..bc6bd3663bb 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface NullEnumValidator { - Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Void validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java index c49fc0150fe..c30cde9f9b7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.java @@ -1,13 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; -import java.util.List; -import java.util.Set; - public interface NullSchemaValidator { - Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java index c426b250af8..dd3c349ad69 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface NumberSchemaValidator { - Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java index 3c4f4b5a085..7dd5f4128ac 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java @@ -10,7 +10,7 @@ public class OneOfValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var oneOf = data.schema().oneOf; if (oneOf == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java index eceeb19e311..d7eebd78098 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PatternValidator.java @@ -7,7 +7,7 @@ public class PatternValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var pattern = data.schema().pattern; if (pattern == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java index 237bc250190..510f3a8760e 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class PrefixItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var prefixItems = data.schema().prefixItems; if (prefixItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java index b8ddd6fcb46..8803b661fd6 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.LinkedHashSet; @@ -12,7 +13,7 @@ public class PropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var properties = data.schema().properties; if (properties == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java index 087cd308b11..0169ff5bdba 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -10,7 +11,7 @@ public class PropertyNamesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var propertyNames = data.schema().propertyNames; if (propertyNames == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java index f2e1a8ecde8..2519cbcfd3b 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/RequiredValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -12,7 +12,7 @@ public class RequiredValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var required = data.schema().required; if (required == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java index 49ca190ae5f..baf86081fd7 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.java @@ -1,9 +1,8 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface StringEnumValidator { - String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + String validate(EnumType arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java index 8cbc38335bf..e6729893fca 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.java @@ -1,10 +1,9 @@ package org.openapijsonschematools.client.schemas.validation; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public interface StringSchemaValidator { - String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; - T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException; + String validate(String arg, SchemaConfiguration configuration) throws ValidationException; + T validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException; } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java index bf599bc812f..75c083e2edc 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java @@ -1,14 +1,13 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; public class ThenValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var then = data.schema().then; if (then == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java index bb4133a770e..300d472cfdf 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/TypeValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.List; import java.util.Map; @@ -10,7 +10,7 @@ public class TypeValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var type = data.schema().type; if (type == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java index 8903d0b19a7..407904da444 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.java @@ -1,6 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class UnevaluatedItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedItems = data.schema().unevaluatedItems; if (unevaluatedItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java index 344c0cfab1b..8fd34950404 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; import org.checkerframework.checker.nullness.qual.Nullable; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; import java.util.List; @@ -11,7 +11,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var unevaluatedProperties = data.schema().unevaluatedProperties; if (unevaluatedProperties == null) { return null; @@ -27,7 +27,7 @@ public class UnevaluatedPropertiesValidator implements KeywordValidator { JsonSchema unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties); for(Map.Entry entry: mapArg.entrySet()) { if (!(entry.getKey() instanceof String propName)) { - throw new InvalidTypeException("Map keys must be strings"); + throw new ValidationException("Map keys must be strings"); } List propPathToItem = new ArrayList<>(data.validationMetadata().pathToItem()); propPathToItem.add(propName); diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java index a42a7d60b60..6b40ba79fff 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.java @@ -1,7 +1,7 @@ package org.openapijsonschematools.client.schemas.validation; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; +import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.HashSet; import java.util.List; @@ -11,7 +11,7 @@ public class UniqueItemsValidator implements KeywordValidator { @Override public @Nullable PathToSchemasMap validate( ValidationData data - ) { + ) throws ValidationException { var uniqueItems = data.schema().uniqueItems; if (uniqueItems == null) { return null; diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java index 1c23a427dd0..8e17449eb27 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.java @@ -2,7 +2,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.checkerframework.checker.nullness.qual.Nullable; @@ -73,7 +72,7 @@ public static UnsetAnyTypeJsonSchema1 getInstance() { } @Override - public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Void castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -85,7 +84,7 @@ public Void validate(Void arg, SchemaConfiguration configuration) throws Validat } @Override - public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public boolean validate(boolean arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); boolean castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -97,7 +96,7 @@ public boolean validate(boolean arg, SchemaConfiguration configuration) throws V } @Override - public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Number validate(Number arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Number castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -108,24 +107,24 @@ public Number validate(Number arg, SchemaConfiguration configuration) throws Val return getNewInstance(castArg, validationMetadata.pathToItem(), pathToSchemasMap); } - public int validate(int arg, SchemaConfiguration configuration) { + public int validate(int arg, SchemaConfiguration configuration) throws ValidationException { return (int) validate((Number) arg, configuration); } - public long validate(long arg, SchemaConfiguration configuration) { + public long validate(long arg, SchemaConfiguration configuration) throws ValidationException { return (long) validate((Number) arg, configuration); } - public float validate(float arg, SchemaConfiguration configuration) { + public float validate(float arg, SchemaConfiguration configuration) throws ValidationException { return (float) validate((Number) arg, configuration); } - public double validate(double arg, SchemaConfiguration configuration) { + public double validate(double arg, SchemaConfiguration configuration) throws ValidationException { return (double) validate((Number) arg, configuration); } @Override - public String validate(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public String validate(String arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); String castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -157,7 +156,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); @@ -167,7 +166,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenList<>(items); } - public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList<@Nullable Object> validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -184,7 +183,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -192,7 +191,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -201,7 +200,7 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0]"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -228,11 +227,11 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { return validate((Void) null, configuration); } else if (arg instanceof Boolean) { @@ -247,41 +246,41 @@ public String validate(UUID arg, SchemaConfiguration configuration) throws Valid } else if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)); } @Override - public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg == null) { Void castArg = (Void) arg; return validateAndBox(castArg, configuration); @@ -297,7 +296,7 @@ public UnsetAnyTypeJsonSchema1Boxed validateAndBox(@Nullable Object arg, SchemaC } else if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } } \ No newline at end of file diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java index 6b0db70c264..9cf6147b8f1 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/securityrequirementobjects/SecurityRequirementObjectProvider.java @@ -1,9 +1,6 @@ package org.openapijsonschematools.client.securityrequirementobjects; -import org.openapijsonschematools.client.exceptions.UnsetPropertyException; -import org.checkerframework.checker.nullness.qual.Nullable; - public interface SecurityRequirementObjectProvider { - SecurityRequirementObject getSecurityRequirementObject(@Nullable T securityIndex) throws UnsetPropertyException; + SecurityRequirementObject getSecurityRequirementObject(T securityIndex); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java index 6327eea827e..b0aa605a011 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server0.java @@ -2,6 +2,7 @@ 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.servers.server0.Variables; @@ -11,17 +12,24 @@ public class Server0 extends ServerWithVariables { /* petstore server */ - - public Server0() { - super( - "http://{server}.swagger.io:{port}/v2", - Variables.Variables1.getInstance().validate( + private static Variables.VariablesMap getVariables() { + try { + return Variables.Variables1.getInstance().validate( MapUtils.makeMap( new AbstractMap.SimpleEntry<>("port", Variables.Port.getInstance().defaultValue()), new AbstractMap.SimpleEntry<>("server", Variables.Server.getInstance().defaultValue()) ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ) + ); + } catch (ValidationException e) { + throw new RuntimeException(e); + } + } + + public Server0() { + super( + "http://{server}.swagger.io:{port}/v2", + getVariables() ); } public Server0(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java index 12d78391b64..555ea894037 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/Server1.java @@ -2,6 +2,7 @@ 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.servers.server1.Variables; @@ -11,16 +12,23 @@ public class Server1 extends ServerWithVariables { /* The local server */ - - public Server1() { - super( - "https://localhost:8080/{version}", - Variables.Variables1.getInstance().validate( + private static Variables.VariablesMap getVariables() { + try { + return Variables.Variables1.getInstance().validate( MapUtils.makeMap( new AbstractMap.SimpleEntry<>("version", Variables.Version.getInstance().defaultValue()) ), new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()) - ) + ); + } catch (ValidationException e) { + throw new RuntimeException(e); + } + } + + public Server1() { + super( + "https://localhost:8080/{version}", + getVariables() ); } public Server1(Variables.VariablesMap variables) { diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java index 8c93a971aae..f736485870c 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java @@ -1,8 +1,6 @@ package org.openapijsonschematools.client.servers; -import org.checkerframework.checker.nullness.qual.Nullable; - public interface ServerProvider { - Server getServer(@Nullable T serverIndex); + Server getServer(T serverIndex); } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java index 12c3a68ffb0..9a17cee2161 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -114,35 +113,35 @@ public String validate(StringServerEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public ServerBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ServerBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new ServerBoxedString(validate(arg, configuration)); } @Override - public ServerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ServerBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } public enum StringPortEnums implements StringValueMethod { @@ -212,35 +211,35 @@ public String validate(StringPortEnums arg,SchemaConfiguration configuration) th } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public PortBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PortBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new PortBoxedString(validate(arg, configuration)); } @Override - public PortBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public PortBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -260,7 +259,7 @@ public static VariablesMap of(Map arg, SchemaConfiguration confi public String port() { String value = get("port"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for port"); + throw new RuntimeException("Invalid value stored for port"); } return (String) value; } @@ -268,7 +267,7 @@ public String port() { public String server() { String value = get("server"); if (!(value instanceof String)) { - throw new InvalidTypeException("Invalid value stored for server"); + throw new RuntimeException("Invalid value stored for server"); } return (String) value; } @@ -410,7 +409,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -418,12 +417,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -431,7 +430,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -443,29 +442,29 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java index 1ecc7a5cb8e..c8f236973c4 100644 --- a/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java +++ b/samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java @@ -10,7 +10,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.UnsetPropertyException; import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; @@ -112,35 +111,35 @@ public String validate(StringVersionEnums arg,SchemaConfiguration configuration) } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return validate((String) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof String) { return getNewInstance((String) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } - public String defaultValue() { + public String defaultValue() throws ValidationException { if (defaultValue instanceof String) { return (String) defaultValue; } - throw new InvalidTypeException("Invalid type stored in defaultValue"); + throw new ValidationException("Invalid type stored in defaultValue"); } @Override - public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxedString validateAndBox(String arg, SchemaConfiguration configuration) throws ValidationException { return new VersionBoxedString(validate(arg, configuration)); } @Override - public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VersionBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -157,7 +156,11 @@ public static VariablesMap of(Map arg, SchemaConfiguration confi } public String version() { - return getOrThrow("version"); + try { + return getOrThrow("version"); + } catch (UnsetPropertyException e) { + throw new RuntimeException(e); + } } } @@ -248,7 +251,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -256,12 +259,12 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(propertyInstance instanceof String)) { - throw new InvalidTypeException("Invalid instantiated value"); + throw new RuntimeException("Invalid instantiated value"); } properties.put(propertyName, (String) propertyInstance); } @@ -269,7 +272,7 @@ public VariablesMap getNewInstance(Map arg, List pathToItem, PathT return new VariablesMap(castProperties); } - public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public VariablesMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -281,29 +284,29 @@ public VariablesMap validate(Map arg, SchemaConfiguration configuration) t @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) throws InvalidTypeException { + public @Nullable Object getNewInstance(@Nullable Object arg, List pathToItem, PathToSchemasMap pathToSchemas) { if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1BoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new Variables1BoxedMap(validate(arg, configuration)); } @Override - public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public Variables1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map castArg) { return validateAndBox(castArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java index 990f21a1148..476dab2c3da 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java @@ -5,10 +5,13 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.net.http.HttpHeaders; +import java.util.AbstractMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -22,7 +25,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -100,7 +103,7 @@ public Void encoding() { return null; } } - Map> content = Map.of( + AbstractMap.SimpleEntry> content = new AbstractMap.SimpleEntry<>( "application/json", new ApplicationJsonMediaType() ); for (ParamTestCase testCase: testCases) { diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java index b0eaf780b2e..b1dc30975ab 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java @@ -5,7 +5,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.ListJsonSchema; import org.openapijsonschematools.client.schemas.NullJsonSchema; @@ -28,7 +29,7 @@ public ParamTestCase(@Nullable Object payload, Map> expect } @Test - public void testSerialization() { + public void testSerialization() throws ValidationException, NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -105,7 +106,7 @@ public void testSerialization() { ); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value, "color", false, configuration) ); } @@ -126,7 +127,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserialization() { + public void testDeserialization() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java index a19ea8c1007..a46f7fbb5f7 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/CookieSerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +33,7 @@ protected CookieParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java index 63f3159bf0a..2a9acf14219 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/HeadersSerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -33,7 +34,7 @@ protected HeaderParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java index bef110af08d..3ff2ac5ed88 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/PathSerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +33,7 @@ protected PathParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java index ed5aae7e580..7cb559fef3c 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/QuerySerializerTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Test; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.AbstractMap; @@ -32,7 +33,7 @@ protected QueryParametersSerializer() { } @Test - public void testSerialization() { + public void testSerialization() throws NotImplementedException { Map inData = Map.ofEntries( new AbstractMap.SimpleEntry<>("param1", "a"), new AbstractMap.SimpleEntry<>("param2", 3.14d) diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java index 871d4f073f3..4d799c14c72 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaNonQueryParameterTest.java @@ -3,7 +3,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +26,7 @@ public HeaderParameter(@Nullable Boolean explode) { } @Test - public void testHeaderSerialization() { + public void testHeaderSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -91,7 +91,7 @@ public void testHeaderSerialization() { var boolHeader = new HeaderParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> boolHeader.serialize(value) ); } @@ -104,7 +104,7 @@ public PathParameter(@Nullable Boolean explode) { } @Test - public void testPathSerialization() { + public void testPathSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -169,7 +169,7 @@ public void testPathSerialization() { var pathParameter = new PathParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> pathParameter.serialize(value) ); } @@ -182,7 +182,7 @@ public CookieParameter(@Nullable Boolean explode) { } @Test - public void testCookieSerialization() { + public void testCookieSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -247,7 +247,7 @@ public void testCookieSerialization() { var cookieParameter = new CookieParameter(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> cookieParameter.serialize(value) ); } @@ -260,7 +260,7 @@ public PathMatrixParameter(@Nullable Boolean explode) { } @Test - public void testPathMatrixSerialization() { + public void testPathMatrixSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -331,7 +331,7 @@ public PathLabelParameter(@Nullable Boolean explode) { } @Test - public void testPathLabelSerialization() { + public void testPathLabelSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java index f4ea29fccb3..413b092634f 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/parameter/SchemaQueryParameterTest.java @@ -3,7 +3,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Assert; import org.junit.Test; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.NotImplementedException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import java.util.LinkedHashMap; @@ -26,7 +26,7 @@ public QueryParameterNoStyle(@Nullable Boolean explode) { } @Test - public void testQueryParameterNoStyleSerialization() { + public void testQueryParameterNoStyleSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -91,7 +91,7 @@ public void testQueryParameterNoStyleSerialization() { var parameter = new QueryParameterNoStyle(false); for (boolean value: Set.of(true, false)) { Assert.assertThrows( - InvalidTypeException.class, + NotImplementedException.class, () -> parameter.serialize(value) ); } @@ -104,7 +104,7 @@ public QueryParameterSpaceDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterSpaceDelimitedSerialization() { + public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); @@ -151,7 +151,7 @@ public QueryParameterPipeDelimited(@Nullable Boolean explode) { } @Test - public void testQueryParameterPipeDelimitedSerialization() { + public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { var mapPayload = new LinkedHashMap(); mapPayload.put("R", 100); mapPayload.put("G", 200); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java index 9f0c86ec5c4..93a5adb916a 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/requestbody/RequestBodySerializerTest.java @@ -3,6 +3,8 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.contenttype.ContentTypeDetector; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -47,7 +49,7 @@ public MyRequestBodySerializer() { true); } - public SerializedRequestBody serialize(SealedRequestBody requestBody) { + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { return serialize(requestBody0.contentType(), requestBody0.body().getData()); } else { @@ -93,7 +95,7 @@ private String getJsonBody(SerializedRequestBody requestBody) { } @Test - public void testSerializeApplicationJson() { + public void testSerializeApplicationJson() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); String jsonBody; @@ -164,7 +166,7 @@ public void testSerializeApplicationJson() { } @Test - public void testSerializeTextPlain() { + public void testSerializeTextPlain() throws ValidationException, NotImplementedException { SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone()); var serializer = new MyRequestBodySerializer(); SerializedRequestBody requestBody = serializer.serialize( diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java index 408f04582a8..e4656ecbbc3 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/response/ResponseDeserializerTest.java @@ -8,6 +8,9 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; +import org.openapijsonschematools.client.exceptions.NotImplementedException; +import org.openapijsonschematools.client.exceptions.ApiException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.mediatype.MediaType; import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; @@ -64,11 +67,7 @@ public MyResponseDeserializer() { } @Override - protected SealedResponseBody getBody(String contentType, byte[] body, SchemaConfiguration configuration) { - SealedMediaType mediaType = content.get(contentType); - if (mediaType == null) { - throw new RuntimeException("Invalid contentType was received back from the server that does not exist in the openapi document"); - } + 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); @@ -152,7 +151,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testDeserializeApplicationJsonNull() { + 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"); @@ -168,7 +167,7 @@ public void testDeserializeApplicationJsonNull() { } @Test - public void testDeserializeApplicationJsonTrue() { + 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"); @@ -184,7 +183,7 @@ public void testDeserializeApplicationJsonTrue() { } @Test - public void testDeserializeApplicationJsonFalse() { + 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"); @@ -200,7 +199,7 @@ public void testDeserializeApplicationJsonFalse() { } @Test - public void testDeserializeApplicationJsonInt() { + 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"); @@ -216,7 +215,7 @@ public void testDeserializeApplicationJsonInt() { } @Test - public void testDeserializeApplicationJsonFloat() { + 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"); @@ -232,7 +231,7 @@ public void testDeserializeApplicationJsonFloat() { } @Test - public void testDeserializeApplicationJsonString() { + 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"); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java index 9b76ff56c45..206c683cd50 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.java @@ -5,6 +5,7 @@ import org.junit.Test; 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; @@ -26,13 +27,13 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testValidateNull() { + public void testValidateNull() throws ValidationException { Void validatedValue = schema.validate((Void) null, configuration); assertNull(validatedValue); } @Test - public void testValidateBoolean() { + public void testValidateBoolean() throws ValidationException { boolean trueValue = schema.validate(true, configuration); Assert.assertTrue(trueValue); @@ -41,49 +42,49 @@ public void testValidateBoolean() { } @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException { int validatedValue = schema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException { long validatedValue = schema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException { float validatedValue = schema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException { double validatedValue = schema.validate(70.6458763d, configuration); Assert.assertEquals(Double.compare(validatedValue, 70.6458763d), 0); } @Test - public void testValidateString() { + public void testValidateString() throws ValidationException { String validatedValue = schema.validate("a", configuration); Assert.assertEquals(validatedValue, "a"); } @Test - public void testValidateZonedDateTime() { + public void testValidateZonedDateTime() throws ValidationException { String validatedValue = schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration); Assert.assertEquals(validatedValue, "2017-07-21T17:32:28Z"); } @Test - public void testValidateLocalDate() { + public void testValidateLocalDate() throws ValidationException { String validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration); Assert.assertEquals(validatedValue, "2017-07-21"); } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException { LinkedHashMap inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap validatedValue = schema.validate(inMap, configuration); @@ -93,7 +94,7 @@ public void testValidateMap() { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException { ArrayList inList = new ArrayList<>(); inList.add(LocalDate.of(2017, 7, 21)); FrozenList validatedValue = schema.validate(inList, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java index 42dfcabf0d0..0ca5e56ecd2 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.java @@ -5,13 +5,12 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -53,12 +52,12 @@ public FrozenList getNewInstance(List arg, List pathToItem, P itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -66,7 +65,7 @@ public FrozenList getNewInstance(List arg, List pathToItem, P return new FrozenList<>(items); } - public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -77,7 +76,7 @@ public FrozenList validate(List arg, SchemaConfiguration configuratio } @Override - public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithItemsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithItemsSchemaBoxedList(validate(arg, configuration)); } @@ -86,23 +85,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return new ArrayWithItemsSchemaBoxedList(validate(listArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -111,7 +110,7 @@ protected ArrayWithOutputClsSchemaList(FrozenList m) { super(m); } - public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) { + public static ArrayWithOutputClsSchemaList of(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithOutputClsSchema().validate(arg, configuration); } } @@ -138,12 +137,12 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat itemPathToItem.add(i); LinkedHashMap, Void> schemas = pathToSchemas.get(itemPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema itemSchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas); if (!(castItem instanceof String)) { - throw new InvalidTypeException("Instantiated type of item is invalid"); + throw new RuntimeException("Instantiated type of item is invalid"); } items.add((String) castItem); i += 1; @@ -152,7 +151,7 @@ public ArrayWithOutputClsSchemaList getNewInstance(List arg, List pat return new ArrayWithOutputClsSchemaList(newInstanceItems); } - public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); List castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -163,7 +162,7 @@ public ArrayWithOutputClsSchemaList validate(List arg, SchemaConfiguration co } @Override - public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ArrayWithOutputClsSchemaBoxedList validateAndBox(List arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)); } @@ -172,23 +171,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List) { return getNewInstance((List) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List) { return validate((List) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithOutputClsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return new ArrayWithOutputClsSchemaBoxedList(validate(listArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -202,7 +201,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateArrayWithItemsSchema() { + public void testValidateArrayWithItemsSchema() throws ValidationException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); @@ -227,7 +226,7 @@ public void testValidateArrayWithItemsSchema() { } @Test - public void testValidateArrayWithOutputClsSchema() { + public void testValidateArrayWithOutputClsSchema() throws ValidationException { // list with only item works List inList = new ArrayList<>(); inList.add("abc"); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java index 0b4261a7ef0..7ac24fbeaa2 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/BooleanSchemaTest.java @@ -4,9 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; 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; @@ -24,13 +23,13 @@ public class BooleanSchemaTest { ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException { boolean validatedValue = booleanJsonSchema.validate(true, configuration); Assert.assertTrue(validatedValue); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException { boolean validatedValue = booleanJsonSchema.validate(false, configuration); Assert.assertFalse(validatedValue); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java index cb4aa60f4a8..17d5f35dcbe 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ListSchemaTest.java @@ -5,9 +5,9 @@ import org.junit.Test; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -35,7 +35,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateList() { + public void testValidateList() throws ValidationException { List inList = new ArrayList<>(); inList.add("today"); FrozenList<@Nullable Object> validatedValue = listJsonSchema.validate(inList, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java index 85afb15a068..5b03fec8609 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/MapSchemaTest.java @@ -5,9 +5,9 @@ import org.junit.Test; 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.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; @@ -37,7 +37,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateMap() { + public void testValidateMap() throws ValidationException { Map inMap = new LinkedHashMap<>(); inMap.put("today", LocalDate.of(2017, 7, 21)); FrozenMap<@Nullable Object> validatedValue = mapJsonSchema.validate(inMap, configuration); diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java index d566f15a69e..eb1c70ef049 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NullSchemaTest.java @@ -4,9 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; 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; @@ -26,7 +25,7 @@ public class NullSchemaTest { @Test @SuppressWarnings("nullness") - public void testValidateNull() { + public void testValidateNull() throws ValidationException { Void validatedValue = nullJsonSchema.validate(null, configuration); Assert.assertNull(validatedValue); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java index 2ab8d8a8121..fcde27495e3 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/NumberSchemaTest.java @@ -4,8 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; 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; @@ -23,25 +23,25 @@ public class NumberSchemaTest { ); @Test - public void testValidateInteger() { + public void testValidateInteger() throws ValidationException { int validatedValue = numberJsonSchema.validate(1, configuration); Assert.assertEquals(validatedValue, 1); } @Test - public void testValidateLong() { + public void testValidateLong() throws ValidationException { long validatedValue = numberJsonSchema.validate(1L, configuration); Assert.assertEquals(validatedValue, 1L); } @Test - public void testValidateFloat() { + public void testValidateFloat() throws ValidationException { float validatedValue = numberJsonSchema.validate(3.14f, configuration); Assert.assertEquals(Float.compare(validatedValue, 3.14f), 0); } @Test - public void testValidateDouble() { + public void testValidateDouble() throws ValidationException { double validatedValue = numberJsonSchema.validate(3.14d, configuration); Assert.assertEquals(Double.compare(validatedValue, 3.14d), 0); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java index 02729b0f046..fad3d574369 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.java @@ -5,14 +5,13 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +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.PropertyEntry; import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator; -import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.validation.ValidationMetadata; import java.util.ArrayList; @@ -62,7 +61,7 @@ public static ObjectWithPropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -70,7 +69,7 @@ public static ObjectWithPropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -79,7 +78,7 @@ public static ObjectWithPropsSchema getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -90,7 +89,7 @@ public static ObjectWithPropsSchema getInstance() { } @Override - public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithPropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)); } @@ -99,23 +98,23 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } } @@ -146,7 +145,7 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -154,19 +153,19 @@ public FrozenMap getNewInstance(Map arg, List pathToItem, Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); if (!(castValue instanceof String)) { - throw new InvalidTypeException("Invalid type for property value"); + throw new RuntimeException("Invalid type for property value"); } properties.put(propertyName, (String) castValue); } return new FrozenMap<>(properties); } - public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -177,24 +176,24 @@ public FrozenMap validate(Map arg, SchemaConfiguration configurati } @Override - public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -202,7 +201,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -235,7 +234,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -243,7 +242,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -252,7 +251,7 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { return new FrozenMap<>(properties); } - public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public FrozenMap<@Nullable Object> validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -263,24 +262,24 @@ public static ObjectWithPropsAndAddpropsSchema getInstance() { } @Override - public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithPropsAndAddpropsSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsAndAddpropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -288,7 +287,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -297,7 +296,7 @@ protected ObjectWithOutputTypeSchemaMap(FrozenMap<@Nullable Object> m) { super(m); } - public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) { + public static ObjectWithOutputTypeSchemaMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration); } } @@ -330,7 +329,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { - throw new InvalidTypeException("Invalid non-string key value"); + throw new RuntimeException("Invalid non-string key value"); } String propertyName = (String) entryKey; List propertyPathToItem = new ArrayList<>(pathToItem); @@ -338,7 +337,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List Object value = entry.getValue(); LinkedHashMap, Void> schemas = pathToSchemas.get(propertyPathToItem); if (schemas == null) { - throw new InvalidTypeException("Validation result is invalid, schemas must exist for a pathToItem"); + throw new RuntimeException("Validation result is invalid, schemas must exist for a pathToItem"); } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); @@ -347,7 +346,7 @@ public ObjectWithOutputTypeSchemaMap getNewInstance(Map arg, List return new ObjectWithOutputTypeSchemaMap(new FrozenMap<>(properties)); } - public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration configuration) throws ValidationException { Set> pathSet = new HashSet<>(); List pathToItem = List.of("args[0"); Map castArg = castToAllowedTypes(arg, pathToItem, pathSet); @@ -358,24 +357,24 @@ public ObjectWithOutputTypeSchemaMap validate(Map arg, SchemaConfiguration } @Override - public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException, InvalidTypeException { + public ObjectWithOutputTypeSchemaBoxedMap validateAndBox(Map arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return validate((Map) arg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithOutputTypeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return new ObjectWithOutputTypeSchemaBoxedMap(validate(mapArg, configuration)); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override @@ -383,7 +382,7 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof FrozenMap) { return getNewInstance((Map) arg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } } @@ -398,7 +397,7 @@ public void testExceptionThrownForInvalidType() { } @Test - public void testValidateObjectWithPropsSchema() { + public void testValidateObjectWithPropsSchema() throws ValidationException { ObjectWithPropsSchema schema = ObjectWithPropsSchema.getInstance(); // map with only property works @@ -429,7 +428,7 @@ public void testValidateObjectWithPropsSchema() { } @Test - public void testValidateObjectWithAddpropsSchema() { + public void testValidateObjectWithAddpropsSchema() throws ValidationException { ObjectWithAddpropsSchema schema = ObjectWithAddpropsSchema.getInstance(); // map with only property works @@ -460,7 +459,7 @@ public void testValidateObjectWithAddpropsSchema() { } @Test - public void testValidateObjectWithPropsAndAddpropsSchema() { + public void testValidateObjectWithPropsAndAddpropsSchema() throws ValidationException { ObjectWithPropsAndAddpropsSchema schema = ObjectWithPropsAndAddpropsSchema.getInstance(); // map with only property works @@ -499,7 +498,7 @@ public void testValidateObjectWithPropsAndAddpropsSchema() { } @Test - public void testValidateObjectWithOutputTypeSchema() { + public void testValidateObjectWithOutputTypeSchema() throws ValidationException { ObjectWithOutputTypeSchema schema = ObjectWithOutputTypeSchema.getInstance(); // map with only property works diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java index c8079ef632a..d3cba69fb20 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.java @@ -4,9 +4,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.schemas.validation.JsonSchema; -import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory; 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; @@ -28,13 +27,13 @@ public static class RefBooleanSchema1 extends BooleanJsonSchema.BooleanJsonSchem ); @Test - public void testValidateTrue() { + public void testValidateTrue() throws ValidationException { Boolean validatedValue = refBooleanJsonSchema.validate(true, configuration); Assert.assertEquals(validatedValue, Boolean.TRUE); } @Test - public void testValidateFalse() { + public void testValidateFalse() throws ValidationException { Boolean validatedValue = refBooleanJsonSchema.validate(false, configuration); Assert.assertEquals(validatedValue, Boolean.FALSE); } diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java index 40a01c9983d..ea3ec6ae8c3 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.java @@ -5,7 +5,7 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; +import org.openapijsonschematools.client.exceptions.ValidationException; import org.openapijsonschematools.client.schemas.MapJsonSchema; import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; @@ -46,19 +46,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } @@ -70,7 +70,7 @@ private Void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -105,7 +105,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java index 1481f312f6a..cb03bcf8f5b 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.java @@ -34,7 +34,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testIntFormatSucceedsWithFloat() { + public void testIntFormatSucceedsWithFloat() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -59,7 +59,7 @@ public void testIntFormatFailsWithFloat() { } @Test - public void testIntFormatSucceedsWithInt() { + public void testIntFormatSucceedsWithInt() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -84,7 +84,7 @@ public void testInt32UnderMinFails() { } @Test - public void testInt32InclusiveMinSucceeds() { + public void testInt32InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -97,7 +97,7 @@ public void testInt32InclusiveMinSucceeds() { } @Test - public void testInt32InclusiveMaxSucceeds() { + public void testInt32InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -135,7 +135,7 @@ public void testInt64UnderMinFails() { } @Test - public void testInt64InclusiveMinSucceeds() { + public void testInt64InclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -148,7 +148,7 @@ public void testInt64InclusiveMinSucceeds() { } @Test - public void testInt64InclusiveMaxSucceeds() { + public void testInt64InclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -186,7 +186,7 @@ public void testFloatUnderMinFails() { } @Test - public void testFloatInclusiveMinSucceeds() { + public void testFloatInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -199,7 +199,7 @@ public void testFloatInclusiveMinSucceeds() { } @Test - public void testFloatInclusiveMaxSucceeds() { + public void testFloatInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -236,7 +236,7 @@ public void testDoubleUnderMinFails() { } @Test - public void testDoubleInclusiveMinSucceeds() { + public void testDoubleInclusiveMinSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -249,7 +249,7 @@ public void testDoubleInclusiveMinSucceeds() { } @Test - public void testDoubleInclusiveMaxSucceeds() { + public void testDoubleInclusiveMaxSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -286,7 +286,7 @@ public void testInvalidNumberStringFails() { } @Test - public void testValidFloatNumberStringSucceeds() { + public void testValidFloatNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -299,7 +299,7 @@ public void testValidFloatNumberStringSucceeds() { } @Test - public void testValidIntNumberStringSucceeds() { + public void testValidIntNumberStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -324,7 +324,7 @@ public void testInvalidDateStringFails() { } @Test - public void testValidDateStringSucceeds() { + public void testValidDateStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( @@ -349,7 +349,7 @@ public void testInvalidDateTimeStringFails() { } @Test - public void testValidDateTimeStringSucceeds() { + public void testValidDateTimeStringSucceeds() throws ValidationException { final FormatValidator validator = new FormatValidator(); PathToSchemasMap pathToSchemasMap = validator.validate( new ValidationData( diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java index e0e4a0c859e..5b70aada50c 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.java @@ -6,7 +6,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.schemas.StringJsonSchema; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.ArrayList; @@ -37,25 +36,25 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof List listArg) { return getNewInstance(listArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof List listArg) { return validate(listArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ArrayWithItemsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ArrayWithItemsSchemaBoxedList(); } } @Test - public void testCorrectItemsSucceeds() { + public void testCorrectItemsSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -89,7 +88,7 @@ public void testCorrectItemsSucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java index 8a14df7edd6..c1cc4c84e9e 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -40,25 +39,25 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof String) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof String) { return arg; } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public SomeSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new SomeSchemaBoxedString(); } } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java index 492f45af0c7..e35b145e721 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.java @@ -5,9 +5,8 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; -import org.openapijsonschematools.client.schemas.StringJsonSchema; import org.openapijsonschematools.client.exceptions.ValidationException; +import org.openapijsonschematools.client.schemas.StringJsonSchema; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -36,19 +35,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithPropsSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithPropsSchemaBoxedMap(); } } @@ -59,7 +58,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( @@ -92,7 +91,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { final PropertiesValidator validator = new PropertiesValidator(); List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java index 65ff030d74b..58c160a0499 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.exceptions.ValidationException; import java.util.LinkedHashMap; @@ -32,19 +31,19 @@ public Object getNewInstance(@Nullable Object arg, List pathToItem, Path if (arg instanceof Map mapArg) { return getNewInstance(mapArg, pathToItem, pathToSchemas); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); + throw new RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema"); } @Override - public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public @Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { if (arg instanceof Map mapArg) { return validate(mapArg, configuration); } - throw new InvalidTypeException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); + throw new ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema"); } @Override - public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws InvalidTypeException, ValidationException { + public ObjectWithRequiredSchemaBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) throws ValidationException { return new ObjectWithRequiredSchemaBoxedMap(); } } @@ -55,7 +54,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testCorrectPropertySucceeds() { + public void testCorrectPropertySucceeds() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, @@ -78,7 +77,7 @@ public void testCorrectPropertySucceeds() { } @Test - public void testNotApplicableTypeReturnsNull() { + public void testNotApplicableTypeReturnsNull() throws ValidationException { List pathToItem = List.of("args[0]"); ValidationMetadata validationMetadata = new ValidationMetadata( pathToItem, diff --git a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java index ebc8bbff1f5..c31855af4ff 100644 --- a/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java +++ b/samples/client/petstore/java/src/test/java/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.java @@ -18,7 +18,7 @@ private void assertNull(@Nullable Object object) { } @Test - public void testValidateSucceeds() { + public void testValidateSucceeds() throws ValidationException { final TypeValidator validator = new TypeValidator(); ValidationMetadata validationMetadata = new ValidationMetadata( new ArrayList<>(), diff --git a/samples/client/petstore/python/.openapi-generator/FILES b/samples/client/petstore/python/.openapi-generator/FILES index 5a834e23f91..9634271e7cc 100644 --- a/samples/client/petstore/python/.openapi-generator/FILES +++ b/samples/client/petstore/python/.openapi-generator/FILES @@ -360,10 +360,14 @@ docs/paths/fake_wild_card_responses/get/responses/response_4xx/content/applicati docs/paths/fake_wild_card_responses/get/responses/response_5xx/content/application_json/schema.md docs/paths/foo/get.md docs/paths/foo/get/responses/response_default/content/application_json/schema.md +docs/paths/foo/get/servers/server_0.md +docs/paths/foo/get/servers/server_1.md docs/paths/pet/post.md docs/paths/pet/put.md docs/paths/pet_find_by_status/get.md docs/paths/pet_find_by_status/get/parameters/parameter_0/schema.md +docs/paths/pet_find_by_status/servers/server_0.md +docs/paths/pet_find_by_status/servers/server_1.md docs/paths/pet_find_by_tags/get.md docs/paths/pet_find_by_tags/get/parameters/parameter_0/schema.md docs/paths/pet_pet_id/delete.md diff --git a/samples/client/petstore/python/docs/paths/fake_additional_properties_with_array_of_enums/get/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_additional_properties_with_array_of_enums/get/request_body/content/application_json/schema.md index 978ab8b4c9a..4745609bed1 100644 --- a/samples/client/petstore/python/docs/paths/fake_additional_properties_with_array_of_enums/get/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_additional_properties_with_array_of_enums/get/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnums**](../../../../../../../components/schema/additional_properties_with_array_of_enums.md) | [additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnumsDictInput](../../../../../../../components/schema/additional_properties_with_array_of_enums.md#additionalpropertieswitharrayofenumsdictinput), [additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnumsDict](../../../../../../../components/schema/additional_properties_with_array_of_enums.md#additionalpropertieswitharrayofenumsdict) | [additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnumsDict](../../../../../../../components/schema/additional_properties_with_array_of_enums.md#additionalpropertieswitharrayofenumsdict) +[**additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnums**](../../../../../../components/schema/additional_properties_with_array_of_enums.md) | [additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnumsDictInput](../../../../../../components/schema/additional_properties_with_array_of_enums.md#additionalpropertieswitharrayofenumsdictinput), [additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnumsDict](../../../../../../components/schema/additional_properties_with_array_of_enums.md#additionalpropertieswitharrayofenumsdict) | [additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnumsDict](../../../../../../components/schema/additional_properties_with_array_of_enums.md#additionalpropertieswitharrayofenumsdict) diff --git a/samples/client/petstore/python/docs/paths/fake_body_with_file_schema/put/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_body_with_file_schema/put/request_body/content/application_json/schema.md index 779887b9540..4e2fb0875f7 100644 --- a/samples/client/petstore/python/docs/paths/fake_body_with_file_schema/put/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_body_with_file_schema/put/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**file_schema_test_class.FileSchemaTestClass**](../../../../../../../components/schema/file_schema_test_class.md) | [file_schema_test_class.FileSchemaTestClassDictInput](../../../../../../../components/schema/file_schema_test_class.md#fileschematestclassdictinput), [file_schema_test_class.FileSchemaTestClassDict](../../../../../../../components/schema/file_schema_test_class.md#fileschematestclassdict) | [file_schema_test_class.FileSchemaTestClassDict](../../../../../../../components/schema/file_schema_test_class.md#fileschematestclassdict) +[**file_schema_test_class.FileSchemaTestClass**](../../../../../../components/schema/file_schema_test_class.md) | [file_schema_test_class.FileSchemaTestClassDictInput](../../../../../../components/schema/file_schema_test_class.md#fileschematestclassdictinput), [file_schema_test_class.FileSchemaTestClassDict](../../../../../../components/schema/file_schema_test_class.md#fileschematestclassdict) | [file_schema_test_class.FileSchemaTestClassDict](../../../../../../components/schema/file_schema_test_class.md#fileschematestclassdict) diff --git a/samples/client/petstore/python/docs/paths/fake_body_with_query_params/put/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_body_with_query_params/put/request_body/content/application_json/schema.md index 95c59621bdc..bbc56f3522f 100644 --- a/samples/client/petstore/python/docs/paths/fake_body_with_query_params/put/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_body_with_query_params/put/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**user.User**](../../../../../../../components/schema/user.md) | [user.UserDictInput](../../../../../../../components/schema/user.md#userdictinput), [user.UserDict](../../../../../../../components/schema/user.md#userdict) | [user.UserDict](../../../../../../../components/schema/user.md#userdict) +[**user.User**](../../../../../../components/schema/user.md) | [user.UserDictInput](../../../../../../components/schema/user.md#userdictinput), [user.UserDict](../../../../../../components/schema/user.md#userdict) | [user.UserDict](../../../../../../components/schema/user.md#userdict) diff --git a/samples/client/petstore/python/docs/paths/fake_json_patch/patch/request_body/content/application_json_patchjson/schema.md b/samples/client/petstore/python/docs/paths/fake_json_patch/patch/request_body/content/application_json_patchjson/schema.md index e9940a6295b..eadc6d69fc1 100644 --- a/samples/client/petstore/python/docs/paths/fake_json_patch/patch/request_body/content/application_json_patchjson/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_json_patch/patch/request_body/content/application_json_patchjson/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**json_patch_request.JSONPatchRequest**](../../../../../../../components/schema/json_patch_request.md) | [json_patch_request.JSONPatchRequestTupleInput](../../../../../../../components/schema/json_patch_request.md#jsonpatchrequesttupleinput), [json_patch_request.JSONPatchRequestTuple](../../../../../../../components/schema/json_patch_request.md#jsonpatchrequesttuple) | [json_patch_request.JSONPatchRequestTuple](../../../../../../../components/schema/json_patch_request.md#jsonpatchrequesttuple) +[**json_patch_request.JSONPatchRequest**](../../../../../../components/schema/json_patch_request.md) | [json_patch_request.JSONPatchRequestTupleInput](../../../../../../components/schema/json_patch_request.md#jsonpatchrequesttupleinput), [json_patch_request.JSONPatchRequestTuple](../../../../../../components/schema/json_patch_request.md#jsonpatchrequesttuple) | [json_patch_request.JSONPatchRequestTuple](../../../../../../components/schema/json_patch_request.md#jsonpatchrequesttuple) diff --git a/samples/client/petstore/python/docs/paths/fake_refs_array_of_enums/post/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_refs_array_of_enums/post/request_body/content/application_json/schema.md index 4f46da8c96c..62691b8b74c 100644 --- a/samples/client/petstore/python/docs/paths/fake_refs_array_of_enums/post/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_refs_array_of_enums/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**array_of_enums.ArrayOfEnums**](../../../../../../../components/schema/array_of_enums.md) | [array_of_enums.ArrayOfEnumsTupleInput](../../../../../../../components/schema/array_of_enums.md#arrayofenumstupleinput), [array_of_enums.ArrayOfEnumsTuple](../../../../../../../components/schema/array_of_enums.md#arrayofenumstuple) | [array_of_enums.ArrayOfEnumsTuple](../../../../../../../components/schema/array_of_enums.md#arrayofenumstuple) +[**array_of_enums.ArrayOfEnums**](../../../../../../components/schema/array_of_enums.md) | [array_of_enums.ArrayOfEnumsTupleInput](../../../../../../components/schema/array_of_enums.md#arrayofenumstupleinput), [array_of_enums.ArrayOfEnumsTuple](../../../../../../components/schema/array_of_enums.md#arrayofenumstuple) | [array_of_enums.ArrayOfEnumsTuple](../../../../../../components/schema/array_of_enums.md#arrayofenumstuple) diff --git a/samples/client/petstore/python/docs/paths/fake_refs_arraymodel/post/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_refs_arraymodel/post/request_body/content/application_json/schema.md index f4143ded2d8..9df305bb7e2 100644 --- a/samples/client/petstore/python/docs/paths/fake_refs_arraymodel/post/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_refs_arraymodel/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**animal_farm.AnimalFarm**](../../../../../../../components/schema/animal_farm.md) | [animal_farm.AnimalFarmTupleInput](../../../../../../../components/schema/animal_farm.md#animalfarmtupleinput), [animal_farm.AnimalFarmTuple](../../../../../../../components/schema/animal_farm.md#animalfarmtuple) | [animal_farm.AnimalFarmTuple](../../../../../../../components/schema/animal_farm.md#animalfarmtuple) +[**animal_farm.AnimalFarm**](../../../../../../components/schema/animal_farm.md) | [animal_farm.AnimalFarmTupleInput](../../../../../../components/schema/animal_farm.md#animalfarmtupleinput), [animal_farm.AnimalFarmTuple](../../../../../../components/schema/animal_farm.md#animalfarmtuple) | [animal_farm.AnimalFarmTuple](../../../../../../components/schema/animal_farm.md#animalfarmtuple) diff --git a/samples/client/petstore/python/docs/paths/fake_refs_boolean/post/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_refs_boolean/post/request_body/content/application_json/schema.md index 04222111b60..829ed40d45c 100644 --- a/samples/client/petstore/python/docs/paths/fake_refs_boolean/post/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_refs_boolean/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**boolean.Boolean**](../../../../../../../components/schema/boolean.md) | bool | bool +[**boolean.Boolean**](../../../../../../components/schema/boolean.md) | bool | bool diff --git a/samples/client/petstore/python/docs/paths/fake_refs_composed_one_of_number_with_validations/post/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_refs_composed_one_of_number_with_validations/post/request_body/content/application_json/schema.md index 74c47d6bcb7..468f17e6461 100644 --- a/samples/client/petstore/python/docs/paths/fake_refs_composed_one_of_number_with_validations/post/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_refs_composed_one_of_number_with_validations/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**composed_one_of_different_types.ComposedOneOfDifferentTypes**](../../../../../../../components/schema/composed_one_of_different_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**composed_one_of_different_types.ComposedOneOfDifferentTypes**](../../../../../../components/schema/composed_one_of_different_types.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/petstore/python/docs/paths/fake_refs_enum/post/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_refs_enum/post/request_body/content/application_json/schema.md index 311fad29c72..e5e015e09a6 100644 --- a/samples/client/petstore/python/docs/paths/fake_refs_enum/post/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_refs_enum/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**string_enum.StringEnum**](../../../../../../../components/schema/string_enum.md) | None, typing.Literal["placed", "approved", "delivered", "single quoted", "multiple\nlines", "double quote \n with newline"] | None, typing.Literal["placed", "approved", "delivered", "single quoted", "multiple\nlines", "double quote \n with newline"] +[**string_enum.StringEnum**](../../../../../../components/schema/string_enum.md) | None, typing.Literal["placed", "approved", "delivered", "single quoted", "multiple\nlines", "double quote \n with newline"] | None, typing.Literal["placed", "approved", "delivered", "single quoted", "multiple\nlines", "double quote \n with newline"] diff --git a/samples/client/petstore/python/docs/paths/fake_refs_mammal/post/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_refs_mammal/post/request_body/content/application_json/schema.md index 7c672eb2495..8b413491615 100644 --- a/samples/client/petstore/python/docs/paths/fake_refs_mammal/post/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_refs_mammal/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**mammal.Mammal**](../../../../../../../components/schema/mammal.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO +[**mammal.Mammal**](../../../../../../components/schema/mammal.md) | dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO diff --git a/samples/client/petstore/python/docs/paths/fake_refs_number/post/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_refs_number/post/request_body/content/application_json/schema.md index 3eb12fbbca2..c8aeb2e54c6 100644 --- a/samples/client/petstore/python/docs/paths/fake_refs_number/post/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_refs_number/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**number_with_validations.NumberWithValidations**](../../../../../../../components/schema/number_with_validations.md) | float, int | float, int +[**number_with_validations.NumberWithValidations**](../../../../../../components/schema/number_with_validations.md) | float, int | float, int diff --git a/samples/client/petstore/python/docs/paths/fake_refs_object_model_with_ref_props/post/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_refs_object_model_with_ref_props/post/request_body/content/application_json/schema.md index 70eb061f00c..b0776671107 100644 --- a/samples/client/petstore/python/docs/paths/fake_refs_object_model_with_ref_props/post/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_refs_object_model_with_ref_props/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**object_model_with_ref_props.ObjectModelWithRefProps**](../../../../../../../components/schema/object_model_with_ref_props.md) | [object_model_with_ref_props.ObjectModelWithRefPropsDictInput](../../../../../../../components/schema/object_model_with_ref_props.md#objectmodelwithrefpropsdictinput), [object_model_with_ref_props.ObjectModelWithRefPropsDict](../../../../../../../components/schema/object_model_with_ref_props.md#objectmodelwithrefpropsdict) | [object_model_with_ref_props.ObjectModelWithRefPropsDict](../../../../../../../components/schema/object_model_with_ref_props.md#objectmodelwithrefpropsdict) +[**object_model_with_ref_props.ObjectModelWithRefProps**](../../../../../../components/schema/object_model_with_ref_props.md) | [object_model_with_ref_props.ObjectModelWithRefPropsDictInput](../../../../../../components/schema/object_model_with_ref_props.md#objectmodelwithrefpropsdictinput), [object_model_with_ref_props.ObjectModelWithRefPropsDict](../../../../../../components/schema/object_model_with_ref_props.md#objectmodelwithrefpropsdict) | [object_model_with_ref_props.ObjectModelWithRefPropsDict](../../../../../../components/schema/object_model_with_ref_props.md#objectmodelwithrefpropsdict) diff --git a/samples/client/petstore/python/docs/paths/fake_refs_string/post/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/fake_refs_string/post/request_body/content/application_json/schema.md index 9ecd41d6929..923756a5e1b 100644 --- a/samples/client/petstore/python/docs/paths/fake_refs_string/post/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/fake_refs_string/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**string.String**](../../../../../../../components/schema/string.md) | str | str +[**string.String**](../../../../../../components/schema/string.md) | str | str diff --git a/samples/client/petstore/python/docs/paths/foo/get/servers/server_0.md b/samples/client/petstore/python/docs/paths/foo/get/servers/server_0.md new file mode 100644 index 00000000000..7f7c17bffa4 --- /dev/null +++ b/samples/client/petstore/python/docs/paths/foo/get/servers/server_0.md @@ -0,0 +1,4 @@ +# Server Server0 + +## Url +https://path-server-test.petstore.local/v2 diff --git a/samples/client/petstore/python/docs/paths/foo/get/servers/server_1.md b/samples/client/petstore/python/docs/paths/foo/get/servers/server_1.md new file mode 100644 index 00000000000..1f4a3cf3993 --- /dev/null +++ b/samples/client/petstore/python/docs/paths/foo/get/servers/server_1.md @@ -0,0 +1,9 @@ +# Server Server1 + +## Url +https://petstore.swagger.io/{version} + +## Variables +Key | Type | Description | Notes +--- | ---- | ----------- | ------ +**version** | str | | must be one of ["v1", "v2"] if omitted the client will use the default value of v1 diff --git a/samples/client/petstore/python/docs/paths/pet_find_by_status/servers/server_0.md b/samples/client/petstore/python/docs/paths/pet_find_by_status/servers/server_0.md new file mode 100644 index 00000000000..7f7c17bffa4 --- /dev/null +++ b/samples/client/petstore/python/docs/paths/pet_find_by_status/servers/server_0.md @@ -0,0 +1,4 @@ +# Server Server0 + +## Url +https://path-server-test.petstore.local/v2 diff --git a/samples/client/petstore/python/docs/paths/pet_find_by_status/servers/server_1.md b/samples/client/petstore/python/docs/paths/pet_find_by_status/servers/server_1.md new file mode 100644 index 00000000000..1f4a3cf3993 --- /dev/null +++ b/samples/client/petstore/python/docs/paths/pet_find_by_status/servers/server_1.md @@ -0,0 +1,9 @@ +# Server Server1 + +## Url +https://petstore.swagger.io/{version} + +## Variables +Key | Type | Description | Notes +--- | ---- | ----------- | ------ +**version** | str | | must be one of ["v1", "v2"] if omitted the client will use the default value of v1 diff --git a/samples/client/petstore/python/docs/paths/store_order/post/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/store_order/post/request_body/content/application_json/schema.md index 442903201dc..51064dfbf2f 100644 --- a/samples/client/petstore/python/docs/paths/store_order/post/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/store_order/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**order.Order**](../../../../../../../components/schema/order.md) | [order.OrderDictInput](../../../../../../../components/schema/order.md#orderdictinput), [order.OrderDict](../../../../../../../components/schema/order.md#orderdict) | [order.OrderDict](../../../../../../../components/schema/order.md#orderdict) +[**order.Order**](../../../../../../components/schema/order.md) | [order.OrderDictInput](../../../../../../components/schema/order.md#orderdictinput), [order.OrderDict](../../../../../../components/schema/order.md#orderdict) | [order.OrderDict](../../../../../../components/schema/order.md#orderdict) diff --git a/samples/client/petstore/python/docs/paths/user/post/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/user/post/request_body/content/application_json/schema.md index 95c59621bdc..bbc56f3522f 100644 --- a/samples/client/petstore/python/docs/paths/user/post/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/user/post/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**user.User**](../../../../../../../components/schema/user.md) | [user.UserDictInput](../../../../../../../components/schema/user.md#userdictinput), [user.UserDict](../../../../../../../components/schema/user.md#userdict) | [user.UserDict](../../../../../../../components/schema/user.md#userdict) +[**user.User**](../../../../../../components/schema/user.md) | [user.UserDictInput](../../../../../../components/schema/user.md#userdictinput), [user.UserDict](../../../../../../components/schema/user.md#userdict) | [user.UserDict](../../../../../../components/schema/user.md#userdict) diff --git a/samples/client/petstore/python/docs/paths/user_username/put/request_body/content/application_json/schema.md b/samples/client/petstore/python/docs/paths/user_username/put/request_body/content/application_json/schema.md index 95c59621bdc..bbc56f3522f 100644 --- a/samples/client/petstore/python/docs/paths/user_username/put/request_body/content/application_json/schema.md +++ b/samples/client/petstore/python/docs/paths/user_username/put/request_body/content/application_json/schema.md @@ -6,4 +6,4 @@ type: schemas.Schema ## Ref Schema Info Ref Schema | Input Type | Output Type ---------- | ---------- | ----------- -[**user.User**](../../../../../../../components/schema/user.md) | [user.UserDictInput](../../../../../../../components/schema/user.md#userdictinput), [user.UserDict](../../../../../../../components/schema/user.md#userdict) | [user.UserDict](../../../../../../../components/schema/user.md#userdict) +[**user.User**](../../../../../../components/schema/user.md) | [user.UserDictInput](../../../../../../components/schema/user.md#userdictinput), [user.UserDict](../../../../../../components/schema/user.md#userdict) | [user.UserDict](../../../../../../components/schema/user.md#userdict) From 7490ba8a274a16224027eea8a2351877a7da6fb3 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 4 Apr 2024 17:04:25 -0700 Subject: [PATCH 50/53] Samples regen --- .../java/.openapi-generator/FILES | 143 ------------------ 1 file changed, 143 deletions(-) diff --git a/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES b/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES index e12819c11ee..d54b57e2bf0 100644 --- a/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES +++ b/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES @@ -430,149 +430,6 @@ src/main/java/org/openapijsonschematools/client/servers/Server0.java src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java src/main/java/org/openapijsonschematools/client/servers/ServerWithVariables.java src/main/java/org/openapijsonschematools/client/servers/ServerWithoutVariables.java -src/test/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DateFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DurationFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IriFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RegexFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/TimeFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UuidFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.java src/test/java/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.java src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java From 6527ac509da42aec5859ab1c1249d71fb78e01d5 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 4 Apr 2024 17:55:29 -0700 Subject: [PATCH 51/53] Sample regen with fix for java array payloads with one null value --- .../java/.openapi-generator/FILES | 143 ++++++++++++++++++ .../ContainsWithNullInstanceElementsTest.java | 2 +- ...ateditemsWithNullInstanceElementsTest.java | 2 +- .../schemas/helpers/payload_renderer.hbs | 2 +- 4 files changed, 146 insertions(+), 3 deletions(-) diff --git a/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES b/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES index d54b57e2bf0..e12819c11ee 100644 --- a/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES +++ b/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES @@ -430,6 +430,149 @@ src/main/java/org/openapijsonschematools/client/servers/Server0.java src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java src/main/java/org/openapijsonschematools/client/servers/ServerWithVariables.java src/main/java/org/openapijsonschematools/client/servers/ServerWithoutVariables.java +src/test/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DateFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DurationFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IriFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RegexFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/TimeFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UuidFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.java src/test/java/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.java src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java index b1b96c9e8d7..6f2a8e7eb04 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java @@ -22,7 +22,7 @@ public void testAllowsNullItemsPasses() throws ValidationException { final var schema = ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1.getInstance(); schema.validate( Arrays.asList( - null + (Void) null ), configuration ); diff --git a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java index 5c55726383f..b800400ea07 100644 --- a/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java +++ b/samples/client/3_1_0_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java @@ -22,7 +22,7 @@ public void testAllowsNullElementsPasses() throws ValidationException { final var schema = UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1.getInstance(); schema.validate( Arrays.asList( - null + (Void) null ), configuration ); diff --git a/src/main/resources/java/src/main/java/packagename/components/schemas/helpers/payload_renderer.hbs b/src/main/resources/java/src/main/java/packagename/components/schemas/helpers/payload_renderer.hbs index 395b5ca3893..e2c661d3203 100644 --- a/src/main/resources/java/src/main/java/packagename/components/schemas/helpers/payload_renderer.hbs +++ b/src/main/resources/java/src/main/java/packagename/components/schemas/helpers/payload_renderer.hbs @@ -50,7 +50,7 @@ MapUtils.makeMap( {{/each}} {{else}} Arrays.asList( - {{#eq value.length 1}} + {{#eq value.size 1}} {{#each value}} {{! list with single null needs to describe the item as (Void) }} {{> src/main/java/packagename/components/schemas/helpers/payload_renderer endChar="" }} From e1451b49215f5fca57eee43a4b523ef0a5baaa28 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 4 Apr 2024 18:46:29 -0700 Subject: [PATCH 52/53] 303 java component schema tests regen --- .../java/.openapi-generator/FILES | 87 +++++++++++++++++++ ...sAllowsASchemaWhichShouldValidateTest.java | 7 +- ...onalpropertiesAreAllowedByDefaultTest.java | 3 +- ...itionalpropertiesCanExistByItselfTest.java | 5 +- ...pertiesShouldNotLookInApplicatorsTest.java | 5 +- .../AllofCombinedWithAnyofOneofTest.java | 17 ++-- .../schemas/AllofSimpleTypesTest.java | 5 +- .../client/components/schemas/AllofTest.java | 9 +- .../schemas/AllofWithBaseSchemaTest.java | 11 ++- .../schemas/AllofWithOneEmptySchemaTest.java | 3 +- .../AllofWithTheFirstEmptySchemaTest.java | 5 +- .../AllofWithTheLastEmptySchemaTest.java | 5 +- .../schemas/AllofWithTwoEmptySchemasTest.java | 3 +- .../schemas/AnyofComplexTypesTest.java | 9 +- .../client/components/schemas/AnyofTest.java | 9 +- .../schemas/AnyofWithBaseSchemaTest.java | 7 +- .../schemas/AnyofWithOneEmptySchemaTest.java | 5 +- .../schemas/ArrayTypeMatchesArraysTest.java | 15 ++-- .../BooleanTypeMatchesBooleansTest.java | 21 +++-- .../client/components/schemas/ByIntTest.java | 7 +- .../components/schemas/ByNumberTest.java | 7 +- .../components/schemas/BySmallNumberTest.java | 5 +- .../schemas/DateTimeFormatTest.java | 13 ++- .../components/schemas/EmailFormatTest.java | 13 ++- .../EnumWith0DoesNotMatchFalseTest.java | 7 +- .../EnumWith1DoesNotMatchTrueTest.java | 7 +- .../EnumWithEscapedCharactersTest.java | 7 +- .../EnumWithFalseDoesNotMatch0Test.java | 7 +- .../EnumWithTrueDoesNotMatch1Test.java | 7 +- .../schemas/EnumsInPropertiesTest.java | 13 ++- .../schemas/ForbiddenPropertyTest.java | 5 +- .../schemas/HostnameFormatTest.java | 13 ++- .../IntegerTypeMatchesIntegersTest.java | 19 ++-- ...NotRaiseErrorWhenFloatDivisionInfTest.java | 5 +- .../InvalidStringValueForDefaultTest.java | 5 +- .../components/schemas/Ipv4FormatTest.java | 13 ++- .../components/schemas/Ipv6FormatTest.java | 13 ++- .../schemas/JsonPointerFormatTest.java | 13 ++- .../schemas/MaximumValidationTest.java | 9 +- ...imumValidationWithUnsignedIntegerTest.java | 9 +- .../schemas/MaxitemsValidationTest.java | 9 +- .../schemas/MaxlengthValidationTest.java | 11 ++- ...xproperties0MeansTheObjectIsEmptyTest.java | 5 +- .../schemas/MaxpropertiesValidationTest.java | 13 ++- .../schemas/MinimumValidationTest.java | 9 +- ...inimumValidationWithSignedIntegerTest.java | 15 ++-- .../schemas/MinitemsValidationTest.java | 9 +- .../schemas/MinlengthValidationTest.java | 11 ++- .../schemas/MinpropertiesValidationTest.java | 13 ++- ...edAllofToCheckValidationSemanticsTest.java | 5 +- ...edAnyofToCheckValidationSemanticsTest.java | 5 +- .../components/schemas/NestedItemsTest.java | 7 +- ...edOneofToCheckValidationSemanticsTest.java | 5 +- .../schemas/NotMoreComplexSchemaTest.java | 7 +- .../client/components/schemas/NotTest.java | 5 +- .../schemas/NulCharactersInStringsTest.java | 5 +- .../NullTypeMatchesOnlyTheNullObjectTest.java | 21 +++-- .../schemas/NumberTypeMatchesNumbersTest.java | 19 ++-- .../ObjectPropertiesValidationTest.java | 13 ++- .../schemas/ObjectTypeMatchesObjectsTest.java | 15 ++-- .../schemas/OneofComplexTypesTest.java | 9 +- .../client/components/schemas/OneofTest.java | 9 +- .../schemas/OneofWithBaseSchemaTest.java | 7 +- .../schemas/OneofWithEmptySchemaTest.java | 5 +- .../schemas/OneofWithRequiredTest.java | 9 +- .../schemas/PatternIsNotAnchoredTest.java | 3 +- .../schemas/PatternValidationTest.java | 17 ++-- .../PropertiesWithEscapedCharactersTest.java | 5 +- ...opertyNamedRefThatIsNotAReferenceTest.java | 5 +- .../RefInAdditionalpropertiesTest.java | 5 +- .../components/schemas/RefInAllofTest.java | 5 +- .../components/schemas/RefInAnyofTest.java | 5 +- .../components/schemas/RefInItemsTest.java | 5 +- .../components/schemas/RefInNotTest.java | 5 +- .../components/schemas/RefInOneofTest.java | 5 +- .../components/schemas/RefInPropertyTest.java | 5 +- .../RequiredDefaultValidationTest.java | 3 +- .../schemas/RequiredValidationTest.java | 11 ++- .../schemas/RequiredWithEmptyArrayTest.java | 3 +- .../RequiredWithEscapedCharactersTest.java | 5 +- .../schemas/SimpleEnumValidationTest.java | 5 +- .../schemas/StringTypeMatchesStringsTest.java | 19 ++-- ...tDoAnythingIfThePropertyIsMissingTest.java | 7 +- .../UniqueitemsFalseValidationTest.java | 31 ++++--- .../schemas/UniqueitemsValidationTest.java | 51 ++++++----- .../components/schemas/UriFormatTest.java | 13 ++- .../schemas/UriReferenceFormatTest.java | 13 ++- .../schemas/UriTemplateFormatTest.java | 13 ++- 88 files changed, 454 insertions(+), 454 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES b/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES index fb6c2ec5ba4..9bda8d4d8ed 100644 --- a/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES +++ b/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES @@ -318,6 +318,93 @@ src/main/java/org/openapijsonschematools/client/servers/Server0.java src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java src/main/java/org/openapijsonschematools/client/servers/ServerWithVariables.java src/main/java/org/openapijsonschematools/client/servers/ServerWithoutVariables.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java +src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java +src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java src/test/java/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.java src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java index e78afe58438..6061b2a35b4 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AdditionalpropertiesAllowsASchemaWhichShouldValidateTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNoAdditionalPropertiesIsValidPasses() { + public void testNoAdditionalPropertiesIsValidPasses() throws ValidationException { // no additional properties is valid final var schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testNoAdditionalPropertiesIsValidPasses() { } @Test - public void testAnAdditionalValidPropertyIsValidPasses() { + public void testAnAdditionalValidPropertyIsValidPasses() throws ValidationException { // an additional valid property is valid final var schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance(); schema.validate( @@ -78,7 +77,7 @@ public void testAnAdditionalInvalidPropertyIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java index b279d9037a1..cc313aecdc7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AdditionalpropertiesAreAllowedByDefaultTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAdditionalPropertiesAreAllowedPasses() { + public void testAdditionalPropertiesAreAllowedPasses() throws ValidationException { // additional properties are allowed final var schema = AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java index 8c8d5a930f8..511ed766816 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AdditionalpropertiesCanExistByItselfTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnAdditionalValidPropertyIsValidPasses() { + public void testAnAdditionalValidPropertyIsValidPasses() throws ValidationException { // an additional valid property is valid final var schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testAnAdditionalInvalidPropertyIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java index 576f44818fe..8837b307146 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,13 +35,13 @@ public void testPropertiesDefinedInAllofAreNotExaminedFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidTestCasePasses() { + public void testValidTestCasePasses() throws ValidationException { // valid test case final var schema = AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java index e32dd818973..0a0b984f2a9 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testAllofFalseAnyofFalseOneofTrueFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -42,7 +41,7 @@ public void testAllofFalseAnyofTrueOneofFalseFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -57,7 +56,7 @@ public void testAllofFalseAnyofTrueOneofTrueFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -72,13 +71,13 @@ public void testAllofTrueAnyofFalseOneofFalseFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAllofTrueAnyofTrueOneofTruePasses() { + public void testAllofTrueAnyofTrueOneofTruePasses() throws ValidationException { // allOf: true, anyOf: true, oneOf: true final var schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance(); schema.validate( @@ -97,7 +96,7 @@ public void testAllofFalseAnyofFalseOneofFalseFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -112,7 +111,7 @@ public void testAllofTrueAnyofFalseOneofTrueFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -127,7 +126,7 @@ public void testAllofTrueAnyofTrueOneofFalseFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java index 6738af4533a..a1674088c48 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testMismatchOneFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidPasses() { + public void testValidPasses() throws ValidationException { // valid final var schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java index 96ceb9d6354..dd860fd7933 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -32,7 +31,7 @@ public void testMismatchSecondFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -56,7 +55,7 @@ public void testWrongTypeFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -76,13 +75,13 @@ public void testMismatchFirstFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAllofPasses() { + public void testAllofPasses() throws ValidationException { // allOf final var schema = Allof.Allof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java index 8b7da7ba706..6ecb6d11785 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,7 +35,7 @@ public void testMismatchBaseSchemaFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -60,13 +59,13 @@ public void testMismatchFirstAllofFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidPasses() { + public void testValidPasses() throws ValidationException { // valid final var schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance(); schema.validate( @@ -103,7 +102,7 @@ public void testMismatchBothFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -127,7 +126,7 @@ public void testMismatchSecondAllofFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java index 4a51f3f1393..b9789ef7a07 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AllofWithOneEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnyDataIsValidPasses() { + public void testAnyDataIsValidPasses() throws ValidationException { // any data is valid final var schema = AllofWithOneEmptySchema.AllofWithOneEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java index 84351d8fbe9..8ca39f6230c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testStringIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNumberIsValidPasses() { + public void testNumberIsValidPasses() throws ValidationException { // number is valid final var schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java index f0a11562d85..8dd9396f839 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testStringIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNumberIsValidPasses() { + public void testNumberIsValidPasses() throws ValidationException { // number is valid final var schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java index b7bcf055a29..de5acdab7e0 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AllofWithTwoEmptySchemasTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnyDataIsValidPasses() { + public void testAnyDataIsValidPasses() throws ValidationException { // any data is valid final var schema = AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java index a931b23d567..16f9ce46d75 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AnyofComplexTypesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testSecondAnyofValidComplexPasses() { + public void testSecondAnyofValidComplexPasses() throws ValidationException { // second anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testSecondAnyofValidComplexPasses() { } @Test - public void testBothAnyofValidComplexPasses() { + public void testBothAnyofValidComplexPasses() throws ValidationException { // both anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( @@ -52,7 +51,7 @@ public void testBothAnyofValidComplexPasses() { } @Test - public void testFirstAnyofValidComplexPasses() { + public void testFirstAnyofValidComplexPasses() throws ValidationException { // first anyOf valid (complex) final var schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance(); schema.validate( @@ -85,7 +84,7 @@ public void testNeitherAnyofValidComplexFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java index ef97ff6dff1..8862d6c0537 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AnyofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBothAnyofValidPasses() { + public void testBothAnyofValidPasses() throws ValidationException { // both anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( @@ -37,13 +36,13 @@ public void testNeitherAnyofValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testFirstAnyofValidPasses() { + public void testFirstAnyofValidPasses() throws ValidationException { // first anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testFirstAnyofValidPasses() { } @Test - public void testSecondAnyofValidPasses() { + public void testSecondAnyofValidPasses() throws ValidationException { // second anyOf valid final var schema = Anyof.Anyof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java index b75095b0576..ba43a0f6796 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testMismatchBaseSchemaFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testOneAnyofValidPasses() { + public void testOneAnyofValidPasses() throws ValidationException { // one anyOf valid final var schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance(); schema.validate( @@ -52,7 +51,7 @@ public void testBothAnyofInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java index 8829498ffaa..dd35d31abde 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class AnyofWithOneEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNumberIsValidPasses() { + public void testNumberIsValidPasses() throws ValidationException { // number is valid final var schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testNumberIsValidPasses() { } @Test - public void testStringIsValidPasses() { + public void testStringIsValidPasses() throws ValidationException { // string is valid final var schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java index 7320de65c06..3f66f6dd7d7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testABooleanIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -42,13 +41,13 @@ public void testAFloatIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAnArrayIsAnArrayPasses() { + public void testAnArrayIsAnArrayPasses() throws ValidationException { // an array is an array final var schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance(); schema.validate( @@ -68,7 +67,7 @@ public void testNullIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -83,7 +82,7 @@ public void testAStringIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -98,7 +97,7 @@ public void testAnIntegerIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -114,7 +113,7 @@ public void testAnObjectIsNotAnArrayFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java index 28095652c59..87d8cd62521 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testAFloatIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -42,13 +41,13 @@ public void testAStringIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testFalseIsABooleanPasses() { + public void testFalseIsABooleanPasses() throws ValidationException { // false is a boolean final var schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance(); schema.validate( @@ -58,7 +57,7 @@ public void testFalseIsABooleanPasses() { } @Test - public void testTrueIsABooleanPasses() { + public void testTrueIsABooleanPasses() throws ValidationException { // true is a boolean final var schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance(); schema.validate( @@ -78,7 +77,7 @@ public void testAnObjectIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -94,7 +93,7 @@ public void testAnArrayIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -109,7 +108,7 @@ public void testNullIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -124,7 +123,7 @@ public void testAnIntegerIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -139,7 +138,7 @@ public void testZeroIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -154,7 +153,7 @@ public void testAnEmptyStringIsNotABooleanFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java index 5238a51609e..74374bb8c74 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testIntByIntFailFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIntByIntPasses() { + public void testIntByIntPasses() throws ValidationException { // int by int final var schema = ByInt.ByInt1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testIntByIntPasses() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException { // ignores non-numbers final var schema = ByInt.ByInt1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java index c7a9bc144bd..4e7853023c6 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void test35IsNotMultipleOf15Fails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void test45IsMultipleOf15Passes() { + public void test45IsMultipleOf15Passes() throws ValidationException { // 4.5 is multiple of 1.5 final var schema = ByNumber.ByNumber1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void test45IsMultipleOf15Passes() { } @Test - public void testZeroIsMultipleOfAnythingPasses() { + public void testZeroIsMultipleOfAnythingPasses() throws ValidationException { // zero is multiple of anything final var schema = ByNumber.ByNumber1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java index 4bbf88c3921..49412ed2b66 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void test000751IsNotMultipleOf00001Fails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void test00075IsMultipleOf00001Passes() { + public void test00075IsMultipleOf00001Passes() throws ValidationException { // 0.0075 is multiple of 0.0001 final var schema = BySmallNumber.BySmallNumber1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java index a34d0f03faa..ec39814b9e5 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class DateTimeFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( @@ -70,7 +69,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = DateTimeFormat.DateTimeFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java index e09400e1157..3c2655ad339 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class EmailFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( @@ -70,7 +69,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = EmailFormat.EmailFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java index 3a72a8ab282..41bd273b265 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class EnumWith0DoesNotMatchFalseTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testFloatZeroIsValidPasses() { + public void testFloatZeroIsValidPasses() throws ValidationException { // float zero is valid final var schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance(); schema.validate( @@ -37,13 +36,13 @@ public void testFalseIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIntegerZeroIsValidPasses() { + public void testIntegerZeroIsValidPasses() throws ValidationException { // integer zero is valid final var schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java index fbfeb797f7a..68149695cb4 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testTrueIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testFloatOneIsValidPasses() { + public void testFloatOneIsValidPasses() throws ValidationException { // float one is valid final var schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testFloatOneIsValidPasses() { } @Test - public void testIntegerOneIsValidPasses() { + public void testIntegerOneIsValidPasses() throws ValidationException { // integer one is valid final var schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java index 1b2fd92ec8e..824c69b9e52 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testAnotherStringIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testMember2IsValidPasses() { + public void testMember2IsValidPasses() throws ValidationException { // member 2 is valid final var schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testMember2IsValidPasses() { } @Test - public void testMember1IsValidPasses() { + public void testMember1IsValidPasses() throws ValidationException { // member 1 is valid final var schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java index 4737d1537ac..2ebf7b16a0b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testFloatZeroIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testFalseIsValidPasses() { + public void testFalseIsValidPasses() throws ValidationException { // false is valid final var schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance(); schema.validate( @@ -52,7 +51,7 @@ public void testIntegerZeroIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java index 183135f6f0f..126722f76af 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testFloatOneIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -42,13 +41,13 @@ public void testIntegerOneIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testTrueIsValidPasses() { + public void testTrueIsValidPasses() throws ValidationException { // true is valid final var schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java index 0917720a711..6ae3209d9ab 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,7 +35,7 @@ public void testWrongBarValueFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -60,7 +59,7 @@ public void testWrongFooValueFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -76,13 +75,13 @@ public void testMissingAllPropertiesIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testBothPropertiesAreValidPasses() { + public void testBothPropertiesAreValidPasses() throws ValidationException { // both properties are valid final var schema = EnumsInProperties.EnumsInProperties1.getInstance(); schema.validate( @@ -101,7 +100,7 @@ public void testBothPropertiesAreValidPasses() { } @Test - public void testMissingOptionalPropertyIsValidPasses() { + public void testMissingOptionalPropertyIsValidPasses() throws ValidationException { // missing optional property is valid final var schema = EnumsInProperties.EnumsInProperties1.getInstance(); schema.validate( @@ -130,7 +129,7 @@ public void testMissingRequiredPropertyIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java index 82ee3dc86a9..f4abf2a98e7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,13 +35,13 @@ public void testPropertyPresentFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testPropertyAbsentPasses() { + public void testPropertyAbsentPasses() throws ValidationException { // property absent final var schema = ForbiddenProperty.ForbiddenProperty1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java index 28827e12a61..5363089e46a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class HostnameFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( @@ -70,7 +69,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = HostnameFormat.HostnameFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java index 9bd3fc054a5..4feb92f8419 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -28,7 +27,7 @@ public void testAnObjectIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -44,7 +43,7 @@ public void testAnArrayIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -59,13 +58,13 @@ public void testNullIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAFloatWithZeroFractionalPartIsAnIntegerPasses() { + public void testAFloatWithZeroFractionalPartIsAnIntegerPasses() throws ValidationException { // a float with zero fractional part is an integer final var schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance(); schema.validate( @@ -84,7 +83,7 @@ public void testABooleanIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -99,7 +98,7 @@ public void testAStringIsStillNotAnIntegerEvenIfItLooksLikeOneFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -114,13 +113,13 @@ public void testAStringIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAnIntegerIsAnIntegerPasses() { + public void testAnIntegerIsAnIntegerPasses() throws ValidationException { // an integer is an integer final var schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance(); schema.validate( @@ -139,7 +138,7 @@ public void testAFloatIsNotAnIntegerFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java index 9e11bdbcdb6..08a2ebb0375 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testAlwaysInvalidButNaiveImplementationsMayRaiseAnOverflowErrorFails configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidIntegerWithMultipleofFloatPasses() { + public void testValidIntegerWithMultipleofFloatPasses() throws ValidationException { // valid integer with multipleOf float final var schema = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java index 3a4c529692d..8ba96984479 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class InvalidStringValueForDefaultTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testValidWhenPropertyIsSpecifiedPasses() { + public void testValidWhenPropertyIsSpecifiedPasses() throws ValidationException { // valid when property is specified final var schema = InvalidStringValueForDefault.InvalidStringValueForDefault1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testValidWhenPropertyIsSpecifiedPasses() { } @Test - public void testStillValidWhenTheInvalidDefaultIsUsedPasses() { + public void testStillValidWhenTheInvalidDefaultIsUsedPasses() throws ValidationException { // still valid when the invalid default is used final var schema = InvalidStringValueForDefault.InvalidStringValueForDefault1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java index 0397a32aae1..ef0437cb7a5 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class Ipv4FormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( @@ -70,7 +69,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = Ipv4Format.Ipv4Format1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java index da110ec06c0..f31ff138716 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class Ipv6FormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( @@ -70,7 +69,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = Ipv6Format.Ipv6Format1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java index 37ac945057a..6c3cfa7e875 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class JsonPointerFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( @@ -70,7 +69,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = JsonPointerFormat.JsonPointerFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java index 060e7cbe47c..b1dff24361b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testAboveTheMaximumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testBoundaryPointIsValidPasses() { + public void testBoundaryPointIsValidPasses() throws ValidationException { // boundary point is valid final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testBoundaryPointIsValidPasses() { } @Test - public void testBelowTheMaximumIsValidPasses() { + public void testBelowTheMaximumIsValidPasses() throws ValidationException { // below the maximum is valid final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testBelowTheMaximumIsValidPasses() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException { // ignores non-numbers final var schema = MaximumValidation.MaximumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java index 7de1376dc82..cb8878f3a0b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testAboveTheMaximumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testBelowTheMaximumIsInvalidPasses() { + public void testBelowTheMaximumIsInvalidPasses() throws ValidationException { // below the maximum is invalid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testBelowTheMaximumIsInvalidPasses() { } @Test - public void testBoundaryPointIntegerIsValidPasses() { + public void testBoundaryPointIntegerIsValidPasses() throws ValidationException { // boundary point integer is valid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testBoundaryPointIntegerIsValidPasses() { } @Test - public void testBoundaryPointFloatIsValidPasses() { + public void testBoundaryPointFloatIsValidPasses() throws ValidationException { // boundary point float is valid final var schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java index f44118876b0..d3f0f0840f7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MaxitemsValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() { + public void testShorterIsValidPasses() throws ValidationException { // shorter is valid final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( @@ -30,7 +29,7 @@ public void testShorterIsValidPasses() { } @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( @@ -56,13 +55,13 @@ public void testTooLongIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresNonArraysPasses() { + public void testIgnoresNonArraysPasses() throws ValidationException { // ignores non-arrays final var schema = MaxitemsValidation.MaxitemsValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java index 441f220cf30..85afd54340c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MaxlengthValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() { + public void testShorterIsValidPasses() throws ValidationException { // shorter is valid final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testShorterIsValidPasses() { } @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -47,13 +46,13 @@ public void testTooLongIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresNonStringsPasses() { + public void testIgnoresNonStringsPasses() throws ValidationException { // ignores non-strings final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( @@ -63,7 +62,7 @@ public void testIgnoresNonStringsPasses() { } @Test - public void testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() { + public void testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() throws ValidationException { // two supplementary Unicode code points is long enough final var schema = MaxlengthValidation.MaxlengthValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java index 203eab6db9a..677ee68f23c 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -32,13 +31,13 @@ public void testOnePropertyIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNoPropertiesIsValidPasses() { + public void testNoPropertiesIsValidPasses() throws ValidationException { // no properties is valid final var schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java index f0fae897e64..3dfdc1f8f4a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MaxpropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testShorterIsValidPasses() { + public void testShorterIsValidPasses() throws ValidationException { // shorter is valid final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testShorterIsValidPasses() { } @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -74,13 +73,13 @@ public void testTooLongIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -90,7 +89,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( @@ -104,7 +103,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException { // ignores strings final var schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java index 938de6c0c23..f56d91c9459 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MinimumValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBoundaryPointIsValidPasses() { + public void testBoundaryPointIsValidPasses() throws ValidationException { // boundary point is valid final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( @@ -37,13 +36,13 @@ public void testBelowTheMinimumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException { // ignores non-numbers final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testIgnoresNonNumbersPasses() { } @Test - public void testAboveTheMinimumIsValidPasses() { + public void testAboveTheMinimumIsValidPasses() throws ValidationException { // above the minimum is valid final var schema = MinimumValidation.MinimumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java index e5252c6c48a..1f8d353e533 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MinimumValidationWithSignedIntegerTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBoundaryPointWithFloatIsValidPasses() { + public void testBoundaryPointWithFloatIsValidPasses() throws ValidationException { // boundary point with float is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testBoundaryPointWithFloatIsValidPasses() { } @Test - public void testBoundaryPointIsValidPasses() { + public void testBoundaryPointIsValidPasses() throws ValidationException { // boundary point is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -47,13 +46,13 @@ public void testIntBelowTheMinimumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testPositiveAboveTheMinimumIsValidPasses() { + public void testPositiveAboveTheMinimumIsValidPasses() throws ValidationException { // positive above the minimum is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -63,7 +62,7 @@ public void testPositiveAboveTheMinimumIsValidPasses() { } @Test - public void testNegativeAboveTheMinimumIsValidPasses() { + public void testNegativeAboveTheMinimumIsValidPasses() throws ValidationException { // negative above the minimum is valid final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -73,7 +72,7 @@ public void testNegativeAboveTheMinimumIsValidPasses() { } @Test - public void testIgnoresNonNumbersPasses() { + public void testIgnoresNonNumbersPasses() throws ValidationException { // ignores non-numbers final var schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance(); schema.validate( @@ -92,7 +91,7 @@ public void testFloatBelowTheMinimumIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java index fe973599a5f..64106617015 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MinitemsValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( @@ -30,7 +29,7 @@ public void testExactLengthIsValidPasses() { } @Test - public void testIgnoresNonArraysPasses() { + public void testIgnoresNonArraysPasses() throws ValidationException { // ignores non-arrays final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( @@ -40,7 +39,7 @@ public void testIgnoresNonArraysPasses() { } @Test - public void testLongerIsValidPasses() { + public void testLongerIsValidPasses() throws ValidationException { // longer is valid final var schema = MinitemsValidation.MinitemsValidation1.getInstance(); schema.validate( @@ -63,7 +62,7 @@ public void testTooShortIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java index 8a0b2faf8f5..07b264a5c82 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MinlengthValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testExactLengthIsValidPasses() { } @Test - public void testLongerIsValidPasses() { + public void testLongerIsValidPasses() throws ValidationException { // longer is valid final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testLongerIsValidPasses() { } @Test - public void testIgnoresNonStringsPasses() { + public void testIgnoresNonStringsPasses() throws ValidationException { // ignores non-strings final var schema = MinlengthValidation.MinlengthValidation1.getInstance(); schema.validate( @@ -57,7 +56,7 @@ public void testTooShortIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -72,7 +71,7 @@ public void testOneSupplementaryUnicodeCodePointIsNotLongEnoughFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java index 109b3b7fbfd..172344eb28b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class MinpropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testExactLengthIsValidPasses() { + public void testExactLengthIsValidPasses() throws ValidationException { // exact length is valid final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testExactLengthIsValidPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testLongerIsValidPasses() { + public void testLongerIsValidPasses() throws ValidationException { // longer is valid final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -62,7 +61,7 @@ public void testLongerIsValidPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( @@ -83,13 +82,13 @@ public void testTooShortIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException { // ignores strings final var schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java index 7f0e5197f48..5495226a1ba 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NestedAllofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() { + public void testNullIsValidPasses() throws ValidationException { // null is valid final var schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testAnythingNonNullIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java index 40c68fea595..ef87267b15b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NestedAnyofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() { + public void testNullIsValidPasses() throws ValidationException { // null is valid final var schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testAnythingNonNullIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java index a730cd66895..40475304a3d 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -56,7 +55,7 @@ public void testNestedArrayWithInvalidTypeFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -94,13 +93,13 @@ public void testNotDeepEnoughFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testValidNestedArrayPasses() { + public void testValidNestedArrayPasses() throws ValidationException { // valid nested array final var schema = NestedItems.NestedItems1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java index e16c8bc3373..9fe66b0503e 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NestedOneofToCheckValidationSemanticsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNullIsValidPasses() { + public void testNullIsValidPasses() throws ValidationException { // null is valid final var schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testAnythingNonNullIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java index d3fbe75257c..bbfe9858805 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NotMoreComplexSchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testOtherMatchPasses() { + public void testOtherMatchPasses() throws ValidationException { // other match final var schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance(); schema.validate( @@ -47,13 +46,13 @@ public void testMismatchFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testMatchPasses() { + public void testMatchPasses() throws ValidationException { // match final var schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java index bc2bc52984c..ab90c86cd0f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testDisallowedFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAllowedPasses() { + public void testAllowedPasses() throws ValidationException { // allowed final var schema = Not.Not1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java index fb754a14c5f..ebb974de6e5 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NulCharactersInStringsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMatchStringWithNulPasses() { + public void testMatchStringWithNulPasses() throws ValidationException { // match string with nul final var schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testDoNotMatchStringLackingNulFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java index 637d7878b59..a45c6ec610b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testZeroIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -43,7 +42,7 @@ public void testAnArrayIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -59,7 +58,7 @@ public void testAnObjectIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -74,7 +73,7 @@ public void testTrueIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -89,13 +88,13 @@ public void testFalseIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNullIsNullPasses() { + public void testNullIsNullPasses() throws ValidationException { // null is null final var schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance(); schema.validate( @@ -114,7 +113,7 @@ public void testAStringIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -129,7 +128,7 @@ public void testAnIntegerIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -144,7 +143,7 @@ public void testAnEmptyStringIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -159,7 +158,7 @@ public void testAFloatIsNotNullFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java index 7158fd026db..ff6e9d37dce 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class NumberTypeMatchesNumbersTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAFloatIsANumberPasses() { + public void testAFloatIsANumberPasses() throws ValidationException { // a float is a number final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAFloatIsANumberPasses() { } @Test - public void testAnIntegerIsANumberPasses() { + public void testAnIntegerIsANumberPasses() throws ValidationException { // an integer is a number final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testAStringIsStillNotANumberEvenIfItLooksLikeOneFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -62,13 +61,13 @@ public void testABooleanIsNotANumberFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() { + public void testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() throws ValidationException { // a float with zero fractional part is a number (and an integer) final var schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance(); schema.validate( @@ -87,7 +86,7 @@ public void testNullIsNotANumberFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -102,7 +101,7 @@ public void testAStringIsNotANumberFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -118,7 +117,7 @@ public void testAnArrayIsNotANumberFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -134,7 +133,7 @@ public void testAnObjectIsNotANumberFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java index 46aef85c136..49a367ac58d 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ObjectPropertiesValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testBothPropertiesPresentAndValidIsValidPasses() { + public void testBothPropertiesPresentAndValidIsValidPasses() throws ValidationException { // both properties present and valid is valid final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testBothPropertiesPresentAndValidIsValidPasses() { } @Test - public void testDoesnTInvalidateOtherPropertiesPasses() { + public void testDoesnTInvalidateOtherPropertiesPasses() throws ValidationException { // doesn't invalidate other properties final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testDoesnTInvalidateOtherPropertiesPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -83,13 +82,13 @@ public void testBothPropertiesInvalidIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance(); schema.validate( @@ -119,7 +118,7 @@ public void testOnePropertyInvalidIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java index 0d4f932b859..85587d1cd10 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class ObjectTypeMatchesObjectsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAnObjectIsAnObjectPasses() { + public void testAnObjectIsAnObjectPasses() throws ValidationException { // an object is an object final var schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance(); schema.validate( @@ -39,7 +38,7 @@ public void testAnArrayIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -54,7 +53,7 @@ public void testAnIntegerIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -69,7 +68,7 @@ public void testABooleanIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -84,7 +83,7 @@ public void testAStringIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -99,7 +98,7 @@ public void testAFloatIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -114,7 +113,7 @@ public void testNullIsNotAnObjectFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java index 46cabdaf335..e94f9277dce 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class OneofComplexTypesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testSecondOneofValidComplexPasses() { + public void testSecondOneofValidComplexPasses() throws ValidationException { // second oneOf valid (complex) final var schema = OneofComplexTypes.OneofComplexTypes1.getInstance(); schema.validate( @@ -51,13 +50,13 @@ public void testBothOneofValidComplexFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testFirstOneofValidComplexPasses() { + public void testFirstOneofValidComplexPasses() throws ValidationException { // first oneOf valid (complex) final var schema = OneofComplexTypes.OneofComplexTypes1.getInstance(); schema.validate( @@ -90,7 +89,7 @@ public void testNeitherOneofValidComplexFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java index 4aafad49183..50252968f84 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,7 +26,7 @@ public void testBothOneofValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -42,13 +41,13 @@ public void testNeitherOneofValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testSecondOneofValidPasses() { + public void testSecondOneofValidPasses() throws ValidationException { // second oneOf valid final var schema = Oneof.Oneof1.getInstance(); schema.validate( @@ -58,7 +57,7 @@ public void testSecondOneofValidPasses() { } @Test - public void testFirstOneofValidPasses() { + public void testFirstOneofValidPasses() throws ValidationException { // first oneOf valid final var schema = Oneof.Oneof1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java index 2dfe72cd7fa..ea57fe7c2bd 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testMismatchBaseSchemaFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testOneOneofValidPasses() { + public void testOneOneofValidPasses() throws ValidationException { // one oneOf valid final var schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance(); schema.validate( @@ -52,7 +51,7 @@ public void testBothOneofValidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java index 4500ca75474..5113d359187 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class OneofWithEmptySchemaTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testOneValidValidPasses() { + public void testOneValidValidPasses() throws ValidationException { // one valid - valid final var schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void testBothValidInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java index fed6deab27e..db5b73fd386 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class OneofWithRequiredTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testFirstValidValidPasses() { + public void testFirstValidValidPasses() throws ValidationException { // first valid - valid final var schema = OneofWithRequired.OneofWithRequired1.getInstance(); schema.validate( @@ -59,13 +58,13 @@ public void testBothValidInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testSecondValidValidPasses() { + public void testSecondValidValidPasses() throws ValidationException { // second valid - valid final var schema = OneofWithRequired.OneofWithRequired1.getInstance(); schema.validate( @@ -98,7 +97,7 @@ public void testBothInvalidInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java index 70153cd7cb5..0f3306d9ed7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PatternIsNotAnchoredTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMatchesASubstringPasses() { + public void testMatchesASubstringPasses() throws ValidationException { // matches a substring final var schema = PatternIsNotAnchored.PatternIsNotAnchored1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java index fc5ff8000e3..b9cbe91112a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PatternValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testIgnoresBooleansPasses() { + public void testIgnoresBooleansPasses() throws ValidationException { // ignores booleans final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testIgnoresBooleansPasses() { } @Test - public void testIgnoresFloatsPasses() { + public void testIgnoresFloatsPasses() throws ValidationException { // ignores floats final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -47,13 +46,13 @@ public void testANonMatchingPatternIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testIgnoresIntegersPasses() { + public void testIgnoresIntegersPasses() throws ValidationException { // ignores integers final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -63,7 +62,7 @@ public void testIgnoresIntegersPasses() { } @Test - public void testAMatchingPatternIsValidPasses() { + public void testAMatchingPatternIsValidPasses() throws ValidationException { // a matching pattern is valid final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -73,7 +72,7 @@ public void testAMatchingPatternIsValidPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -84,7 +83,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testIgnoresObjectsPasses() { + public void testIgnoresObjectsPasses() throws ValidationException { // ignores objects final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( @@ -95,7 +94,7 @@ public void testIgnoresObjectsPasses() { } @Test - public void testIgnoresNullPasses() { + public void testIgnoresNullPasses() throws ValidationException { // ignores null final var schema = PatternValidation.PatternValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java index d394de1e6ed..9708c6d0a96 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PropertiesWithEscapedCharactersTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testObjectWithAllNumbersIsValidPasses() { + public void testObjectWithAllNumbersIsValidPasses() throws ValidationException { // object with all numbers is valid final var schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance(); schema.validate( @@ -87,7 +86,7 @@ public void testObjectWithStringsIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java index 70412b8ca3f..3daa2b69f6f 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class PropertyNamedRefThatIsNotAReferenceTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException { // property named $ref valid final var schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testPropertyNamedRefInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java index 3fc09b3946b..f87c4096442 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RefInAdditionalpropertiesTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException { // property named $ref valid final var schema = RefInAdditionalproperties.RefInAdditionalproperties1.getInstance(); schema.validate( @@ -57,7 +56,7 @@ public void testPropertyNamedRefInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java index 2f49c75fa81..e60e3d09821 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RefInAllofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException { // property named $ref valid final var schema = RefInAllof.RefInAllof1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testPropertyNamedRefInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java index c4199877c08..3465e0518ed 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RefInAnyofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException { // property named $ref valid final var schema = RefInAnyof.RefInAnyof1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testPropertyNamedRefInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java index 239677fb66b..171e2a6c1d0 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RefInItemsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException { // property named $ref valid final var schema = RefInItems.RefInItems1.getInstance(); schema.validate( @@ -53,7 +52,7 @@ public void testPropertyNamedRefInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java index 7a68dc4be5f..fa8ce496346 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RefInNotTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException { // property named $ref valid final var schema = RefInNot.RefInNot1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testPropertyNamedRefInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java index e8555cad3f3..f4048ec8ed3 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RefInOneofTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException { // property named $ref valid final var schema = RefInOneof.RefInOneof1.getInstance(); schema.validate( @@ -47,7 +46,7 @@ public void testPropertyNamedRefInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java index 65cfaad0251..e00319809fb 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RefInPropertyTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNamedRefValidPasses() { + public void testPropertyNamedRefValidPasses() throws ValidationException { // property named $ref valid final var schema = RefInProperty.RefInProperty1.getInstance(); schema.validate( @@ -57,7 +56,7 @@ public void testPropertyNamedRefInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java index b439c59a44b..f02f348d3c7 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RequiredDefaultValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNotRequiredByDefaultPasses() { + public void testNotRequiredByDefaultPasses() throws ValidationException { // not required by default final var schema = RequiredDefaultValidation.RequiredDefaultValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java index 3757ebf8c49..6c3326cf9eb 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RequiredValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPresentRequiredPropertyIsValidPasses() { + public void testPresentRequiredPropertyIsValidPasses() throws ValidationException { // present required property is valid final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -33,7 +32,7 @@ public void testPresentRequiredPropertyIsValidPasses() { } @Test - public void testIgnoresOtherNonObjectsPasses() { + public void testIgnoresOtherNonObjectsPasses() throws ValidationException { // ignores other non-objects final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -43,7 +42,7 @@ public void testIgnoresOtherNonObjectsPasses() { } @Test - public void testIgnoresArraysPasses() { + public void testIgnoresArraysPasses() throws ValidationException { // ignores arrays final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -54,7 +53,7 @@ public void testIgnoresArraysPasses() { } @Test - public void testIgnoresStringsPasses() { + public void testIgnoresStringsPasses() throws ValidationException { // ignores strings final var schema = RequiredValidation.RequiredValidation1.getInstance(); schema.validate( @@ -78,7 +77,7 @@ public void testNonPresentRequiredPropertyIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java index d6a8add1e4c..ab0c3b23704 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class RequiredWithEmptyArrayTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testPropertyNotRequiredPasses() { + public void testPropertyNotRequiredPasses() throws ValidationException { // property not required final var schema = RequiredWithEmptyArray.RequiredWithEmptyArray1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java index a2c05a6f22e..4d0f295d05a 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,13 +35,13 @@ public void testObjectWithSomePropertiesMissingIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testObjectWithAllPropertiesPresentIsValidPasses() { + public void testObjectWithAllPropertiesPresentIsValidPasses() throws ValidationException { // object with all properties present is valid final var schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java index 53f95f8e48e..26dda5efa38 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -27,13 +26,13 @@ public void testSomethingElseIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testOneOfTheEnumIsValidPasses() { + public void testOneOfTheEnumIsValidPasses() throws ValidationException { // one of the enum is valid final var schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java index 226c06bc19f..af3c4c287bd 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class StringTypeMatchesStringsTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() { + public void testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() throws ValidationException { // a string is still a string, even if it looks like a number final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( @@ -37,7 +36,7 @@ public void test1IsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -52,13 +51,13 @@ public void testABooleanIsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAnEmptyStringIsStillAStringPasses() { + public void testAnEmptyStringIsStillAStringPasses() throws ValidationException { // an empty string is still a string final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( @@ -78,7 +77,7 @@ public void testAnArrayIsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -94,7 +93,7 @@ public void testAnObjectIsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -109,13 +108,13 @@ public void testNullIsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAStringIsAStringPasses() { + public void testAStringIsAStringPasses() throws ValidationException { // a string is a string final var schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance(); schema.validate( @@ -134,7 +133,7 @@ public void testAFloatIsNotAStringFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java index 6b63fd753ce..a5bb3c8dc7b 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testMissingPropertiesAreNotFilledInWithTheDefaultPasses() { + public void testMissingPropertiesAreNotFilledInWithTheDefaultPasses() throws ValidationException { // missing properties are not filled in with the default final var schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance(); schema.validate( @@ -29,7 +28,7 @@ public void testMissingPropertiesAreNotFilledInWithTheDefaultPasses() { } @Test - public void testAnExplicitPropertyValueIsCheckedAgainstMaximumPassingPasses() { + public void testAnExplicitPropertyValueIsCheckedAgainstMaximumPassingPasses() throws ValidationException { // an explicit property value is checked against maximum (passing) final var schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance(); schema.validate( @@ -58,7 +57,7 @@ public void testAnExplicitPropertyValueIsCheckedAgainstMaximumFailingFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java index 5c0b5aaaeea..ec0b6a01bd8 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UniqueitemsFalseValidationTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testNumbersAreUniqueIfMathematicallyUnequalPasses() { + public void testNumbersAreUniqueIfMathematicallyUnequalPasses() throws ValidationException { // numbers are unique if mathematically unequal final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -32,7 +31,7 @@ public void testNumbersAreUniqueIfMathematicallyUnequalPasses() { } @Test - public void testNonUniqueArrayOfIntegersIsValidPasses() { + public void testNonUniqueArrayOfIntegersIsValidPasses() throws ValidationException { // non-unique array of integers is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -45,7 +44,7 @@ public void testNonUniqueArrayOfIntegersIsValidPasses() { } @Test - public void testNonUniqueArrayOfObjectsIsValidPasses() { + public void testNonUniqueArrayOfObjectsIsValidPasses() throws ValidationException { // non-unique array of objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -68,7 +67,7 @@ public void testNonUniqueArrayOfObjectsIsValidPasses() { } @Test - public void testNonUniqueArrayOfArraysIsValidPasses() { + public void testNonUniqueArrayOfArraysIsValidPasses() throws ValidationException { // non-unique array of arrays is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -85,7 +84,7 @@ public void testNonUniqueArrayOfArraysIsValidPasses() { } @Test - public void test1AndTrueAreUniquePasses() { + public void test1AndTrueAreUniquePasses() throws ValidationException { // 1 and true are unique final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -98,7 +97,7 @@ public void test1AndTrueAreUniquePasses() { } @Test - public void testUniqueArrayOfNestedObjectsIsValidPasses() { + public void testUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException { // unique array of nested objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -141,7 +140,7 @@ public void testUniqueArrayOfNestedObjectsIsValidPasses() { } @Test - public void testUniqueArrayOfArraysIsValidPasses() { + public void testUniqueArrayOfArraysIsValidPasses() throws ValidationException { // unique array of arrays is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -158,7 +157,7 @@ public void testUniqueArrayOfArraysIsValidPasses() { } @Test - public void testTrueIsNotEqualToOnePasses() { + public void testTrueIsNotEqualToOnePasses() throws ValidationException { // true is not equal to one final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -171,7 +170,7 @@ public void testTrueIsNotEqualToOnePasses() { } @Test - public void testNonUniqueHeterogeneousTypesAreValidPasses() { + public void testNonUniqueHeterogeneousTypesAreValidPasses() throws ValidationException { // non-unique heterogeneous types are valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -192,7 +191,7 @@ public void testNonUniqueHeterogeneousTypesAreValidPasses() { } @Test - public void testFalseIsNotEqualToZeroPasses() { + public void testFalseIsNotEqualToZeroPasses() throws ValidationException { // false is not equal to zero final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -205,7 +204,7 @@ public void testFalseIsNotEqualToZeroPasses() { } @Test - public void testUniqueArrayOfIntegersIsValidPasses() { + public void testUniqueArrayOfIntegersIsValidPasses() throws ValidationException { // unique array of integers is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -218,7 +217,7 @@ public void testUniqueArrayOfIntegersIsValidPasses() { } @Test - public void test0AndFalseAreUniquePasses() { + public void test0AndFalseAreUniquePasses() throws ValidationException { // 0 and false are unique final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -231,7 +230,7 @@ public void test0AndFalseAreUniquePasses() { } @Test - public void testUniqueHeterogeneousTypesAreValidPasses() { + public void testUniqueHeterogeneousTypesAreValidPasses() throws ValidationException { // unique heterogeneous types are valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -250,7 +249,7 @@ public void testUniqueHeterogeneousTypesAreValidPasses() { } @Test - public void testUniqueArrayOfObjectsIsValidPasses() { + public void testUniqueArrayOfObjectsIsValidPasses() throws ValidationException { // unique array of objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( @@ -273,7 +272,7 @@ public void testUniqueArrayOfObjectsIsValidPasses() { } @Test - public void testNonUniqueArrayOfNestedObjectsIsValidPasses() { + public void testNonUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException { // non-unique array of nested objects is valid final var schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java index 6f6fba93a47..737a03d30aa 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -31,7 +30,7 @@ public void testNonUniqueArrayOfMoreThanTwoIntegersIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -59,13 +58,13 @@ public void testNonUniqueArrayOfObjectsIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testATrueAndA1AreUniquePasses() { + public void testATrueAndA1AreUniquePasses() throws ValidationException { // {\\\"a\\\": true} and {\\\"a\\\": 1} are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -88,7 +87,7 @@ public void testATrueAndA1AreUniquePasses() { } @Test - public void test1AndTrueAreUniquePasses() { + public void test1AndTrueAreUniquePasses() throws ValidationException { // [1] and [true] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -117,13 +116,13 @@ public void testNonUniqueArrayOfIntegersIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testNested0AndFalseAreUniquePasses() { + public void testNested0AndFalseAreUniquePasses() throws ValidationException { // nested [0] and [false] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -176,7 +175,7 @@ public void testObjectsAreNonUniqueDespiteKeyOrderFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -198,13 +197,13 @@ public void testNonUniqueArrayOfArraysIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testAFalseAndA0AreUniquePasses() { + public void testAFalseAndA0AreUniquePasses() throws ValidationException { // {\\\"a\\\": false} and {\\\"a\\\": 0} are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -246,13 +245,13 @@ public void testNonUniqueArrayOfMoreThanTwoArraysIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void test0AndFalseAreUniquePasses() { + public void test0AndFalseAreUniquePasses() throws ValidationException { // [0] and [false] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -311,7 +310,7 @@ public void testNonUniqueArrayOfNestedObjectsIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -330,7 +329,7 @@ public void testNumbersAreUniqueIfMathematicallyUnequalFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @@ -349,13 +348,13 @@ public void testNonUniqueArrayOfStringsIsInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } @Test - public void testUniqueArrayOfNestedObjectsIsValidPasses() { + public void testUniqueArrayOfNestedObjectsIsValidPasses() throws ValidationException { // unique array of nested objects is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -398,7 +397,7 @@ public void testUniqueArrayOfNestedObjectsIsValidPasses() { } @Test - public void testUniqueArrayOfArraysIsValidPasses() { + public void testUniqueArrayOfArraysIsValidPasses() throws ValidationException { // unique array of arrays is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -415,7 +414,7 @@ public void testUniqueArrayOfArraysIsValidPasses() { } @Test - public void testTrueIsNotEqualToOnePasses() { + public void testTrueIsNotEqualToOnePasses() throws ValidationException { // true is not equal to one final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -428,7 +427,7 @@ public void testTrueIsNotEqualToOnePasses() { } @Test - public void testNested1AndTrueAreUniquePasses() { + public void testNested1AndTrueAreUniquePasses() throws ValidationException { // nested [1] and [true] are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -451,7 +450,7 @@ public void testNested1AndTrueAreUniquePasses() { } @Test - public void testUniqueArrayOfStringsIsValidPasses() { + public void testUniqueArrayOfStringsIsValidPasses() throws ValidationException { // unique array of strings is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -465,7 +464,7 @@ public void testUniqueArrayOfStringsIsValidPasses() { } @Test - public void testFalseIsNotEqualToZeroPasses() { + public void testFalseIsNotEqualToZeroPasses() throws ValidationException { // false is not equal to zero final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -478,7 +477,7 @@ public void testFalseIsNotEqualToZeroPasses() { } @Test - public void testUniqueArrayOfIntegersIsValidPasses() { + public void testUniqueArrayOfIntegersIsValidPasses() throws ValidationException { // unique array of integers is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -491,7 +490,7 @@ public void testUniqueArrayOfIntegersIsValidPasses() { } @Test - public void testDifferentObjectsAreUniquePasses() { + public void testDifferentObjectsAreUniquePasses() throws ValidationException { // different objects are unique final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -522,7 +521,7 @@ public void testDifferentObjectsAreUniquePasses() { } @Test - public void testUniqueHeterogeneousTypesAreValidPasses() { + public void testUniqueHeterogeneousTypesAreValidPasses() throws ValidationException { // unique heterogeneous types are valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -542,7 +541,7 @@ public void testUniqueHeterogeneousTypesAreValidPasses() { } @Test - public void testUniqueArrayOfObjectsIsValidPasses() { + public void testUniqueArrayOfObjectsIsValidPasses() throws ValidationException { // unique array of objects is valid final var schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance(); schema.validate( @@ -585,7 +584,7 @@ public void testNonUniqueHeterogeneousTypesAreInvalidFails() { configuration ); throw new RuntimeException("A different exception must be thrown"); - } catch (ValidationException | InvalidTypeException ignored) { + } catch (ValidationException ignored) { ; } } diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java index 14ce5c09bd2..5d909143906 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UriFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( @@ -70,7 +69,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = UriFormat.UriFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java index 9ae84cd3823..46ecb7c2b34 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UriReferenceFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( @@ -70,7 +69,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = UriReferenceFormat.UriReferenceFormat1.getInstance(); schema.validate( diff --git a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java index cb29e46630f..b1a756104cd 100644 --- a/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java +++ b/samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java @@ -5,7 +5,6 @@ import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags; import org.openapijsonschematools.client.configurations.SchemaConfiguration; import org.openapijsonschematools.client.exceptions.ValidationException; -import org.openapijsonschematools.client.exceptions.InvalidTypeException; import org.openapijsonschematools.client.schemas.validation.MapUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -18,7 +17,7 @@ public class UriTemplateFormatTest { static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.onlyFormat()); @Test - public void testAllStringFormatsIgnoreIntegersPasses() { + public void testAllStringFormatsIgnoreIntegersPasses() throws ValidationException { // all string formats ignore integers final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -28,7 +27,7 @@ public void testAllStringFormatsIgnoreIntegersPasses() { } @Test - public void testAllStringFormatsIgnoreNullsPasses() { + public void testAllStringFormatsIgnoreNullsPasses() throws ValidationException { // all string formats ignore nulls final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -38,7 +37,7 @@ public void testAllStringFormatsIgnoreNullsPasses() { } @Test - public void testAllStringFormatsIgnoreObjectsPasses() { + public void testAllStringFormatsIgnoreObjectsPasses() throws ValidationException { // all string formats ignore objects final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -49,7 +48,7 @@ public void testAllStringFormatsIgnoreObjectsPasses() { } @Test - public void testAllStringFormatsIgnoreFloatsPasses() { + public void testAllStringFormatsIgnoreFloatsPasses() throws ValidationException { // all string formats ignore floats final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -59,7 +58,7 @@ public void testAllStringFormatsIgnoreFloatsPasses() { } @Test - public void testAllStringFormatsIgnoreArraysPasses() { + public void testAllStringFormatsIgnoreArraysPasses() throws ValidationException { // all string formats ignore arrays final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( @@ -70,7 +69,7 @@ public void testAllStringFormatsIgnoreArraysPasses() { } @Test - public void testAllStringFormatsIgnoreBooleansPasses() { + public void testAllStringFormatsIgnoreBooleansPasses() throws ValidationException { // all string formats ignore booleans final var schema = UriTemplateFormat.UriTemplateFormat1.getInstance(); schema.validate( From a46495b003f419a159222ddf6ed76460bbf41d2e Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 4 Apr 2024 19:02:33 -0700 Subject: [PATCH 53/53] Samples regen --- .../java/.openapi-generator/FILES | 87 ----------- .../java/.openapi-generator/FILES | 143 ------------------ 2 files changed, 230 deletions(-) diff --git a/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES b/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES index 9bda8d4d8ed..fb6c2ec5ba4 100644 --- a/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES +++ b/samples/client/3_0_3_unit_test/java/.openapi-generator/FILES @@ -318,93 +318,6 @@ src/main/java/org/openapijsonschematools/client/servers/Server0.java src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java src/main/java/org/openapijsonschematools/client/servers/ServerWithVariables.java src/main/java/org/openapijsonschematools/client/servers/ServerWithoutVariables.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInAllofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInNotTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInOneofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java src/test/java/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.java src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java diff --git a/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES b/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES index e12819c11ee..d54b57e2bf0 100644 --- a/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES +++ b/samples/client/3_1_0_unit_test/java/.openapi-generator/FILES @@ -430,149 +430,6 @@ src/main/java/org/openapijsonschematools/client/servers/Server0.java src/main/java/org/openapijsonschematools/client/servers/ServerProvider.java src/main/java/org/openapijsonschematools/client/servers/ServerWithVariables.java src/main/java/org/openapijsonschematools/client/servers/ServerWithoutVariables.java -src/test/java/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ByIntTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ByNumberTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DateFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/DurationFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EmailFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.java -src/test/java/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IriFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NotTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RegexFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/TimeFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/UuidFormatTest.java -src/test/java/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.java src/test/java/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.java src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java